[coreboot-gerrit] Change in coreboot[master]: soc/amd/stoneyridge: Add RunOnAP support

Marc Jones (Code Review) gerrit at coreboot.org
Fri Oct 27 00:56:21 CEST 2017


Marc Jones has uploaded this change for review. ( https://review.coreboot.org/22194


Change subject: soc/amd/stoneyridge: Add RunOnAP support
......................................................................

soc/amd/stoneyridge: Add RunOnAP support

Add support for AGESA callbacks RunFcnOnAp() and RunFcnOnAllAp().
Update the wording on the AP errors. The functions are not missing,
they are not supported.

Change-Id: Id30cb2e0c6cc474158f3a7710dbb8ecf54f1ffe4
Signed-off-by: Marc Jones <marcj303 at gmail.com>
---
M src/soc/amd/common/def_callouts.c
M src/soc/amd/stoneyridge/Kconfig
2 files changed, 77 insertions(+), 19 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/22194/1

diff --git a/src/soc/amd/common/def_callouts.c b/src/soc/amd/common/def_callouts.c
index 7a6afeb..aca3d8a 100644
--- a/src/soc/amd/common/def_callouts.c
+++ b/src/soc/amd/common/def_callouts.c
@@ -15,11 +15,15 @@
  */
 
 #include <cbfs.h>
+#include <cpu/x86/lapic.h>
+#include <cpu/x86/mp.h>
+#include <timer.h>
 
 #include <AGESA.h>
 #include <amdlib.h>
 #include <Ids.h>
 #include <agesawrapper.h>
+#include <agesawrapper_call.h>
 #include <BiosCallOuts.h>
 #include <soc/southbridge.h>
 
@@ -37,11 +41,13 @@
 	{ AGESA_DO_RESET,                 agesa_Reset },
 	{ AGESA_LOCATE_BUFFER,            agesa_LocateBuffer },
 	{ AGESA_READ_SPD,                 agesa_ReadSpd },
+	{ AGESA_GNB_PCIE_SLOT_RESET,      agesa_PcieSlotResetControl },
+#if ENV_RAMSTAGE
 	{ AGESA_RUNFUNC_ONAP,             agesa_RunFuncOnAp },
 	{ AGESA_RUNFUNC_ON_ALL_APS,       agesa_RunFcnOnAllAps },
-	{ AGESA_GNB_PCIE_SLOT_RESET,      agesa_PcieSlotResetControl },
 	{ AGESA_WAIT_FOR_ALL_APS,         agesa_WaitForAllApsFinished },
 	{ AGESA_IDLE_AN_AP,               agesa_IdleAnAp },
+#endif /* ENV_RAMSTAGE */
 
 	/* Optional callouts */
 	{ AGESA_GET_IDS_INIT_DATA,             agesa_EmptyIdsInitData },
@@ -132,14 +138,6 @@
 	return Status;
 }
 
-AGESA_STATUS agesa_RunFuncOnAp(UINT32 Func, UINTN Data, VOID *ConfigPtr)
-{
-	AGESA_STATUS Status;
-
-	Status = agesawrapper_amdlaterunaptask(Func, Data, ConfigPtr);
-	return Status;
-}
-
 AGESA_STATUS agesa_GfxGetVbiosImage(UINT32 Func, UINTN FchData,
 							VOID *ConfigPrt)
 {
@@ -152,14 +150,6 @@
 	printk(BIOS_DEBUG, "agesa_GfxGetVbiosImage: IMGptr=%p\n",
 						pVbiosImageInfo->ImagePtr);
 	return pVbiosImageInfo->ImagePtr ? AGESA_SUCCESS : AGESA_WARNING;
-}
-
-AGESA_STATUS agesa_RunFcnOnAllAps(UINT32 Func, UINTN Data, VOID *ConfigPtr)
-{
-	printk(BIOS_WARNING, "Warning - Missing AGESA callout: %s\n", __func__);
-	AGESA_STATUS Status = AGESA_UNSUPPORTED;
-
-	return Status;
 }
 
 void __attribute__((weak)) platform_PcieSlotResetControl(UINT32 Func, UINTN Data,
@@ -175,10 +165,76 @@
 	platform_PcieSlotResetControl(Func, Data, ConfigPtr)
 }
 
