Joel Kitching has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32262
Change subject: vboot: refactor OPROM code ......................................................................
vboot: refactor OPROM code
The name OPROM is somewhat inaccurate, since other steps to bring up display and graphics are needed depending on mainboard/SoC. This patch cleans up OPROM code nomenclature, and works towards the goal of deprecating vboot1:
* Rename CONFIG_VBOOT_OPROM_MATTERS to CONFIG_VBOOT_MUST_REQUEST_DISPLAY and clarify Kconfig description * Remove function vboot_handoff_skip_display_init * Remove use of the VbInit oflag VB_INIT_OUT_ENABLE_DISPLAY * Add field |declares_display| to vboot_working_data struct * Add functions to get andset |declares_display|
BUG=b:124141368, b:124192753, chromium:948529 TEST=make clean && make test-abuild TEST=build and flash eve device; attempt loading dev/rec modes BRANCH=none
Change-Id: Idf111a533c3953448b4b9084885a9a65a2432a8b Signed-off-by: Joel Kitching kitching@google.com --- M src/lib/bootmode.c M src/northbridge/intel/haswell/Kconfig M src/security/vboot/Kconfig M src/security/vboot/common.c M src/security/vboot/misc.h M src/security/vboot/vboot_common.c M src/security/vboot/vboot_common.h M src/security/vboot/vboot_handoff.c M src/soc/intel/apollolake/Kconfig M src/soc/intel/baytrail/Kconfig M src/soc/intel/braswell/Kconfig M src/soc/intel/broadwell/Kconfig M src/soc/intel/cannonlake/Kconfig M src/soc/intel/icelake/Kconfig M src/soc/intel/skylake/Kconfig M src/soc/mediatek/mt8173/Kconfig M src/soc/mediatek/mt8183/Kconfig M src/soc/nvidia/tegra124/Kconfig M src/soc/nvidia/tegra210/Kconfig M src/soc/qualcomm/sdm845/Kconfig M src/soc/rockchip/rk3288/Kconfig M src/soc/rockchip/rk3399/Kconfig 22 files changed, 46 insertions(+), 42 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/32262/1
diff --git a/src/lib/bootmode.c b/src/lib/bootmode.c index 052eb8f..1b39031 100644 --- a/src/lib/bootmode.c +++ b/src/lib/bootmode.c @@ -35,11 +35,13 @@
int display_init_required(void) { - /* For vboot always honor vboot_handoff_skip_display_init(). */ + /* For vboot always honor vboot_declares_display(). */ if (CONFIG(VBOOT)) { - /* Must always select OPROM_MATTERS when using this function. */ - if (!CONFIG(VBOOT_OPROM_MATTERS)) + /* Must always select MUST_REQUEST_DISPLAY when using this + * function. */ + if (!CONFIG(VBOOT_MUST_REQUEST_DISPLAY)) dead_code(); + return vboot_declares_display(); return !vboot_handoff_skip_display_init(); }
diff --git a/src/northbridge/intel/haswell/Kconfig b/src/northbridge/intel/haswell/Kconfig index 082f2d6..c251b7d 100644 --- a/src/northbridge/intel/haswell/Kconfig +++ b/src/northbridge/intel/haswell/Kconfig @@ -26,7 +26,7 @@ if NORTHBRIDGE_INTEL_HASWELL
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_ROMSTAGE
config BOOTBLOCK_NORTHBRIDGE_INIT diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig index 4815cb1..66bcc1e 100644 --- a/src/security/vboot/Kconfig +++ b/src/security/vboot/Kconfig @@ -169,17 +169,15 @@ reboots caused after vboot verification is run. e.g. reboots caused by FSP components on Intel platforms.
-config VBOOT_OPROM_MATTERS +config VBOOT_MUST_REQUEST_DISPLAY bool default y if VGA_ROM_RUN default n help Set this option to indicate to vboot that this platform will skip its display initialization on a normal (non-recovery, non-developer) boot. - Vboot calls this "oprom matters" because on x86 devices this - traditionally meant that the video option ROM will not be loaded, but - it works functionally the same for other platforms that can skip their - native display initialization code instead. + Unless display is specifically requested, the video option ROM is not + loaded, and any other native display initialization code is not run.
config VBOOT_HAS_REC_HASH_SPACE bool diff --git a/src/security/vboot/common.c b/src/security/vboot/common.c index 8f8165a..b26b7e5 100644 --- a/src/security/vboot/common.c +++ b/src/security/vboot/common.c @@ -117,6 +117,16 @@ return reg->size > 0; }
+int vboot_set_declares_display(int declared) +{ + vboot_get_working_data()->declares_display = declared; +} + +int vboot_declares_display(void) +{ + return vboot_get_working_data()->declares_display; +} + #if CONFIG(VBOOT_MIGRATE_WORKING_DATA) /* * For platforms that do not employ VBOOT_STARTS_IN_ROMSTAGE, vboot diff --git a/src/security/vboot/misc.h b/src/security/vboot/misc.h index 27317ad..8ed6038 100644 --- a/src/security/vboot/misc.h +++ b/src/security/vboot/misc.h @@ -34,6 +34,7 @@ */ struct vboot_working_data { struct selected_region selected_region; + uint8_t declares_display; /* offset of the buffer from the start of this struct */ uint32_t buffer_offset; uint32_t buffer_size; @@ -53,6 +54,9 @@ void vboot_set_selected_region(const struct region *region); int vboot_is_slot_selected(void);
+int vboot_set_declares_display(int declared); +int vboot_declares_display(void); + /* * Source: security/vboot/vboot_handoff.c */ diff --git a/src/security/vboot/vboot_common.c b/src/security/vboot/vboot_common.c index 5e95c62..3dddc76 100644 --- a/src/security/vboot/vboot_common.c +++ b/src/security/vboot/vboot_common.c @@ -88,11 +88,6 @@ return !!(vbho->init_params.out_flags & flag); }
-int vboot_handoff_skip_display_init(void) -{ - return !vboot_get_handoff_flag(VB_INIT_OUT_ENABLE_DISPLAY); -} - int vboot_handoff_check_developer_flag(void) { return vboot_get_handoff_flag(VB_INIT_OUT_ENABLE_DEVELOPER); diff --git a/src/security/vboot/vboot_common.h b/src/security/vboot/vboot_common.h index 8c92437..768b29d 100644 --- a/src/security/vboot/vboot_common.h +++ b/src/security/vboot/vboot_common.h @@ -60,7 +60,6 @@ * Returns 0 for flag if false * Returns value read for other fields */ -int vboot_handoff_skip_display_init(void); int vboot_handoff_check_recovery_flag(void); int vboot_handoff_check_developer_flag(void); int vboot_handoff_get_recovery_reason(void); diff --git a/src/security/vboot/vboot_handoff.c b/src/security/vboot/vboot_handoff.c index 2f239e6..42562ce 100644 --- a/src/security/vboot/vboot_handoff.c +++ b/src/security/vboot/vboot_handoff.c @@ -67,29 +67,25 @@ vb_sd->flags |= VBSD_BOOT_REC_SWITCH_ON; *oflags |= VB_INIT_OUT_ENABLE_RECOVERY; *oflags |= VB_INIT_OUT_CLEAR_RAM; - *oflags |= VB_INIT_OUT_ENABLE_DISPLAY; *oflags |= VB_INIT_OUT_ENABLE_USB_STORAGE; } if (vb2_sd->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) { *oflags |= VB_INIT_OUT_ENABLE_DEVELOPER; *oflags |= VB_INIT_OUT_CLEAR_RAM; - *oflags |= VB_INIT_OUT_ENABLE_DISPLAY; *oflags |= VB_INIT_OUT_ENABLE_USB_STORAGE; vb_sd->flags |= VBSD_BOOT_DEV_SWITCH_ON; vb_sd->flags |= VBSD_LF_DEV_SWITCH_ON; } - /* TODO: Set these in depthcharge */ - if (CONFIG(VBOOT_OPROM_MATTERS)) { + /* Inform vboot if the display was requested by vboot kernel phase + * or enabled by dev/rec mode. */ + if (vboot_wants_oprom() || vb2_sd->recovery_reason || + vb2_sd->flags & VB2_SD_FLAG_DEV_MODE_ENABLED) { + vboot_set_declares_display(1); + vb_sd->flags |= VBSD_OPROM_LOADED; + } + /* TODO: Remove when depthcharge no longer reads this flag. */ + if (CONFIG(VBOOT_MUST_REQUEST_DISPLAY)) { vb_sd->flags |= VBSD_OPROM_MATTERS; - /* - * Inform vboot if the display was enabled by dev/rec - * mode or was requested by vboot kernel phase. - */ - if ((*oflags & VB_INIT_OUT_ENABLE_DISPLAY) || - vboot_wants_oprom()) { - vb_sd->flags |= VBSD_OPROM_LOADED; - *oflags |= VB_INIT_OUT_ENABLE_DISPLAY; - } }
/* In vboot1, VBSD_FWB_TRIED is diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig index d715f39..35d383d 100644 --- a/src/soc/intel/apollolake/Kconfig +++ b/src/soc/intel/apollolake/Kconfig @@ -118,7 +118,7 @@
config VBOOT select VBOOT_SEPARATE_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_VBNV_CMOS diff --git a/src/soc/intel/baytrail/Kconfig b/src/soc/intel/baytrail/Kconfig index a83a7e9..03ad31d 100644 --- a/src/soc/intel/baytrail/Kconfig +++ b/src/soc/intel/baytrail/Kconfig @@ -43,7 +43,7 @@ select CPU_HAS_L2_ENABLE_MSR
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_ROMSTAGE
config BOOTBLOCK_CPU_INIT diff --git a/src/soc/intel/braswell/Kconfig b/src/soc/intel/braswell/Kconfig index 8db4795..a0c0708 100644 --- a/src/soc/intel/braswell/Kconfig +++ b/src/soc/intel/braswell/Kconfig @@ -53,7 +53,7 @@ select SOUTHBRIDGE_INTEL_COMMON_SMBUS
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_ROMSTAGE
config BOOTBLOCK_CPU_INIT diff --git a/src/soc/intel/broadwell/Kconfig b/src/soc/intel/broadwell/Kconfig index 5f503da..149cf9a 100644 --- a/src/soc/intel/broadwell/Kconfig +++ b/src/soc/intel/broadwell/Kconfig @@ -65,7 +65,7 @@ default y
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_ROMSTAGE
config BOOTBLOCK_CPU_INIT diff --git a/src/soc/intel/cannonlake/Kconfig b/src/soc/intel/cannonlake/Kconfig index 9796546..46271d6 100644 --- a/src/soc/intel/cannonlake/Kconfig +++ b/src/soc/intel/cannonlake/Kconfig @@ -228,7 +228,7 @@
config VBOOT select VBOOT_SEPARATE_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_VBNV_CMOS diff --git a/src/soc/intel/icelake/Kconfig b/src/soc/intel/icelake/Kconfig index 2e9e3e2..2fbc6da 100644 --- a/src/soc/intel/icelake/Kconfig +++ b/src/soc/intel/icelake/Kconfig @@ -151,7 +151,7 @@
config VBOOT select VBOOT_SEPARATE_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_VBNV_CMOS diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig index 5116f3a..fcfe2b6 100644 --- a/src/soc/intel/skylake/Kconfig +++ b/src/soc/intel/skylake/Kconfig @@ -106,7 +106,7 @@
config VBOOT select VBOOT_SEPARATE_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_VBNV_CMOS diff --git a/src/soc/mediatek/mt8173/Kconfig b/src/soc/mediatek/mt8173/Kconfig index b0d6fa0..e966b8e 100644 --- a/src/soc/mediatek/mt8173/Kconfig +++ b/src/soc/mediatek/mt8173/Kconfig @@ -16,7 +16,7 @@ if SOC_MEDIATEK_MT8173
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_SEPARATE_VERSTAGE
diff --git a/src/soc/mediatek/mt8183/Kconfig b/src/soc/mediatek/mt8183/Kconfig index 6582e4e..f96282c 100644 --- a/src/soc/mediatek/mt8183/Kconfig +++ b/src/soc/mediatek/mt8183/Kconfig @@ -14,7 +14,7 @@ if SOC_MEDIATEK_MT8183
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_SEPARATE_VERSTAGE
diff --git a/src/soc/nvidia/tegra124/Kconfig b/src/soc/nvidia/tegra124/Kconfig index eecb59b..475d50e 100644 --- a/src/soc/nvidia/tegra124/Kconfig +++ b/src/soc/nvidia/tegra124/Kconfig @@ -18,7 +18,7 @@ if SOC_NVIDIA_TEGRA124
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_SEPARATE_VERSTAGE
diff --git a/src/soc/nvidia/tegra210/Kconfig b/src/soc/nvidia/tegra210/Kconfig index 8883baa..6750aa9 100644 --- a/src/soc/nvidia/tegra210/Kconfig +++ b/src/soc/nvidia/tegra210/Kconfig @@ -18,7 +18,7 @@ config VBOOT select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_SEPARATE_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY
config MAINBOARD_DO_DSI_INIT bool "Use dsi graphics interface" diff --git a/src/soc/qualcomm/sdm845/Kconfig b/src/soc/qualcomm/sdm845/Kconfig index c0e3294..ba06488 100644 --- a/src/soc/qualcomm/sdm845/Kconfig +++ b/src/soc/qualcomm/sdm845/Kconfig @@ -16,7 +16,7 @@ config VBOOT select VBOOT_SEPARATE_VERSTAGE select VBOOT_RETURN_FROM_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK
config SDM845_QSPI diff --git a/src/soc/rockchip/rk3288/Kconfig b/src/soc/rockchip/rk3288/Kconfig index 53666c2..38d8752 100644 --- a/src/soc/rockchip/rk3288/Kconfig +++ b/src/soc/rockchip/rk3288/Kconfig @@ -34,7 +34,7 @@ if SOC_ROCKCHIP_RK3288
config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_SEPARATE_VERSTAGE select VBOOT_RETURN_FROM_VERSTAGE diff --git a/src/soc/rockchip/rk3399/Kconfig b/src/soc/rockchip/rk3399/Kconfig index 6e45df3..83fc437 100644 --- a/src/soc/rockchip/rk3399/Kconfig +++ b/src/soc/rockchip/rk3399/Kconfig @@ -19,7 +19,7 @@ config VBOOT select VBOOT_SEPARATE_VERSTAGE select VBOOT_RETURN_FROM_VERSTAGE - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK
config PMIC_BUS