firmware_LockedME: Check for SW WP status
Prior to Apollolake only the contents of SI_DESC was used to protect SI_DESC.
Starting with Apollolake, the SPI flash part can also protect SI_DESC, so this
adds a check for software write protect.
BUG=chromium:754760
TEST=test_that --board=soraka 172.22.18.16 firmware_LockedME with dut having
wp on and off.
Change-Id: If50a3db7903e380331d7a47cb7d577a8807754b1
Reviewed-on: https://chromium-review.googlesource.com/719427
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Venkata Srinivasa Raju Penmetcha <venkataraju@chromium.org>
Reviewed-by: Kevin Shelton <kmshelton@chromium.org>
diff --git a/client/site_tests/firmware_LockedME/firmware_LockedME.py b/client/site_tests/firmware_LockedME/firmware_LockedME.py
index 37d9820..dce9a46 100644
--- a/client/site_tests/firmware_LockedME/firmware_LockedME.py
+++ b/client/site_tests/firmware_LockedME/firmware_LockedME.py
@@ -22,6 +22,18 @@
extra = ['-p', 'host'] + list(args)
return utils.run('flashrom', ignore_status=ignore_status, args=extra)
+ def determine_sw_wp_status(self):
+ """Determine software write-protect status."""
+ logging.info('Check that SW WP is enabled or not...')
+ flashrom_result = self.flashrom(args=('--wp-status',))
+ logging.info('The above flashrom command returns.... %s',
+ flashrom_result.stdout)
+ if (("disabled" in flashrom_result.stdout) and
+ ("start=0x00000000, len=0x0000000" in flashrom_result.stdout)):
+ return False
+ else:
+ return True
+
def has_ME(self):
"""See if we can detect an ME.
FREG* is printed only when HSFS_FDV is set, which means the descriptor
@@ -92,6 +104,11 @@
raise error.TestNAError('This test is not applicable, '
'because an ARM device has been detected. '
'ARM devices do not have an ME (Management Engine)')
+ # If sw wp is on, and the ME regions are unlocked, they won't be
+ # writable so will appear locked.
+ if self.determine_sw_wp_status():
+ raise error.TestFail('Software wp is enabled. Please disable '
+ 'software wp prior to running this test.')
# See if the system even has an ME, and whether we expected that.
if self.has_ME():