soc/amd/common: Clean up GetHeapBase function
Make GetHeapBase a static function. Change the type of return value to a void pointer and remove the unused StdHeader argument. This should be innocuous and will allow a subsequent patch to be simpler. Change-Id: Id4a024d000a514ea9a44f9dfc2caffae9ff01789 Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/21593 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
f82aa10d56
commit
ed501d5b3f
|
@ -35,7 +35,6 @@ typedef struct _BIOS_BUFFER_NODE {
|
||||||
UINT32 NextNodeOffset;
|
UINT32 NextNodeOffset;
|
||||||
} BIOS_BUFFER_NODE;
|
} BIOS_BUFFER_NODE;
|
||||||
|
|
||||||
UINT32 GetHeapBase(AMD_CONFIG_PARAMS *StdHeader);
|
|
||||||
void EmptyHeap(void);
|
void EmptyHeap(void);
|
||||||
|
|
||||||
AGESA_STATUS agesa_AllocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
|
AGESA_STATUS agesa_AllocateBuffer(UINT32 Func, UINTN Data, VOID *ConfigPtr);
|
||||||
|
|
|
@ -20,19 +20,19 @@
|
||||||
#include <heapManager.h>
|
#include <heapManager.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
UINT32 GetHeapBase(AMD_CONFIG_PARAMS *StdHeader)
|
static void *GetHeapBase(void)
|
||||||
{
|
{
|
||||||
UINT32 heap = BIOS_HEAP_START_ADDRESS;
|
void *heap = (void *)BIOS_HEAP_START_ADDRESS;
|
||||||
|
|
||||||
if (acpi_is_wakeup_s3())
|
if (acpi_is_wakeup_s3())
|
||||||
heap = (UINT32)cbmem_find(CBMEM_ID_RESUME_SCRATCH);
|
heap = cbmem_find(CBMEM_ID_RESUME_SCRATCH);
|
||||||
|
|
||||||
return heap;
|
return heap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmptyHeap(void)
|
void EmptyHeap(void)
|
||||||
{
|
{
|
||||||
void *BiosManagerPtr = (void *)GetHeapBase(NULL);
|
void *BiosManagerPtr = GetHeapBase();
|
||||||
memset(BiosManagerPtr, 0, BIOS_HEAP_SIZE);
|
memset(BiosManagerPtr, 0, BIOS_HEAP_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
||||||
AllocParams->BufferPointer = NULL;
|
AllocParams->BufferPointer = NULL;
|
||||||
|
|
||||||
AvailableHeapSize = BIOS_HEAP_SIZE - sizeof(BIOS_HEAP_MANAGER);
|
AvailableHeapSize = BIOS_HEAP_SIZE - sizeof(BIOS_HEAP_MANAGER);
|
||||||
BiosHeapBaseAddr = (UINT8 *)GetHeapBase(&(AllocParams->StdHeader));
|
BiosHeapBaseAddr = GetHeapBase();
|
||||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *)BiosHeapBaseAddr;
|
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *)BiosHeapBaseAddr;
|
||||||
|
|
||||||
if (BiosHeapBasePtr->StartOfAllocatedNodes == 0) {
|
if (BiosHeapBasePtr->StartOfAllocatedNodes == 0) {
|
||||||
|
@ -215,7 +215,7 @@ AGESA_STATUS agesa_DeallocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
||||||
|
|
||||||
AllocParams = (AGESA_BUFFER_PARAMS *)ConfigPtr;
|
AllocParams = (AGESA_BUFFER_PARAMS *)ConfigPtr;
|
||||||
|
|
||||||
BiosHeapBaseAddr = (UINT8 *)GetHeapBase(&(AllocParams->StdHeader));
|
BiosHeapBaseAddr = GetHeapBase();
|
||||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *)BiosHeapBaseAddr;
|
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *)BiosHeapBaseAddr;
|
||||||
|
|
||||||
/* Find target node to deallocate in list of allocated nodes.
|
/* Find target node to deallocate in list of allocated nodes.
|
||||||
|
@ -338,7 +338,7 @@ AGESA_STATUS agesa_LocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
||||||
|
|
||||||
AllocParams = (AGESA_BUFFER_PARAMS *)ConfigPtr;
|
AllocParams = (AGESA_BUFFER_PARAMS *)ConfigPtr;
|
||||||
|
|
||||||
BiosHeapBaseAddr = (UINT8 *)GetHeapBase(&(AllocParams->StdHeader));
|
BiosHeapBaseAddr = GetHeapBase();
|
||||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *)BiosHeapBaseAddr;
|
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *)BiosHeapBaseAddr;
|
||||||
|
|
||||||
AllocNodeOffset = BiosHeapBasePtr->StartOfAllocatedNodes;
|
AllocNodeOffset = BiosHeapBasePtr->StartOfAllocatedNodes;
|
||||||
|
|
Loading…
Reference in New Issue