summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/include/amdblocks/BiosCallOuts.h1
-rw-r--r--src/soc/amd/common/block/pi/Kconfig8
-rw-r--r--src/soc/amd/common/block/pi/def_callouts.c2
-rw-r--r--src/soc/amd/common/block/pi/heapmanager.c33
4 files changed, 44 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/include/amdblocks/BiosCallOuts.h b/src/soc/amd/common/block/include/amdblocks/BiosCallOuts.h
index 53d565576f..97bf2082d3 100644
--- a/src/soc/amd/common/block/include/amdblocks/BiosCallOuts.h
+++ b/src/soc/amd/common/block/include/amdblocks/BiosCallOuts.h
@@ -34,6 +34,7 @@ typedef struct _BIOS_BUFFER_NODE {
} BIOS_BUFFER_NODE;
AGESA_STATUS agesa_GetTempHeapBase(UINT32 Func, UINTN Data, VOID *ConfigPtr);
+AGESA_STATUS agesa_HeapRebase(UINT32 Func, UINTN Data, VOID *ConfigPtr);
AGESA_STATUS agesa_AllocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
AGESA_STATUS agesa_DeallocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
diff --git a/src/soc/amd/common/block/pi/Kconfig b/src/soc/amd/common/block/pi/Kconfig
index 547232ef66..f0917bb767 100644
--- a/src/soc/amd/common/block/pi/Kconfig
+++ b/src/soc/amd/common/block/pi/Kconfig
@@ -7,6 +7,14 @@ config SOC_AMD_COMMON_BLOCK_PI
if SOC_AMD_COMMON_BLOCK_PI
+config PI_AGESA_CAR_HEAP_BASE
+ hex
+ default 0x400000
+ help
+ The AGESA PI blob may be built to allow an optional callout for
+ AgesaHeapRebase. If AGESA calls AgesaHeapRebase, this option
+ determines the location of the heap prior to DRAM availability.
+
config PI_AGESA_TEMP_RAM_BASE
hex
default 0x100000
diff --git a/src/soc/amd/common/block/pi/def_callouts.c b/src/soc/amd/common/block/pi/def_callouts.c
index 0adff7d8b2..54b1ede72a 100644
--- a/src/soc/amd/common/block/pi/def_callouts.c
+++ b/src/soc/amd/common/block/pi/def_callouts.c
@@ -31,6 +31,7 @@ const BIOS_CALLOUT_STRUCT BiosCallouts[] = {
{ AGESA_DO_RESET, agesa_Reset },
{ AGESA_FCH_OEM_CALLOUT, agesa_fch_initreset },
{ AGESA_HALT_THIS_AP, agesa_HaltThisAp },
+ { AGESA_HEAP_REBASE, agesa_HeapRebase },
{ AGESA_GNB_PCIE_SLOT_RESET, agesa_PcieSlotResetControl }
};
#else
@@ -46,6 +47,7 @@ const BIOS_CALLOUT_STRUCT BiosCallouts[] = {
{ AGESA_READ_SPD, agesa_ReadSpd },
{ AGESA_GNB_PCIE_SLOT_RESET, agesa_PcieSlotResetControl },
{ AGESA_GET_TEMP_HEAP_BASE, agesa_GetTempHeapBase },
+ { AGESA_HEAP_REBASE, agesa_HeapRebase },
#if ENV_RAMSTAGE
{ AGESA_RUNFUNC_ONAP, agesa_RunFuncOnAp },
{ AGESA_RUNFUNC_ON_ALL_APS, agesa_RunFcnOnAllAps },
diff --git a/src/soc/amd/common/block/pi/heapmanager.c b/src/soc/amd/common/block/pi/heapmanager.c
index 98a8ce14e2..54b0cbc0bb 100644
--- a/src/soc/amd/common/block/pi/heapmanager.c
+++ b/src/soc/amd/common/block/pi/heapmanager.c
@@ -56,6 +56,39 @@ AGESA_STATUS agesa_GetTempHeapBase(UINT32 Func, UINTN Data, VOID *ConfigPtr)
}
/*
+ * Name agesa_HeapRebase
+ * Brief description AGESA may use internal hardcoded locations for its
+ * heap. Modern implementations allow the base to be
+ * overridden by calling agesa_HeapRebase.
+ * Input parameters
+ * Func Unused
+ * Data Unused
+ * ConfigPtr Pointer to type AGESA_REBASE_PARAMS
+ * Output parameters
+ * Status Indicates whether HeapAddress was successfully
+ * set.
+ */
+AGESA_STATUS agesa_HeapRebase(UINT32 Func, UINTN Data, VOID *ConfigPtr)
+{
+ AGESA_REBASE_PARAMS *Rebase;
+
+ Rebase = (AGESA_REBASE_PARAMS *)ConfigPtr;
+ if (ENV_BOOTBLOCK) {
+ Rebase->HeapAddress = CONFIG_PI_AGESA_CAR_HEAP_BASE;
+ } else {
+ /*
+ * todo: remove the if() above and keep the assignment here
+ * once all AGESA functions are removed from bootblock.
+ */
+ Rebase->HeapAddress = (UINTN)agesa_heap_base();
+ if (!Rebase->HeapAddress)
+ Rebase->HeapAddress = CONFIG_PI_AGESA_CAR_HEAP_BASE;
+ }
+
+ return AGESA_SUCCESS;
+}
+
+/*
* Name FindAllocatedNode
* Brief description Find an allocated node that matches the handle.
* Input parameter The desired handle.