AGESA fam12: Add GetHeapBase()
While amd/torpedo does not select HAVE_ACPI_RESUME, backport this from fam14. Implementation of this function is common across different families. Change-Id: I0e5099a0991a2655ec2b6990929196900e842fc1 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/5654 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
parent
e3aef13933
commit
4f998a07b5
|
@ -391,7 +391,7 @@ agesawrapper_amdinitpost (
|
||||||
AmdReleaseStruct (&AmdParamStruct);
|
AmdReleaseStruct (&AmdParamStruct);
|
||||||
|
|
||||||
/* Initialize heap space */
|
/* Initialize heap space */
|
||||||
BiosManagerPtr = (BIOS_HEAP_MANAGER *)BIOS_HEAP_START_ADDRESS;
|
BiosManagerPtr = (BIOS_HEAP_MANAGER *)GetHeapBase(&AmdParamStruct.StdHeader);
|
||||||
|
|
||||||
HeadPtr = (UINT32 *) ((UINT8 *) BiosManagerPtr + sizeof (BIOS_HEAP_MANAGER));
|
HeadPtr = (UINT32 *) ((UINT8 *) BiosManagerPtr + sizeof (BIOS_HEAP_MANAGER));
|
||||||
for (i = 0; i < ((BIOS_HEAP_SIZE/4) - (sizeof (BIOS_HEAP_MANAGER)/4)); i++)
|
for (i = 0; i < ((BIOS_HEAP_SIZE/4) - (sizeof (BIOS_HEAP_MANAGER)/4)); i++)
|
||||||
|
|
|
@ -25,7 +25,23 @@
|
||||||
#include "OptionsIds.h"
|
#include "OptionsIds.h"
|
||||||
#include "heapManager.h"
|
#include "heapManager.h"
|
||||||
#include "Hudson-2.h"
|
#include "Hudson-2.h"
|
||||||
|
#include <cbmem.h>
|
||||||
|
#include <arch/acpi.h>
|
||||||
|
|
||||||
|
UINT32 GetHeapBase(AMD_CONFIG_PARAMS *StdHeader)
|
||||||
|
{
|
||||||
|
UINT32 heap = BIOS_HEAP_START_ADDRESS;
|
||||||
|
|
||||||
|
#if CONFIG_HAVE_ACPI_RESUME
|
||||||
|
/* Both romstage and ramstage has this S3 detect. */
|
||||||
|
if (acpi_get_sleep_type() == 3)
|
||||||
|
heap = (UINT32) cbmem_find(CBMEM_ID_RESUME_SCRATCH) +
|
||||||
|
(CONFIG_HIGH_SCRATCH_MEMORY_SIZE - BIOS_HEAP_SIZE);
|
||||||
|
/* himem_heap_base + high_stack_size */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return heap;
|
||||||
|
}
|
||||||
|
|
||||||
AGESA_STATUS BiosAllocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
AGESA_STATUS BiosAllocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
||||||
{
|
{
|
||||||
|
@ -49,8 +65,8 @@ AGESA_STATUS BiosAllocateBuffer (UINT32 Func, UINT32 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 *) BIOS_HEAP_START_ADDRESS;
|
BiosHeapBaseAddr = (UINT8 *) GetHeapBase(&(AllocParams->StdHeader));
|
||||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BIOS_HEAP_START_ADDRESS;
|
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BiosHeapBaseAddr;
|
||||||
|
|
||||||
if (BiosHeapBasePtr->StartOfAllocatedNodes == 0) {
|
if (BiosHeapBasePtr->StartOfAllocatedNodes == 0) {
|
||||||
/* First allocation */
|
/* First allocation */
|
||||||
|
@ -172,11 +188,11 @@ AGESA_STATUS BiosDeallocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
||||||
BIOS_HEAP_MANAGER *BiosHeapBasePtr;
|
BIOS_HEAP_MANAGER *BiosHeapBasePtr;
|
||||||
AGESA_BUFFER_PARAMS *AllocParams;
|
AGESA_BUFFER_PARAMS *AllocParams;
|
||||||
|
|
||||||
BiosHeapBaseAddr = (UINT8 *) BIOS_HEAP_START_ADDRESS;
|
|
||||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BIOS_HEAP_START_ADDRESS;
|
|
||||||
|
|
||||||
AllocParams = (AGESA_BUFFER_PARAMS *) ConfigPtr;
|
AllocParams = (AGESA_BUFFER_PARAMS *) ConfigPtr;
|
||||||
|
|
||||||
|
BiosHeapBaseAddr = (UINT8 *) GetHeapBase(&(AllocParams->StdHeader));
|
||||||
|
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.
|
||||||
Return AGESA_BOUNDS_CHK if the BufferHandle is not found
|
Return AGESA_BOUNDS_CHK if the BufferHandle is not found
|
||||||
*/
|
*/
|
||||||
|
@ -285,8 +301,8 @@ AGESA_STATUS BiosLocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
|
||||||
|
|
||||||
AllocParams = (AGESA_BUFFER_PARAMS *) ConfigPtr;
|
AllocParams = (AGESA_BUFFER_PARAMS *) ConfigPtr;
|
||||||
|
|
||||||
BiosHeapBaseAddr = (UINT8 *) BIOS_HEAP_START_ADDRESS;
|
BiosHeapBaseAddr = (UINT8 *) GetHeapBase(&(AllocParams->StdHeader));
|
||||||
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BIOS_HEAP_START_ADDRESS;
|
BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BiosHeapBaseAddr;
|
||||||
|
|
||||||
AllocNodeOffset = BiosHeapBasePtr->StartOfAllocatedNodes;
|
AllocNodeOffset = BiosHeapBasePtr->StartOfAllocatedNodes;
|
||||||
AllocNodePtr = (BIOS_BUFFER_NODE *) (BiosHeapBaseAddr + AllocNodeOffset);
|
AllocNodePtr = (BIOS_BUFFER_NODE *) (BiosHeapBaseAddr + AllocNodeOffset);
|
||||||
|
|
|
@ -38,6 +38,8 @@ typedef struct _BIOS_BUFFER_NODE {
|
||||||
UINT32 NextNodeOffset;
|
UINT32 NextNodeOffset;
|
||||||
} BIOS_BUFFER_NODE;
|
} BIOS_BUFFER_NODE;
|
||||||
|
|
||||||
|
UINT32 GetHeapBase(AMD_CONFIG_PARAMS *StdHeader);
|
||||||
|
|
||||||
/* REQUIRED CALLOUTS
|
/* REQUIRED CALLOUTS
|
||||||
* AGESA ADVANCED CALLOUTS - CPU
|
* AGESA ADVANCED CALLOUTS - CPU
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue