Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63518 )
Change subject: soc/intel/common/{sa, adl}: Add `finalize` operation for systemagent ......................................................................
soc/intel/common/{sa, adl}: Add `finalize` operation for systemagent
This patch implements the required operations to perform prior to booting to OS using coreboot native driver when platform decides to skip FSP notify APIs i.e. End Of Firmware.
The system agent `.final` operation ensures locking the PAM register hence, skip dedicated calling into `sa_lock_pam()` from the SoC `finalize.c` file when coreboot decides to skip FspNotifyApi() calls.
BUG=b:211954778 TEST=Able to build google/brya with these changes and coreboot log with this code change as below with ADL SoC skip calling into FspNotifyAPIs:
[INFO ] Finalize devices... [DEBUG] PCI: 00:00.0 final
localhost ~ # lspci -xxx | less
00:00.0 Host bridge: Device 8086:4601 (rev 04)
Bit 0 for all PAM registers a.k.a, PAMx_0_0_0_PCI.LOCK bit is set (meaning locked).
Signed-off-by: Subrata Banik subratabanik@google.com Change-Id: Ibd464d2507393ed0c746eb1fbd10e36092ed5599 --- M src/soc/intel/alderlake/finalize.c M src/soc/intel/common/block/systemagent/systemagent.c 2 files changed, 40 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/63518/1
diff --git a/src/soc/intel/alderlake/finalize.c b/src/soc/intel/alderlake/finalize.c index 7498f3f..b118591 100644 --- a/src/soc/intel/alderlake/finalize.c +++ b/src/soc/intel/alderlake/finalize.c @@ -94,10 +94,11 @@ pch_finalize(); apm_control(APM_CNT_FINALIZE); tbt_finalize(); - sa_finalize(); if (CONFIG(USE_FSP_NOTIFY_PHASE_READY_TO_BOOT) && - CONFIG(USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE)) + CONFIG(USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE)) { + sa_finalize(); heci_finalize(); + }
/* Indicate finalize step with post code */ post_code(POST_OS_BOOT); diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c index 07bcb0c..f495a58 100644 --- a/src/soc/intel/common/block/systemagent/systemagent.c +++ b/src/soc/intel/common/block/systemagent/systemagent.c @@ -315,6 +315,42 @@ pci_or_config8(dev, PAM0, PAM_LOCK); }
+/* + * `sa_final_end_of_firmware` function is native implementation of equivalent events + * performed by FSP NotifyPhase(End of Firmware) API invocations. + * + * Operations are: + * 1. Lock PAM registers. + */ +static void sa_final_end_of_firmware(void) +{ + sa_lock_pam(); +} + +struct sa_notify_phase_data { + bool skip; + void (*notify_func)(void); +}; + +static const struct sa_notify_phase_data notify_data[] = { + { + .skip = CONFIG(USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE), + .notify_func = sa_final_end_of_firmware, + }, +}; + +/* + * `systemagent_final` function is native implementation of equivalent events + * performed by each FSP NotifyPhase() API invocations. + */ +static void systemagent_final(struct device *dev) +{ + for (size_t i = 0; i < ARRAY_SIZE(notify_data); i++) { + if (!notify_data[i].skip) + notify_data[i].notify_func(); + } +} + static struct device_operations systemagent_ops = { .read_resources = systemagent_read_resources, .set_resources = pci_dev_set_resources, @@ -324,6 +360,7 @@ #if CONFIG(HAVE_ACPI_TABLES) .write_acpi_tables = sa_write_acpi_tables, #endif + .final = systemagent_final, };
static const unsigned short systemagent_ids[] = {