diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index 6e3b2dacf1..7192f3395f 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -35,6 +35,9 @@ void save_vbnv(const uint8_t *vbnv_copy); void init_chromeos(int bootmode); struct romstage_handoff; + +/* TODO(shawnn): Remove these CONFIGs and define default weak functions + * that can be overridden in the platform / MB code. */ #if CONFIG_VBOOT_VERIFY_FIRMWARE /* * This is a dual purpose routine. If dest is non-NULL the region at @@ -57,6 +60,7 @@ static inline int vboot_get_handoff_info(void **addr, uint32_t *size) } static inline int vboot_skip_display_init(void) { return 0; } #endif +int vboot_get_sw_write_protect(void); #include "gnvs.h" struct device; diff --git a/src/vendorcode/google/chromeos/vboot_handoff.c b/src/vendorcode/google/chromeos/vboot_handoff.c index 71ac5cdb48..1a66f56828 100644 --- a/src/vendorcode/google/chromeos/vboot_handoff.c +++ b/src/vendorcode/google/chromeos/vboot_handoff.c @@ -93,6 +93,12 @@ void *vboot_get_region(uintptr_t offset_addr, size_t size, void *dest) } } +int __attribute((weak)) vboot_get_sw_write_protect(void) +{ + // Can be implemented by a platform / mainboard + return 0; +} + static void *vboot_get_payload(size_t *len) { struct vboot_handoff *vboot_handoff; diff --git a/src/vendorcode/google/chromeos/vboot_loader.c b/src/vendorcode/google/chromeos/vboot_loader.c index 8e0babed35..240b6b6fc5 100644 --- a/src/vendorcode/google/chromeos/vboot_loader.c +++ b/src/vendorcode/google/chromeos/vboot_loader.c @@ -249,6 +249,8 @@ static void vboot_invoke_wrapper(struct vboot_handoff *vboot_handoff) *iflags |= VB_INIT_FLAG_REC_BUTTON_PRESSED; if (get_write_protect_state()) *iflags |= VB_INIT_FLAG_WP_ENABLED; + if (vboot_get_sw_write_protect()) + *iflags |= VB_INIT_FLAG_SW_WP_ENABLED; if (CONFIG_VIRTUAL_DEV_SWITCH) *iflags |= VB_INIT_FLAG_VIRTUAL_DEV_SWITCH; if (CONFIG_EC_SOFTWARE_SYNC) {