diff options
-rw-r--r-- | src/ec/google/chromeec/ec.c | 41 | ||||
-rw-r--r-- | src/ec/google/chromeec/ec.h | 1 | ||||
-rw-r--r-- | src/include/bootmode.h | 2 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/vboot_handoff.c | 6 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/vboot_loader.c | 4 |
5 files changed, 36 insertions, 18 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index e5a9e9a54a..9e6e4d6691 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -93,11 +93,35 @@ static u32 google_chromeec_get_mask(u8 type) return 0; } +static int google_chromeec_set_mask(u8 type, u32 mask) +{ + struct ec_params_host_event_mask req; + struct ec_response_host_event_mask rsp; + struct chromeec_command cmd; + + req.mask = mask; + cmd.cmd_code = type; + cmd.cmd_version = 0; + cmd.cmd_data_in = &req; + cmd.cmd_size_in = sizeof(req); + cmd.cmd_data_out = &rsp; + cmd.cmd_size_out = sizeof(rsp); + + return google_chromeec_command(&cmd); +} + u32 google_chromeec_get_events_b(void) { return google_chromeec_get_mask(EC_CMD_HOST_EVENT_GET_B); } +int google_chromeec_clear_events_b(u32 mask) +{ + printk(BIOS_DEBUG, "Chrome EC: clear events_b mask to 0x%08x\n", mask); + return google_chromeec_set_mask( + EC_CMD_HOST_EVENT_CLEAR_B, mask); +} + #ifndef __SMM__ void google_chromeec_check_ec_image(int expected_type) { @@ -278,23 +302,6 @@ int google_chromeec_i2c_xfer(uint8_t chip, uint8_t addr, int alen, return 0; } -static int google_chromeec_set_mask(u8 type, u32 mask) -{ - struct ec_params_host_event_mask req; - struct ec_response_host_event_mask rsp; - struct chromeec_command cmd; - - req.mask = mask; - cmd.cmd_code = type; - cmd.cmd_version = 0; - cmd.cmd_data_in = &req; - cmd.cmd_size_in = sizeof(req); - cmd.cmd_data_out = &rsp; - cmd.cmd_size_out = sizeof(rsp); - - return google_chromeec_command(&cmd); -} - int google_chromeec_set_sci_mask(u32 mask) { printk(BIOS_DEBUG, "Chrome EC: Set SCI mask to 0x%08x\n", mask); diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index cf77b692f7..a1c59b8dc5 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -43,6 +43,7 @@ void google_chromeec_check_ec_image(int expected_type); uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size); u16 google_chromeec_get_board_version(void); u32 google_chromeec_get_events_b(void); +int google_chromeec_clear_events_b(u32 mask); int google_chromeec_kbbacklight(int percent); void google_chromeec_post(u8 postcode); void google_chromeec_log_events(u32 mask); diff --git a/src/include/bootmode.h b/src/include/bootmode.h index 323668b321..55e3f5f36f 100644 --- a/src/include/bootmode.h +++ b/src/include/bootmode.h @@ -25,6 +25,8 @@ void init_bootmode_straps(void); int get_write_protect_state(void); int get_developer_mode_switch(void); int get_recovery_mode_switch(void); +int clear_recovery_mode_switch(void); + int gfx_get_init_done(void); void gfx_set_init_done(int done); diff --git a/src/vendorcode/google/chromeos/vboot_handoff.c b/src/vendorcode/google/chromeos/vboot_handoff.c index 1a66f56828..7ef2c7ee5a 100644 --- a/src/vendorcode/google/chromeos/vboot_handoff.c +++ b/src/vendorcode/google/chromeos/vboot_handoff.c @@ -54,6 +54,12 @@ int vboot_enable_recovery(void) return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_RECOVERY); } +int __attribute__((weak)) clear_recovery_mode_switch(void) +{ + // Can be implemented by a mainboard + return 0; +} + int vboot_skip_display_init(void) { struct vboot_handoff *vbho; diff --git a/src/vendorcode/google/chromeos/vboot_loader.c b/src/vendorcode/google/chromeos/vboot_loader.c index 240b6b6fc5..80e2aea1bb 100644 --- a/src/vendorcode/google/chromeos/vboot_loader.c +++ b/src/vendorcode/google/chromeos/vboot_loader.c @@ -245,8 +245,10 @@ static void vboot_invoke_wrapper(struct vboot_handoff *vboot_handoff) iflags = &vboot_handoff->init_params.flags; if (get_developer_mode_switch()) *iflags |= VB_INIT_FLAG_DEV_SWITCH_ON; - if (get_recovery_mode_switch()) + if (get_recovery_mode_switch()) { + clear_recovery_mode_switch(); *iflags |= VB_INIT_FLAG_REC_BUTTON_PRESSED; + } if (get_write_protect_state()) *iflags |= VB_INIT_FLAG_WP_ENABLED; if (vboot_get_sw_write_protect()) |