diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2015-01-02 22:46:32 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2015-03-07 21:22:44 +0100 |
commit | 82fbda76c94e8405246c7d4ae6c73fde8b8f99cb (patch) | |
tree | 21506118bd25028865305d5b069915a4673f080b /src/cpu/amd/agesa | |
parent | 0127c6c80865384faa43602bf22b3a70147343d9 (diff) |
AGESA: Use same HeapManager for all BiosCallOuts
We do not allow platforms to mess around with memory layout.
Change-Id: I316ff522c8833fa3b7ad20f2c5a9cae21f4174d8
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/8604
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/cpu/amd/agesa')
-rw-r--r-- | src/cpu/amd/agesa/heapmanager.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/cpu/amd/agesa/heapmanager.c b/src/cpu/amd/agesa/heapmanager.c index f1333afc2e..bfe8b2962d 100644 --- a/src/cpu/amd/agesa/heapmanager.c +++ b/src/cpu/amd/agesa/heapmanager.c @@ -52,7 +52,18 @@ static AGESA_STATUS alloc_cbmem(AGESA_BUFFER_PARAMS *AllocParams) { } #endif -AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr) +typedef struct _BIOS_HEAP_MANAGER { + UINT32 StartOfAllocatedNodes; + UINT32 StartOfFreedNodes; +} BIOS_HEAP_MANAGER; + +typedef struct _BIOS_BUFFER_NODE { + UINT32 BufferHandle; + UINT32 BufferSize; + UINT32 NextNodeOffset; +} BIOS_BUFFER_NODE; + +static AGESA_STATUS agesa_AllocateBuffer(UINT32 Func, UINT32 Data, VOID *ConfigPtr) { UINT32 AvailableHeapSize; UINT8 *BiosHeapBaseAddr; @@ -188,7 +199,7 @@ AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr) return AGESA_SUCCESS; } -AGESA_STATUS agesa_DeallocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr) +static AGESA_STATUS agesa_DeallocateBuffer(UINT32 Func, UINT32 Data, VOID *ConfigPtr) { UINT8 *BiosHeapBaseAddr; @@ -307,7 +318,7 @@ AGESA_STATUS agesa_DeallocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr) return AGESA_SUCCESS; } -AGESA_STATUS agesa_LocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr) +static AGESA_STATUS agesa_LocateBuffer(UINT32 Func, UINT32 Data, VOID *ConfigPtr) { UINT32 AllocNodeOffset; UINT8 *BiosHeapBaseAddr; @@ -340,3 +351,15 @@ AGESA_STATUS agesa_LocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr) return AGESA_SUCCESS; } + +AGESA_STATUS HeapManagerCallout(UINT32 Func, UINT32 Data, VOID *ConfigPtr) +{ + if (Func == AGESA_LOCATE_BUFFER) + return agesa_LocateBuffer(Func, Data, ConfigPtr); + else if (Func == AGESA_ALLOCATE_BUFFER) + return agesa_AllocateBuffer(Func, Data, ConfigPtr); + else if (Func == AGESA_DEALLOCATE_BUFFER) + return agesa_DeallocateBuffer(Func, Data, ConfigPtr); + else + return AGESA_UNSUPPORTED; +} |