From ad20ea449951e49ecd991ade3a8f3f5a3fd7a227 Mon Sep 17 00:00:00 2001 From: Gurleen Grewal Date: Fri, 13 Sep 2019 17:42:48 -0700 Subject: tpmtest: Make it work with current cr50 A couple of changes are needed to make tpmtests run with the latest cr50: 1. The CRYPTO_TESTS flag turns off the TPM in cr50 build, so no need to initalize TPM. 2. FW_UPGRADE protocol now uses offset into flash instead of absolute memory addresses to perform upgrade. BUG=None TEST=test/tpm_test/tpmtest.py runs and all tests pass Change-Id: I2402ba956e4588a7452128e75fbc82c44f8cf04f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1804068 Tested-by: Gurleen Grewal Commit-Queue: Gurleen Grewal Reviewed-by: Vadim Sukhomlinov Reviewed-by: Vadim Bendebury --- test/tpm_test/tpmtest.py | 4 ---- test/tpm_test/upgrade_test.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/test/tpm_test/tpmtest.py b/test/tpm_test/tpmtest.py index a774e4913e..2f915a09d9 100755 --- a/test/tpm_test/tpmtest.py +++ b/test/tpm_test/tpmtest.py @@ -55,10 +55,6 @@ class TPM(object): self._handle = ftdi_spi_tpm if not self._handle.FtdiSpiInit(freq, debug_mode): raise subcmd.TpmTestError('Failed to connect') - response = self.command(''.join('%c' % int('0x%s' % x, 16) - for x in self.STARTUP_CMD.split())) - if ' '.join('%2.2x' % ord(x) for x in response) not in self.STARTUP_RSP: - raise subcmd.TpmTestError('init failed') def validate(self, data_blob, response_mode=False): """Check if a data blob complies with TPM command/response header format.""" diff --git a/test/tpm_test/upgrade_test.py b/test/tpm_test/upgrade_test.py index 2d2c0b7169..69e8630358 100644 --- a/test/tpm_test/upgrade_test.py +++ b/test/tpm_test/upgrade_test.py @@ -37,9 +37,9 @@ def upgrade(tpm): raise subcmd.TpmTestError('Initialization error %d' % ord(base_str[0])) base = struct.unpack_from('>4I', base_str)[3] - if base == 0x84000: + if base == 0x44000: fname = 'build/cr50/RW/ec.RW_B.flat' - elif base == 0x44000: + elif base == 0x4000: fname = 'build/cr50/RW/ec.RW.flat' else: raise subcmd.TpmTestError('Unknown base address 0x%x' % base) -- cgit v1.2.1