+#if ENV_RAMSTAGE
+/*
+ * Application Processor callouts:
+ * agesa_RunFuncOnAp() and agesa_RunFcnOnAllAps() are called after main memory
+ * has been initialized and coreboot has taken control of AP task dispatching.
+ * These functions execute callout_ap_entry() on each AP, which calls the
+ * AmdLateRunApTask() entry point if it is a targeted AP.
+ */
+
+/*
+ * Global data for APs.
+ * Passed from the AGESA_Callout for the agesawrapper_amdlaterunaptask.
+ */
+static struct agesa_data {
+	UINT32 Func;
+	UINTN Data;
+	VOID *ConfigPtr;
+}agesadata;
+
+/*
+ * BSP deploys APs to callout_ap_entry(), which calls agesawrapper_amdlaterunaptask
+ * with the agesadata.
+ */
+static void callout_ap_entry(void) {
+	AGESA_STATUS Status = AGESA_UNSUPPORTED;
+
+	printk(BIOS_DEBUG, "%s Func: 0x%x,  Data: 0x%lx, Ptr: 0x%p \n",
+		__func__, agesadata.Func, agesadata.Data, agesadata.ConfigPtr);
+
+	/* Check if this AP should run the function */
+	if (!((agesadata.Func == AGESA_RUNFUNC_ONAP) &&
+	    (agesadata.Data == lapicid())))
+		return;
+
+	Status = agesawrapper_amdlaterunaptask(agesadata.Func, agesadata.Data,
+			agesadata.ConfigPtr);
+
+	if (Status)
+		printk(BIOS_DEBUG, "There was a problem with %lx returned %s\n",
+			lapicid(), decodeAGESA_STATUS(Status));
+}
+
+AGESA_STATUS agesa_RunFuncOnAp(UINT32 Func, UINTN Data, VOID *ConfigPtr)
+{
+	printk(BIOS_DEBUG, "%s\n", __func__);
+
+	agesadata.Func = Func;
+	agesadata.Data = Data;
+	agesadata.ConfigPtr = ConfigPtr;
+	mp_run_on_aps(callout_ap_entry, 100 * USECS_PER_MSEC);
+
+	return AGESA_SUCCESS;
+}
+
+AGESA_STATUS agesa_RunFcnOnAllAps(UINT32 Func, UINTN Data, VOID *ConfigPtr)
+{
+	printk(BIOS_DEBUG, "%s\n", __func__);
+
+	agesadata.Func = Func;
+	agesadata.Data = Data;
+	agesadata.ConfigPtr = ConfigPtr;
+	mp_run_on_aps(callout_ap_entry, 100 * USECS_PER_MSEC);
+
+	return AGESA_SUCCESS;
+}
+
 AGESA_STATUS agesa_WaitForAllApsFinished(UINT32 Func, UINTN Data,
 	VOID *ConfigPtr)
 {
-	printk(BIOS_WARNING, "Warning - Missing AGESA callout: %s\n", __func__);
+	printk(BIOS_WARNING, "Warning - AGESA callout: %s not supported\n", __func__);
 	AGESA_STATUS Status = AGESA_UNSUPPORTED;
 
 	return Status;
@@ -186,8 +242,9 @@
 
 AGESA_STATUS agesa_IdleAnAp(UINT32 Func, UINTN Data, VOID *ConfigPtr)
 {
-	printk(BIOS_WARNING, "Warning - Missing AGESA callout: %s\n", __func__);
+	printk(BIOS_WARNING, "Warning - AGESA callout: %s no supported\n", __func__);
 	AGESA_STATUS Status = AGESA_UNSUPPORTED;
 
 	return Status;
 }
+#endif /* ENV_RAMSTAGE */
diff --git a/src/soc/amd/stoneyridge/Kconfig b/src/soc/amd/stoneyridge/Kconfig
index 30da8a0..ff8d3b6 100644
--- a/src/soc/amd/stoneyridge/Kconfig
+++ b/src/soc/amd/stoneyridge/Kconfig
@@ -51,6 +51,7 @@
 	select BOOTBLOCK_CONSOLE
 	select RELOCATABLE_MODULES
 	select PARALLEL_MP
+	select PARALLEL_MP_AP_WORK
 	select HAVE_SMI_HANDLER
 	select SMM_TSEG
 	select RELOCATABLE_RAMSTAGE

-- 
To view, visit https://review.coreboot.org/22194
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id30cb2e0c6cc474158f3a7710dbb8ecf54f1ffe4
Gerrit-Change-Number: 22194
Gerrit-PatchSet: 1
Gerrit-Owner: Marc Jones <marc at marcjonesconsulting.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171026/e7bc89c3/attachment-0001.html>


More information about the coreboot-gerrit mailing list