Attention is currently required from: Hung-Te Lin, Jason Glenesk, Raul Rangel, Marshall Dawson, Christian Walter, Julius Werner, Andrey Petrov, Fred Reitberger, Yu-Ping Wu, Felix Held. Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63376 )
Change subject: [RFC] Replace some ENV_ROMSTAGE conditionals ......................................................................
[RFC] Replace some ENV_ROMSTAGE conditionals
CBMEM_INIT_HOOKS that test for ENV_ROMSTAGE typically handle initial creation of the CBMEM entry with cbmem_add(). Add intermediate ENV_STAGE_CREATES_CBMEM such that executing said CBMEM_INIT_HOOK can be moved under ENV_BOOTBLOCK.
Change-Id: I733cf4e4ab177e35cd260318556ece1e73d082dc Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/drivers/intel/fsp2_0/hand_off_block.c M src/drivers/usb/ehci_debug.c M src/drivers/vpd/vpd.c M src/include/rules.h M src/lib/cbfs.c M src/security/tpm/tspi/log.c M src/security/vboot/common.c M src/soc/amd/common/block/pm/chipset_state.c M src/soc/amd/common/pi/heapmanager.c M src/soc/intel/broadwell/pch/power_state.c M src/soc/intel/common/block/pmc/pmclib.c M src/soc/intel/quark/storage_test.c M src/soc/mediatek/common/memory.c M src/soc/qualcomm/common/qclib.c 14 files changed, 15 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/63376/1
diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index e6067da..6319520 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -101,7 +101,7 @@ uint32_t *cbmem_loc; const void *hob_list;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*cbmem_loc)); diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c index 09b3120..c3e1a4f 100644 --- a/src/drivers/usb/ehci_debug.c +++ b/src/drivers/usb/ehci_debug.c @@ -681,7 +681,7 @@ struct ehci_debug_info *dbg_info_cbmem; int rv;
- if (ENV_ROMSTAGE) { + if (ENV_STAGE_CREATES_CBMEM) { /* Move state from CAR to CBMEM. */ struct ehci_debug_info *dbg_info = dbgp_ehci_info(); dbg_info_cbmem = cbmem_add(CBMEM_ID_EHCI_DEBUG, diff --git a/src/drivers/vpd/vpd.c b/src/drivers/vpd/vpd.c index 2a9a982..0cd6db7 100644 --- a/src/drivers/vpd/vpd.c +++ b/src/drivers/vpd/vpd.c @@ -126,7 +126,7 @@ { struct vpd_cbmem *cbmem;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
timestamp_add_now(TS_COPYVPD_START); diff --git a/src/include/rules.h b/src/include/rules.h index 02b55c5..87aca60 100644 --- a/src/include/rules.h +++ b/src/include/rules.h @@ -292,6 +292,8 @@ #define ENV_INITIAL_STAGE ENV_BOOTBLOCK #endif
+#define ENV_STAGE_CREATES_CBMEM ENV_ROMSTAGE + #if ENV_X86 #define STAGE_HAS_SPINLOCKS !ENV_ROMSTAGE_OR_BEFORE #elif ENV_RISCV diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index bc38693..512f5d2 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -28,7 +28,7 @@
static void switch_to_postram_cache(int unused) { - if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
if (_preram_cbfs_cache != _postram_cbfs_cache) diff --git a/src/security/tpm/tspi/log.c b/src/security/tpm/tspi/log.c index 1696231..5112fd4 100644 --- a/src/security/tpm/tspi/log.c +++ b/src/security/tpm/tspi/log.c @@ -127,7 +127,7 @@ struct tcpa_table *ram_log = NULL; int i;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
if (CONFIG(VBOOT_RETURN_FROM_VERSTAGE)) diff --git a/src/security/vboot/common.c b/src/security/vboot/common.c index d4c8184..41a7f70 100644 --- a/src/security/vboot/common.c +++ b/src/security/vboot/common.c @@ -72,7 +72,7 @@ vb2_error_t rv; const size_t cbmem_size = VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
void *wb_cbmem = cbmem_add(CBMEM_ID_VBOOT_WORKBUF, cbmem_size); diff --git a/src/soc/amd/common/block/pm/chipset_state.c b/src/soc/amd/common/block/pm/chipset_state.c index 1251721..639e5b1 100644 --- a/src/soc/amd/common/block/pm/chipset_state.c +++ b/src/soc/amd/common/block/pm/chipset_state.c @@ -25,7 +25,7 @@ { struct chipset_power_state *state;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
state = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*state)); diff --git a/src/soc/amd/common/pi/heapmanager.c b/src/soc/amd/common/pi/heapmanager.c index 6f69fca..f662535 100644 --- a/src/soc/amd/common/pi/heapmanager.c +++ b/src/soc/amd/common/pi/heapmanager.c @@ -12,7 +12,7 @@
static void EmptyHeap(int unused) { - if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
void *BiosManagerPtr = agesa_heap_base(); diff --git a/src/soc/intel/broadwell/pch/power_state.c b/src/soc/intel/broadwell/pch/power_state.c index e283b46..a8e8a29 100644 --- a/src/soc/intel/broadwell/pch/power_state.c +++ b/src/soc/intel/broadwell/pch/power_state.c @@ -21,7 +21,7 @@ struct chipset_power_state *ps_cbmem; struct chipset_power_state *ps_car;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
ps_car = &power_state; diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index 688c830..e653db9 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -73,7 +73,7 @@ { struct chipset_power_state *ps_cbmem;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
ps_cbmem = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*ps_cbmem)); diff --git a/src/soc/intel/quark/storage_test.c b/src/soc/intel/quark/storage_test.c index 0fc2218..b23dff2 100644 --- a/src/soc/intel/quark/storage_test.c +++ b/src/soc/intel/quark/storage_test.c @@ -231,7 +231,7 @@ struct sdhci_ctrlr *sdhci_ctrlr; size_t size = sizeof(drivers_storage);
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
/* Locate the data structures in CBMEM */ diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c index 4946b53..1534b29 100644 --- a/src/soc/mediatek/common/memory.c +++ b/src/soc/mediatek/common/memory.c @@ -134,7 +134,7 @@ struct mem_chip_info *mc; size_t size;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
if (!CONFIG(USE_CBMEM_DRAM_INFO)) { diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c index ec682da..66415f1 100644 --- a/src/soc/qualcomm/common/qclib.c +++ b/src/soc/qualcomm/common/qclib.c @@ -32,7 +32,7 @@ { void *mem_region_base = NULL;
- if (!ENV_ROMSTAGE) + if (!ENV_STAGE_CREATES_CBMEM) return;
/* Add cbmem table */