amd/stoneyridge: Put AGESA heap into cbmem
Now that soc/amd supports EARLY_CBMEM_INIT, put the HEAP into cbmem, allowing better control of its cacheability in subsequent patches. This relocates the heap initialization from the common directory into a romstage cbmem hook. The conversion relies on cbmem_add() first searching cbmem for the ID before adding a new entry. Change-Id: I9ff35eefb2a68879ff44c6e29f58635831b19848 Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/21594 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
parent
ed501d5b3f
commit
6c74706856
|
@ -35,8 +35,6 @@ typedef struct _BIOS_BUFFER_NODE {
|
||||||
UINT32 NextNodeOffset;
|
UINT32 NextNodeOffset;
|
||||||
} BIOS_BUFFER_NODE;
|
} BIOS_BUFFER_NODE;
|
||||||
|
|
||||||
void EmptyHeap(void);
|
|
||||||
|
|
||||||
AGESA_STATUS agesa_AllocateBuffer(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);
|
AGESA_STATUS agesa_DeallocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
|
||||||
AGESA_STATUS agesa_LocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
|
AGESA_STATUS agesa_LocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
|
||||||
|
|
|
@ -173,8 +173,6 @@ AGESA_STATUS agesawrapper_amdinitpost(void)
|
||||||
|
|
||||||
if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(PostParams->StdHeader.HeapStatus);
|
if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(PostParams->StdHeader.HeapStatus);
|
||||||
AmdReleaseStruct (&AmdParamStruct);
|
AmdReleaseStruct (&AmdParamStruct);
|
||||||
/* Initialize heap space */
|
|
||||||
EmptyHeap();
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,20 +22,20 @@
|
||||||
|
|
||||||
static void *GetHeapBase(void)
|
static void *GetHeapBase(void)
|
||||||
{
|
{
|
||||||
void *heap = (void *)BIOS_HEAP_START_ADDRESS;
|
return cbmem_add(CBMEM_ID_RESUME_SCRATCH, BIOS_HEAP_SIZE);
|
||||||
|
|
||||||
if (acpi_is_wakeup_s3())
|
|
||||||
heap = cbmem_find(CBMEM_ID_RESUME_SCRATCH);
|
|
||||||
|
|
||||||
return heap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyHeap(void)
|
static void EmptyHeap(int unused)
|
||||||
{
|
{
|
||||||
void *BiosManagerPtr = GetHeapBase();
|
void *BiosManagerPtr = GetHeapBase();
|
||||||
memset(BiosManagerPtr, 0, BIOS_HEAP_SIZE);
|
memset(BiosManagerPtr, 0, BIOS_HEAP_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_LATE_CBMEM_INIT)
|
||||||
|
#error "Only EARLY_CBMEM_INIT is supported."
|
||||||
|
#endif
|
||||||
|
ROMSTAGE_CBMEM_INIT_HOOK(EmptyHeap)
|
||||||
|
|
||||||
AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
||||||
{
|
{
|
||||||
UINT32 AvailableHeapSize;
|
UINT32 AvailableHeapSize;
|
||||||
|
|
Loading…
Reference in New Issue