diff options
author | Joel Kitching <kitching@google.com> | 2019-04-10 16:06:21 +0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2019-04-30 21:47:25 +0000 |
commit | 6672bd8e6b808300a98be0ce308a2bfe5b4685d6 (patch) | |
tree | 9bd6699009566d63dc7bf4417b7ab6e23436f3d2 /src | |
parent | 2b8789bb3bf186b64ead7a92c341eb70ed57bbcf (diff) |
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 |flags| field to vboot_working_data struct
* Create VBOOT_FLAG_DISPLAY_REQUESTED and set in vboot_handoff
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32262
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/bootmode.c | 10 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/Kconfig | 2 | ||||
-rw-r--r-- | src/security/vboot/Kconfig | 8 | ||||
-rw-r--r-- | src/security/vboot/misc.h | 11 | ||||
-rw-r--r-- | src/security/vboot/vboot_common.c | 5 | ||||
-rw-r--r-- | src/security/vboot/vboot_common.h | 1 | ||||
-rw-r--r-- | src/security/vboot/vboot_handoff.c | 23 | ||||
-rw-r--r-- | src/soc/intel/apollolake/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/intel/baytrail/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/intel/braswell/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/intel/broadwell/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/intel/cannonlake/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/intel/icelake/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/intel/skylake/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/mediatek/mt8173/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/mediatek/mt8183/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/nvidia/tegra124/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/nvidia/tegra210/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/qualcomm/sdm845/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/rockchip/rk3288/Kconfig | 2 | ||||
-rw-r--r-- | src/soc/rockchip/rk3399/Kconfig | 2 |
21 files changed, 42 insertions, 46 deletions
diff --git a/src/lib/bootmode.c b/src/lib/bootmode.c index 052eb8f282..18f6d5dcac 100644 --- a/src/lib/bootmode.c +++ b/src/lib/bootmode.c @@ -35,12 +35,14 @@ void gfx_set_init_done(int done) int display_init_required(void) { - /* For vboot always honor vboot_handoff_skip_display_init(). */ + /* For vboot, always honor VBOOT_WD_FLAG_DISPLAY_INIT. */ 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_handoff_skip_display_init(); + return vboot_get_working_data()->flags + & VBOOT_WD_FLAG_DISPLAY_INIT; } /* By default always initialize display. */ diff --git a/src/northbridge/intel/haswell/Kconfig b/src/northbridge/intel/haswell/Kconfig index 49466bc569..8c1e0b18f7 100644 --- a/src/northbridge/intel/haswell/Kconfig +++ b/src/northbridge/intel/haswell/Kconfig @@ -44,7 +44,7 @@ config HASWELL_VBOOT_IN_BOOTBLOCK and back to the RW region after the binary is done. config VBOOT - select VBOOT_OPROM_MATTERS + select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_ROMSTAGE if !HASWELL_VBOOT_IN_BOOTBLOCK config VGA_BIOS_ID diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig index 4815cb10f9..66bcc1ed6f 100644 --- a/src/security/vboot/Kconfig +++ b/src/security/vboot/Kconfig @@ -169,17 +169,15 @@ config VBOOT_SAVE_RECOVERY_REASON_ON_REBOOT 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/misc.h b/src/security/vboot/misc.h index 27317ad32d..b4fae19d74 100644 --- a/src/security/vboot/misc.h +++ b/src/security/vboot/misc.h @@ -34,12 +34,19 @@ struct selected_region { */ struct vboot_working_data { struct selected_region selected_region; + uint32_t flags; /* offset of the buffer from the start of this struct */ - uint32_t buffer_offset; - uint32_t buffer_size; + uint16_t buffer_offset; + uint16_t buffer_size; }; /* + * Definitions for vboot_working_data.flags values. + */ +/* vboot requests display initialization from coreboot. */ +#define VBOOT_WD_FLAG_DISPLAY_INIT (1 << 0) + +/* * Source: security/vboot/common.c */ struct vboot_working_data * const vboot_get_working_data(void); diff --git a/src/security/vboot/vboot_common.c b/src/security/vboot/vboot_common.c index 5e95c6215c..3dddc76556 100644 --- a/src/security/vboot/vboot_common.c +++ b/src/security/vboot/vboot_common.c @@ -88,11 +88,6 @@ static int vboot_get_handoff_flag(uint32_t flag) 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 8c92437a3c..768b29d4fc 100644 --- a/src/security/vboot/vboot_common.h +++ b/src/security/vboot/vboot_common.h @@ -60,7 +60,6 @@ int vboot_get_handoff_info(void **addr, uint32_t *size); * 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 ff938e15ce..178877d847 100644 --- a/src/security/vboot/vboot_handoff.c +++ b/src/security/vboot/vboot_handoff.c @@ -61,30 +61,25 @@ static void fill_vboot_handoff(struct vboot_handoff *vboot_handoff, 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)) { - 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; - } + /* 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_get_working_data()->flags |= VBOOT_WD_FLAG_DISPLAY_INIT; + 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; /* In vboot1, VBSD_FWB_TRIED is * set only if B is booted as explicitly requested. Therefore, if B is diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig index 98fdb022e8..217d1eab24 100644 --- a/src/soc/intel/apollolake/Kconfig +++ b/src/soc/intel/apollolake/Kconfig @@ -119,7 +119,7 @@ config CHROMEOS 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 a83a7e9ee6..03ad31d41f 100644 --- a/src/soc/intel/baytrail/Kconfig +++ b/src/soc/intel/baytrail/Kconfig @@ -43,7 +43,7 @@ config CPU_SPECIFIC_OPTIONS 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 8db47955a6..a0c07084b8 100644 --- a/src/soc/intel/braswell/Kconfig +++ b/src/soc/intel/braswell/Kconfig @@ -53,7 +53,7 @@ config CPU_SPECIFIC_OPTIONS 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 25984f14e2..83ccf7b9d8 100644 --- a/src/soc/intel/broadwell/Kconfig +++ b/src/soc/intel/broadwell/Kconfig @@ -66,7 +66,7 @@ config PCIEXP_L1_SUB_STATE 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 b730b7a26f..6759b7ff99 100644 --- a/src/soc/intel/cannonlake/Kconfig +++ b/src/soc/intel/cannonlake/Kconfig @@ -231,7 +231,7 @@ config CHROMEOS 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 2e9e3e251f..2fbc6da15f 100644 --- a/src/soc/intel/icelake/Kconfig +++ b/src/soc/intel/icelake/Kconfig @@ -151,7 +151,7 @@ config CHROMEOS 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 5116f3ab25..fcfe2b6591 100644 --- a/src/soc/intel/skylake/Kconfig +++ b/src/soc/intel/skylake/Kconfig @@ -106,7 +106,7 @@ config CHROMEOS 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 b0d6fa0fad..e966b8e58b 100644 --- a/src/soc/mediatek/mt8173/Kconfig +++ b/src/soc/mediatek/mt8173/Kconfig @@ -16,7 +16,7 @@ config SOC_MEDIATEK_MT8173 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 6582e4e43c..f96282cf62 100644 --- a/src/soc/mediatek/mt8183/Kconfig +++ b/src/soc/mediatek/mt8183/Kconfig @@ -14,7 +14,7 @@ config SOC_MEDIATEK_MT8183 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 eecb59b027..475d50e210 100644 --- a/src/soc/nvidia/tegra124/Kconfig +++ b/src/soc/nvidia/tegra124/Kconfig @@ -18,7 +18,7 @@ config SOC_NVIDIA_TEGRA124 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 8883baa358..6750aa9f9a 100644 --- a/src/soc/nvidia/tegra210/Kconfig +++ b/src/soc/nvidia/tegra210/Kconfig @@ -18,7 +18,7 @@ if SOC_NVIDIA_TEGRA210 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 c0e3294e39..ba064889f0 100644 --- a/src/soc/qualcomm/sdm845/Kconfig +++ b/src/soc/qualcomm/sdm845/Kconfig @@ -16,7 +16,7 @@ if SOC_QUALCOMM_SDM845 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 53666c28f3..38d87524b7 100644 --- a/src/soc/rockchip/rk3288/Kconfig +++ b/src/soc/rockchip/rk3288/Kconfig @@ -34,7 +34,7 @@ config SOC_ROCKCHIP_RK3288 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 fb95499efb..897a5979d4 100644 --- a/src/soc/rockchip/rk3399/Kconfig +++ b/src/soc/rockchip/rk3399/Kconfig @@ -20,7 +20,7 @@ config VBOOT select VBOOT_MIGRATE_WORKING_DATA 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 |