UPSTREAM: AGESA: Handle HEAP_CALLOUT_RUNTIME allocation more cleanly
This was guarded because AGESA.h only defined it starting from fam15
header files. We can simply test if it has been defined.
The way coreboot currently handles this request, is to make the
allocation outside the heap, since heap may not be in CBMEM and thus
not available runtime. The acquired buffer from Allocate() would not
be found with Locate() or Deallocate(), so move the alloc_cbmem()
call for better code symmetry.
BUG=none
BRANCH=none
TEST=none
Change-Id: Id9ce566cd144da8ebf470ace7df2cfb90ebca12d
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: bceccec0f7
Original-Change-Id: Ibf0066913a0b73e768488c3afbeb70139a3961eb
Original-Signed-off-by: Kysti Mlkki <kyosti.malkki@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/19039
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/467110
This commit is contained in:
parent
8233f7763e
commit
5d0440d718
1 changed files with 10 additions and 12 deletions
|
|
@ -66,12 +66,11 @@ void EmptyHeap(void)
|
|||
(unsigned int)(uintptr_t) base, (unsigned int)(uintptr_t) base + BIOS_HEAP_SIZE - 1);
|
||||
}
|
||||
|
||||
#if (IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_TN) || \
|
||||
IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_RL)) && !defined(__PRE_RAM__)
|
||||
#if defined(HEAP_CALLOUT_RUNTIME) && ENV_RAMSTAGE
|
||||
|
||||
#define AGESA_RUNTIME_SIZE 4096
|
||||
|
||||
static AGESA_STATUS alloc_cbmem(AGESA_BUFFER_PARAMS *AllocParams) {
|
||||
static AGESA_STATUS alloc_cbmem(AGESA_BUFFER_PARAMS *AllocParams)
|
||||
{
|
||||
static unsigned int used = 0;
|
||||
void *p = cbmem_find(CBMEM_ID_AGESA_RUNTIME);
|
||||
|
||||
|
|
@ -123,14 +122,6 @@ static AGESA_STATUS agesa_AllocateBuffer(UINT32 Func, UINT32 Data, VOID *ConfigP
|
|||
|
||||
AllocParams = ((AGESA_BUFFER_PARAMS *) ConfigPtr);
|
||||
AllocParams->BufferPointer = NULL;
|
||||
|
||||
#if (IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_TN) || \
|
||||
IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_RL)) && !defined(__PRE_RAM__)
|
||||
/* if the allocation is for runtime use simple CBMEM data */
|
||||
if (Data == HEAP_CALLOUT_RUNTIME)
|
||||
return alloc_cbmem(AllocParams);
|
||||
#endif
|
||||
|
||||
AvailableHeapSize = BIOS_HEAP_SIZE - sizeof(BIOS_HEAP_MANAGER);
|
||||
BiosHeapBaseAddr = GetHeapBase();
|
||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BiosHeapBaseAddr;
|
||||
|
|
@ -394,6 +385,13 @@ static AGESA_STATUS agesa_LocateBuffer(UINT32 Func, UINT32 Data, VOID *ConfigPtr
|
|||
|
||||
AGESA_STATUS HeapManagerCallout(UINT32 Func, UINTN Data, VOID *ConfigPtr)
|
||||
{
|
||||
#if defined(HEAP_CALLOUT_RUNTIME) && ENV_RAMSTAGE
|
||||
AGESA_BUFFER_PARAMS *AllocParams = ConfigPtr;
|
||||
|
||||
if (Func == AGESA_ALLOCATE_BUFFER && Data == HEAP_CALLOUT_RUNTIME)
|
||||
return alloc_cbmem(AllocParams);
|
||||
#endif
|
||||
|
||||
if (Func == AGESA_LOCATE_BUFFER)
|
||||
return agesa_LocateBuffer(Func, Data, ConfigPtr);
|
||||
else if (Func == AGESA_ALLOCATE_BUFFER)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue