faft: Enable the ENTER_TRIGGERS_TONORM GBB flag at the beginning for FAFT
The official firmware now only allows Space to trigger the TONORM screen.
But FAFT is unable to send SPACE on non-Chrome EC devices. The GBB flag
ENTER_TRIGGERS_TONORM allows Enter to trigger the TONORM screen too. So
at the beginning for any FAFT, this flag should be enabled such that FAFT
can use Enter to trigger TONORM. This change also removes sending Space
to trigger the TONORM screen.
BUG=chrome-os-partner:12699
TEST=Run firmware_DevMode on a new Snow firmware and see the message:
Change the GBB flags from 0x39 to 0x70.
Change-Id: Icb46d95e7d696a73da3c7a1ec475d78137e71fb7
Reviewed-on: https://gerrit.chromium.org/gerrit/30506
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 9998431..a20582a 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -201,6 +201,7 @@
GBB_FLAG_FORCE_DEV_SWITCH_ON = 0x00000008
GBB_FLAG_FORCE_DEV_BOOT_USB = 0x00000010
GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK = 0x00000020
+ GBB_FLAG_ENTER_TRIGGERS_TONORM = 0x00000040
_faft_template = {}
_faft_sequence = ()
@@ -269,8 +270,9 @@
'reboot_action': (self.sync_and_warm_reboot),
'firmware_action': (None)
})
- self.clear_gbb_flags(self.GBB_FLAG_FORCE_DEV_SWITCH_ON |
- self.GBB_FLAG_DEV_SCREEN_SHORT_DELAY)
+ self.clear_set_gbb_flags(self.GBB_FLAG_FORCE_DEV_SWITCH_ON |
+ self.GBB_FLAG_DEV_SCREEN_SHORT_DELAY,
+ self.GBB_FLAG_ENTER_TRIGGERS_TONORM)
if self._install_image_path:
self.install_test_image(self._install_image_path,
self._firmware_update)
@@ -341,22 +343,24 @@
})
- def clear_gbb_flags(self, mask):
- """Clear the GBB flags in the current flashrom.
+ def clear_set_gbb_flags(self, clear_mask, set_mask):
+ """Clear and set the GBB flags in the current flashrom.
Args:
- mask: A mask of flags to be cleared.
+ clear_mask: A mask of flags to be cleared.
+ set_mask: A mask of flags to be set.
"""
gbb_flags = self.faft_client.get_gbb_flags()
- if (gbb_flags & mask):
- new_flags = gbb_flags & ctypes.c_uint32(~mask).value
- logging.info('Clear the GBB flags of 0x%x, from 0x%x to 0x%x.' %
- (mask, gbb_flags, new_flags))
+ new_flags = gbb_flags & ctypes.c_uint32(~clear_mask).value | set_mask
+
+ if (gbb_flags != new_flags):
+ logging.info('Change the GBB flags from 0x%x to 0x%x.' %
+ (gbb_flags, new_flags))
self.faft_client.run_shell_command(
'/usr/share/vboot/bin/set_gbb_flags.sh 0x%x' % new_flags)
self.faft_client.reload_firmware()
# If changing FORCE_DEV_SWITCH_ON flag, reboot to get a clear state
- if (gbb_flags & mask & self.GBB_FLAG_FORCE_DEV_SWITCH_ON):
+ if ((gbb_flags ^ new_flags) & self.GBB_FLAG_FORCE_DEV_SWITCH_ON):
self.run_faft_step({
'firmware_action': self.wait_fw_screen_and_ctrl_d,
})
@@ -826,12 +830,6 @@
if dev:
self.send_ctrl_d_to_dut()
else:
- # Only SPACE can trigger TO_NORM screen officially.
- # We send both SPACE and ENTER in order to make the old and new
- # firmware still work. It won't trigger twice since only one of
- # them takes effect.
- # TODO Remove to ENTER when all devices use new firmware.
- self.send_space_to_dut()
self.send_enter_to_dut()
time.sleep(self.FIRMWARE_SCREEN_DELAY)
self.send_enter_to_dut()