本文整理汇总了C++中HeapAllocateBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ HeapAllocateBuffer函数的具体用法?C++ HeapAllocateBuffer怎么用?C++ HeapAllocateBuffer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HeapAllocateBuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AmdInitPostInitializer
/*
*---------------------------------------------------------------------------------------
*
* AmdInitPostInitializer
*
* Initializer routine that will be invoked by the wrapper
* to initialize the input structure for the AmdInitPost
*
* @param[in, out] IN OUT AMD_POST_PARAMS *PostParamsPtr
*
* @retval AGESA_STATUS
*
*---------------------------------------------------------------------------------------
*/
AGESA_STATUS
AmdInitPostInitializer (
IN AMD_CONFIG_PARAMS *StdHeader,
IN OUT AMD_POST_PARAMS *PostParamsPtr
)
{
AGESA_STATUS AgesaStatus;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
ASSERT (StdHeader != NULL);
ASSERT (PostParamsPtr != NULL);
PostParamsPtr->StdHeader = *StdHeader;
AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
AgesaStatus = HeapAllocateBuffer (&AllocHeapParams, &PostParamsPtr->StdHeader);
if (AgesaStatus == AGESA_SUCCESS) {
PostParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
PostParamsPtr->MemConfig.MemData->ParameterListPtr = &(PostParamsPtr->MemConfig);
AmdPostPlatformConfigInit (&PostParamsPtr->PlatformConfig, &PostParamsPtr->StdHeader);
AmdMemInitDataStructDef (PostParamsPtr->MemConfig.MemData, &PostParamsPtr->PlatformConfig);
GnbInitDataStructAtPostDef (&PostParamsPtr->GnbPostConfig, PostParamsPtr);
}
return AgesaStatus;
}
示例2: FchInitResetLoadPrivateDefault
FCH_RESET_DATA_BLOCK*
FchInitResetLoadPrivateDefault (
IN AMD_RESET_PARAMS *ResetParams
)
{
FCH_RESET_DATA_BLOCK *FchParams;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
AGESA_STATUS AgesaStatus;
// First allocate internal data block via heap manager
AllocHeapParams.RequestedBufferSize = sizeof (FCH_RESET_DATA_BLOCK);
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
AllocHeapParams.BufferHandle = AMD_FCH_RESET_DATA_BLOCK_HANDLE;
AgesaStatus = HeapAllocateBuffer (&AllocHeapParams, &ResetParams->StdHeader);
ASSERT (!AgesaStatus);
FchParams = (FCH_RESET_DATA_BLOCK *) AllocHeapParams.BufferPtr;
ASSERT (FchParams != NULL);
IDS_HDT_CONSOLE (FCH_TRACE, " FCH Reset Data Block Allocation: [0x%x], Ptr = 0x%08x\n", AgesaStatus, FchParams);
*FchParams = InitResetCfgDefault;
FchParams->Gpp.GppLinkConfig = UserOptions.FchBldCfg->CfgFchGppLinkConfig;
FchParams->Gpp.PortCfg[0].PortPresent = UserOptions.FchBldCfg->CfgFchGppPort0Present;
FchParams->Gpp.PortCfg[1].PortPresent = UserOptions.FchBldCfg->CfgFchGppPort1Present;
FchParams->Gpp.PortCfg[2].PortPresent = UserOptions.FchBldCfg->CfgFchGppPort2Present;
FchParams->Gpp.PortCfg[3].PortPresent = UserOptions.FchBldCfg->CfgFchGppPort3Present;
FchParams->Gpp.PortCfg[0].PortHotPlug = UserOptions.FchBldCfg->CfgFchGppPort0HotPlug;
FchParams->Gpp.PortCfg[1].PortHotPlug = UserOptions.FchBldCfg->CfgFchGppPort1HotPlug;
FchParams->Gpp.PortCfg[2].PortHotPlug = UserOptions.FchBldCfg->CfgFchGppPort2HotPlug;
FchParams->Gpp.PortCfg[3].PortHotPlug = UserOptions.FchBldCfg->CfgFchGppPort3HotPlug;
return FchParams;
}
示例3: MemNInitPmuSramMsgBlockKV
BOOLEAN
MemNInitPmuSramMsgBlockKV (
IN OUT MEM_NB_BLOCK *NBPtr
)
{
LOCATE_HEAP_PTR LocHeap;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
PMU_SRAM_MSG_BLOCK_KV *PmuSramMsgBlockPtr;
LocHeap.BufferHandle = AMD_MEM_PMU_SRAM_MSG_BLOCK_HANDLE;
if (HeapLocateBuffer (&LocHeap, &(NBPtr->MemPtr->StdHeader)) == AGESA_SUCCESS) {
PmuSramMsgBlockPtr = (PMU_SRAM_MSG_BLOCK_KV *) LocHeap.BufferPtr;
} else {
// Allocate temporary buffer for PMU SRAM Message Block
AllocHeapParams.RequestedBufferSize = sizeof (PMU_SRAM_MSG_BLOCK_KV);
AllocHeapParams.BufferHandle = AMD_MEM_PMU_SRAM_MSG_BLOCK_HANDLE;
AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
if (HeapAllocateBuffer (&AllocHeapParams, &(NBPtr->MemPtr->StdHeader)) != AGESA_SUCCESS) {
return FALSE; // Could not allocate heap for PMU SRAM Message BLock.
}
PmuSramMsgBlockPtr = (PMU_SRAM_MSG_BLOCK_KV *) AllocHeapParams.BufferPtr;
}
LibAmdMemFill ((VOID *)PmuSramMsgBlockPtr, 0, (UINTN)sizeof (PMU_SRAM_MSG_BLOCK_KV), &(NBPtr->MemPtr->StdHeader));
return TRUE;
}
示例4: AmdInitRecoveryInitializer
/**
*
* Initialize defaults and options for Amd Init Reset.
*
* @param[in] StdHeader AMD standard header config param.
* @param[in] AmdRecoveryParamsPtr The Reset Init interface to initialize.
*
* @retval AGESA_SUCCESS Always Succeeds.
*/
AGESA_STATUS
AmdInitRecoveryInitializer (
IN AMD_CONFIG_PARAMS *StdHeader,
IN OUT AMD_RECOVERY_PARAMS *AmdRecoveryParamsPtr
)
{
ALLOCATE_HEAP_PARAMS AllocHeapParams;
ASSERT (StdHeader != NULL);
ASSERT (AmdRecoveryParamsPtr != NULL);
AmdRecoveryParamsPtr->StdHeader = *StdHeader;
AllocHeapParams.RequestedBufferSize = sizeof (MEM_DATA_STRUCT);
AllocHeapParams.BufferHandle = AMD_MEM_DATA_HANDLE;
AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
if (HeapAllocateBuffer (&AllocHeapParams, &AmdRecoveryParamsPtr->StdHeader) == AGESA_SUCCESS) {
AmdRecoveryParamsPtr->MemConfig.MemData = (MEM_DATA_STRUCT *) AllocHeapParams.BufferPtr;
AmdRecoveryParamsPtr->MemConfig.MemData->ParameterListPtr = &(AmdRecoveryParamsPtr->MemConfig);
LibAmdMemCopy ((VOID *) AmdRecoveryParamsPtr->MemConfig.MemData,
(VOID *) AmdRecoveryParamsPtr,
(UINTN) sizeof (AmdRecoveryParamsPtr->StdHeader),
&AmdRecoveryParamsPtr->StdHeader
);
AmdMemInitDataStructDefRecovery (AmdRecoveryParamsPtr->MemConfig.MemData);
return AGESA_SUCCESS;
} else {
return AGESA_ERROR;
}
}
示例5: OemInitEarly
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
PCIe_COMPLEX_DESCRIPTOR *PcieComplexListPtr;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
/* GNB PCIe topology Porting */
/* */
/* Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR */
/* */
AllocHeapParams.RequestedBufferSize = sizeof(PCIe_COMPLEX_DESCRIPTOR);
AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
ASSERT(Status == AGESA_SUCCESS);
PcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
LibAmdMemFill (PcieComplexListPtr,
0,
sizeof(PCIe_COMPLEX_DESCRIPTOR),
&InitEarly->StdHeader);
PcieComplexListPtr->Flags = DESCRIPTOR_TERMINATE_LIST;
PcieComplexListPtr->SocketId = 0;
PcieComplexListPtr->PciePortList = PortList;
PcieComplexListPtr->DdiLinkList = DdiList;
InitEarly->GnbConfig.PcieComplexList = PcieComplexListPtr;
return AGESA_SUCCESS;
}
示例6: OemCustomizeInitEarly
/*---------------------------------------------------------------------------------------*/
VOID
OemCustomizeInitEarly (
IN OUT AMD_EARLY_PARAMS *InitEarly
)
{
AGESA_STATUS Status;
VOID *TrinityPcieComplexListPtr;
VOID *TrinityPciePortPtr;
VOID *TrinityPcieDdiPtr;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
// GNB PCIe topology Porting
//
// Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR
//
AllocHeapParams.RequestedBufferSize = sizeof(Trinity) + sizeof(PortList) + sizeof(DdiList);
AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
if ( Status!= AGESA_SUCCESS) {
// Could not allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR
ASSERT(FALSE);
return;
}
TrinityPcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
AllocHeapParams.BufferPtr += sizeof(Trinity);
TrinityPciePortPtr = (PCIe_PORT_DESCRIPTOR *)AllocHeapParams.BufferPtr;
AllocHeapParams.BufferPtr += sizeof(PortList);
TrinityPcieDdiPtr = (PCIe_DDI_DESCRIPTOR *) AllocHeapParams.BufferPtr;
LibAmdMemFill (TrinityPcieComplexListPtr,
0,
sizeof(Trinity),
&InitEarly->StdHeader);
LibAmdMemFill (TrinityPciePortPtr,
0,
sizeof(PortList),
&InitEarly->StdHeader);
LibAmdMemFill (TrinityPcieDdiPtr,
0,
sizeof(DdiList),
&InitEarly->StdHeader);
LibAmdMemCopy (TrinityPcieComplexListPtr, &Trinity, sizeof(Trinity), &InitEarly->StdHeader);
LibAmdMemCopy (TrinityPciePortPtr, &PortList[0], sizeof(PortList), &InitEarly->StdHeader);
LibAmdMemCopy (TrinityPcieDdiPtr, &DdiList[0], sizeof(DdiList), &InitEarly->StdHeader);
((PCIe_COMPLEX_DESCRIPTOR*)TrinityPcieComplexListPtr)->PciePortList = (PCIe_PORT_DESCRIPTOR*)TrinityPciePortPtr;
((PCIe_COMPLEX_DESCRIPTOR*)TrinityPcieComplexListPtr)->DdiLinkList = (PCIe_DDI_DESCRIPTOR*)TrinityPcieDdiPtr;
InitEarly->GnbConfig.PcieComplexList = TrinityPcieComplexListPtr;
}
示例7: IdsPerfTimestamp
/**
*
* Get Ids Performance analysis table pointer in the AGESA Heap.
*
* @param[in,out] StdHeader The Pointer of AGESA Header
* @param[in] TestPoint Progress indicator value, see @ref AGESA_TP
*
* @retval AGESA_SUCCESS Success to get the pointer of Performance analysis Table.
* @retval AGESA_ERROR Fail to get the pointer of Performance analysis Table.
* @retval AGESA_UNSUPPORTED Get an exclude testpoint
*
**/
AGESA_STATUS
IdsPerfTimestamp (
IN OUT AMD_CONFIG_PARAMS *StdHeader,
IN AGESA_TP TestPoint
)
{
AGESA_STATUS status;
UINT8 Index;
UINT8 i;
TP_Perf_STRUCT *PerfTableEntry;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
LOCATE_HEAP_PTR LocateHeapStructPtr;
UINT64 CurrentTsc;
// Exclude some testpoint which may cause deadloop
for (i = 0; i < (sizeof (IdsPerfExcludeTp) / sizeof (AGESA_TP)); i++) {
if (TestPoint == IdsPerfExcludeTp[i]) {
return AGESA_UNSUPPORTED;
}
}
//if heap is not ready yet, don't invoke locate buffer, or else will cause event log & locate heap dead loop
if (StdHeader->HeapStatus != HEAP_DO_NOT_EXIST_YET ) {
LibAmdMsrRead (TSC, &CurrentTsc, StdHeader);
LocateHeapStructPtr.BufferHandle = IDS_CHECK_POINT_PERF_HANDLE;
LocateHeapStructPtr.BufferPtr = NULL;
status = HeapLocateBuffer (&LocateHeapStructPtr, StdHeader);
if (status == AGESA_SUCCESS) {
PerfTableEntry = (TP_Perf_STRUCT *) (LocateHeapStructPtr.BufferPtr);
} else {
AllocHeapParams.RequestedBufferSize = sizeof (TP_Perf_STRUCT);
AllocHeapParams.BufferHandle = IDS_CHECK_POINT_PERF_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
status = HeapAllocateBuffer (&AllocHeapParams, StdHeader);
if (status != AGESA_SUCCESS) {
return status;
}
PerfTableEntry = (TP_Perf_STRUCT *) (AllocHeapParams.BufferPtr);
LibAmdMemFill (PerfTableEntry, 0, sizeof (TP_Perf_STRUCT), StdHeader);
}
Index = PerfTableEntry ->Index;
//TPPerfUnit doesn't need to check, it may used for multiple time, used to check the time
// consumption of each perf measure routine.
if ((TestPoint != TpPerfUnit)) {
for (i = 0; i < Index; i++) {
if ((UINT8) TestPoint == PerfTableEntry ->TP[i].TestPoint) {
return AGESA_SUCCESS;
}
}
}
PerfTableEntry ->TP[Index].TestPoint = (UINT8) TestPoint;
PerfTableEntry ->TP[Index].StartTsc = CurrentTsc;
PerfTableEntry ->Index = ++Index;
}
return AGESA_SUCCESS;
}
示例8: NewNodeAndSocketTablesRecovery
/**
* Get new Socket and Node Maps.
*
* Put the Socket Die Table and the Node Table in heap with known handles.
*
* @param[out] SocketDieToNodeMap The Socket, Module to Node info map
* @param[out] NodeToSocketDieMap The Node to Socket, Module map.
* @param[in] StdHeader Header for library and services.
*/
VOID
STATIC
NewNodeAndSocketTablesRecovery (
OUT SOCKET_DIE_TO_NODE_MAP *SocketDieToNodeMap,
OUT NODE_TO_SOCKET_DIE_MAP *NodeToSocketDieMap,
IN AMD_CONFIG_PARAMS *StdHeader
)
{
UINT8 i;
UINT8 j;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
// Allocate heap for the table
AllocHeapParams.RequestedBufferSize = (((MAX_SOCKETS) * (MAX_DIES)) * sizeof (SOCKET_DIE_TO_NODE_ITEM));
AllocHeapParams.BufferHandle = SOCKET_DIE_MAP_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
if (HeapAllocateBuffer (&AllocHeapParams, StdHeader) == AGESA_SUCCESS) {
// HeapAllocateBuffer must set BufferPtr to valid or NULL.
*SocketDieToNodeMap = (SOCKET_DIE_TO_NODE_MAP)AllocHeapParams.BufferPtr;
ASSERT (SocketDieToNodeMap != NULL);
// Initialize shared data structures
for (i = 0; i < MAX_SOCKETS; i++) {
for (j = 0; j < MAX_DIES; j++) {
(**SocketDieToNodeMap)[i][j].Node = HT_LIST_TERMINAL;
(**SocketDieToNodeMap)[i][j].LowCore = HT_LIST_TERMINAL;
(**SocketDieToNodeMap)[i][j].HighCore = HT_LIST_TERMINAL;
}
}
}
// Allocate heap for the table
AllocHeapParams.RequestedBufferSize = (MAX_NODES * sizeof (NODE_TO_SOCKET_DIE_ITEM));
AllocHeapParams.BufferHandle = NODE_ID_MAP_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
if (HeapAllocateBuffer (&AllocHeapParams, StdHeader) == AGESA_SUCCESS) {
// HeapAllocateBuffer must set BufferPtr to valid or NULL.
*NodeToSocketDieMap = (NODE_TO_SOCKET_DIE_MAP)AllocHeapParams.BufferPtr;
ASSERT (NodeToSocketDieMap != NULL);
// Initialize shared data structures
for (i = 0; i < MAX_NODES; i++) {
(**NodeToSocketDieMap)[i].Socket = HT_LIST_TERMINAL;
(**NodeToSocketDieMap)[i].Die = HT_LIST_TERMINAL;
}
}
}
示例9: OemInitEarly
static AGESA_STATUS OemInitEarly(AMD_EARLY_PARAMS * InitEarly)
{
AGESA_STATUS Status;
VOID *LlanoPcieComplexListPtr;
VOID *LlanoPciePortPtr;
VOID *LlanoPcieDdiPtr;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
// GNB PCIe topology Porting
//
// Allocate buffer for PCIe_COMPLEX_DESCRIPTOR , PCIe_PORT_DESCRIPTOR and PCIe_DDI_DESCRIPTOR
//
AllocHeapParams.RequestedBufferSize = sizeof(Llano) + sizeof(PortList) + sizeof(DdiList);
AllocHeapParams.BufferHandle = AMD_MEM_MISC_HANDLES_START;
AllocHeapParams.Persist = HEAP_LOCAL_CACHE;
Status = HeapAllocateBuffer (&AllocHeapParams, &InitEarly->StdHeader);
ASSERT(Status == AGESA_SUCCESS);
LlanoPcieComplexListPtr = (PCIe_COMPLEX_DESCRIPTOR *) AllocHeapParams.BufferPtr;
AllocHeapParams.BufferPtr += sizeof(Llano);
LlanoPciePortPtr = (PCIe_PORT_DESCRIPTOR *)AllocHeapParams.BufferPtr;
AllocHeapParams.BufferPtr += sizeof(PortList);
LlanoPcieDdiPtr = (PCIe_DDI_DESCRIPTOR *) AllocHeapParams.BufferPtr;
LibAmdMemFill (LlanoPcieComplexListPtr,
0,
sizeof(Llano),
&InitEarly->StdHeader);
LibAmdMemFill (LlanoPciePortPtr,
0,
sizeof(PortList),
&InitEarly->StdHeader);
LibAmdMemFill (LlanoPcieDdiPtr,
0,
sizeof(DdiList),
&InitEarly->StdHeader);
LibAmdMemCopy (LlanoPcieComplexListPtr, &Llano, sizeof(Llano), &InitEarly->StdHeader);
LibAmdMemCopy (LlanoPciePortPtr, &PortList[0], sizeof(PortList), &InitEarly->StdHeader);
LibAmdMemCopy (LlanoPcieDdiPtr, &DdiList[0], sizeof(DdiList), &InitEarly->StdHeader);
((PCIe_COMPLEX_DESCRIPTOR*)LlanoPcieComplexListPtr)->PciePortList = (PCIe_PORT_DESCRIPTOR*)LlanoPciePortPtr;
((PCIe_COMPLEX_DESCRIPTOR*)LlanoPcieComplexListPtr)->DdiLinkList = (PCIe_DDI_DESCRIPTOR*)LlanoPcieDdiPtr;
InitEarly->GnbConfig.PcieComplexList = LlanoPcieComplexListPtr;
InitEarly->GnbConfig.PsppPolicy = 0;
return AGESA_SUCCESS;
}
示例10: S3SaveStateExtendTableLenth
/**
* Initialize S3 Script framework
*
*
*
* @param[in] StdHeader Pointer to standard header
* @param[in,out] S3SaveTable S3 save table header
*/
STATIC AGESA_STATUS
S3SaveStateExtendTableLenth (
IN AMD_CONFIG_PARAMS *StdHeader,
IN OUT S3_SAVE_TABLE_HEADER **S3SaveTable
)
{
AGESA_STATUS Status;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
VOID *TempBuffer;
UINT16 NewTableLength;
UINT16 CurrentTableLength;
//Allocate temporary buffer
NewTableLength = (*S3SaveTable)->TableLength + S3_TABLE_LENGTH_INCREMENT;
AllocHeapParams.RequestedBufferSize = NewTableLength;
AllocHeapParams.BufferHandle = AMD_S3_SCRIPT_TEMP_BUFFER_HANDLE;
AllocHeapParams.Persist = StdHeader->HeapStatus;
Status = HeapAllocateBuffer (&AllocHeapParams, StdHeader);
if (Status != AGESA_SUCCESS) {
return Status;
}
//Save current table length
CurrentTableLength = (*S3SaveTable)->TableLength;
//Update table length
(*S3SaveTable)->TableLength = NewTableLength;
//Copy S3 save toable to temporary location
LibAmdMemCopy (AllocHeapParams.BufferPtr, *S3SaveTable, CurrentTableLength, StdHeader);
//Save pointer to temp buffer
TempBuffer = AllocHeapParams.BufferPtr;
// Free original S3 save buffer
HeapDeallocateBuffer (AMD_S3_SCRIPT_SAVE_TABLE_HANDLE, StdHeader);
AllocHeapParams.RequestedBufferSize = NewTableLength;
AllocHeapParams.BufferHandle = AMD_S3_SCRIPT_SAVE_TABLE_HANDLE;
AllocHeapParams.Persist = StdHeader->HeapStatus;
Status = HeapAllocateBuffer (&AllocHeapParams, StdHeader);
if (Status != AGESA_SUCCESS) {
return Status;
}
LibAmdMemCopy (AllocHeapParams.BufferPtr, TempBuffer, AllocHeapParams.RequestedBufferSize, StdHeader);
*S3SaveTable = (S3_SAVE_TABLE_HEADER*) AllocHeapParams.BufferPtr;
HeapDeallocateBuffer (AMD_S3_SCRIPT_TEMP_BUFFER_HANDLE, StdHeader);
return Status;
}
示例11: IdsPerfTimestamp
/**
*
* Get Ids Performance analysis table pointer in the AGESA Heap.
*
* @param[in] LineInFile ((FILECODE) shift 16)+ Line number
* @param[in] Description ID for Description define idsperf.h
* @param[in,out] StdHeader The Pointer of AGESA Header
*
* @retval AGESA_SUCCESS Success to get the pointer of Performance analysis Table.
* @retval AGESA_ERROR Fail to get the pointer of Performance analysis Table.
* @retval AGESA_UNSUPPORTED Get an exclude testpoint
*
**/
AGESA_STATUS
IdsPerfTimestamp (
IN UINT32 LineInFile,
IN UINT32 Description,
IN OUT AMD_CONFIG_PARAMS *StdHeader
)
{
AGESA_STATUS status;
UINT32 Index;
TP_Perf_STRUCT *PerfTableEntry;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
LOCATE_HEAP_PTR LocateHeapStructPtr;
UINT64 TscAtBegining;
UINT64 TscAtEnd;
//if heap is not ready yet, don't invoke locate buffer, or else will cause event log & locate heap dead loop
if (StdHeader->HeapStatus != HEAP_DO_NOT_EXIST_YET ) {
IdsGetGtsc (&TscAtBegining, StdHeader);
LocateHeapStructPtr.BufferHandle = IDS_CHECK_POINT_PERF_HANDLE;
LocateHeapStructPtr.BufferPtr = NULL;
status = HeapLocateBuffer (&LocateHeapStructPtr, StdHeader);
if (status == AGESA_SUCCESS) {
PerfTableEntry = (TP_Perf_STRUCT *) (LocateHeapStructPtr.BufferPtr);
} else {
AllocHeapParams.RequestedBufferSize = sizeof (TP_Perf_STRUCT);
AllocHeapParams.BufferHandle = IDS_CHECK_POINT_PERF_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
status = HeapAllocateBuffer (&AllocHeapParams, StdHeader);
if (status != AGESA_SUCCESS) {
return status;
}
PerfTableEntry = (TP_Perf_STRUCT *) (AllocHeapParams.BufferPtr);
LibAmdMemFill (PerfTableEntry, 0, sizeof (TP_Perf_STRUCT), StdHeader);
PerfTableEntry->Signature = 'FREP';
PerfTableEntry->Version = IDS_PERF_VERSION;
}
Index = PerfTableEntry ->Index;
if (Index >= MAX_PERFORMANCE_UNIT_NUM - 1) {
ASSERT (FALSE);
return AGESA_WARNING;
}
// Read GTSC again, so we could calculate the time consumed by this routine
IdsGetGtsc (&TscAtEnd, StdHeader);
PerfTableEntry ->TP[Index].LineInFile = LineInFile;
PerfTableEntry ->TP[Index].Description = Description;
PerfTableEntry ->TP[Index].StartTsc = TscAtBegining - PerfTableEntry ->TP[MAX_PERFORMANCE_UNIT_NUM - 1].StartTsc;
PerfTableEntry ->TP[MAX_PERFORMANCE_UNIT_NUM - 1].StartTsc += TscAtEnd - TscAtBegining; // Using the last TP to record the total time consumed by this routine
PerfTableEntry ->Index = ++Index;
}
return AGESA_SUCCESS;
}
示例12: NewNodeAndSocketTables
/**
* Get a new Socket Die to Node Map.
*
* @HtInterfaceMethod{::F_NEW_NODE_AND_SOCKET_TABLES}
*
* Put the Socket Die Table in heap with a known handle. Content will be generated as
* each node is discovered.
*
* @param[in,out] State global state
*/
VOID
NewNodeAndSocketTables (
IN OUT STATE_DATA *State
)
{
UINT8 i;
UINT8 j;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
// Allocate heap for the table
State->SocketDieToNodeMap = NULL;
AllocHeapParams.RequestedBufferSize = (((MAX_SOCKETS) * (MAX_DIES)) * sizeof (SOCKET_DIE_TO_NODE_ITEM));
AllocHeapParams.BufferHandle = SOCKET_DIE_MAP_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
if (HeapAllocateBuffer (&AllocHeapParams, State->ConfigHandle) == AGESA_SUCCESS) {
State->SocketDieToNodeMap = (SOCKET_DIE_TO_NODE_MAP)AllocHeapParams.BufferPtr;
// Initialize shared data structures
for (i = 0; i < MAX_SOCKETS; i++) {
for (j = 0; j < MAX_DIES; j++) {
(*State->SocketDieToNodeMap)[i][j].Node = HT_LIST_TERMINAL;
(*State->SocketDieToNodeMap)[i][j].LowCore = HT_LIST_TERMINAL;
(*State->SocketDieToNodeMap)[i][j].HighCore = HT_LIST_TERMINAL;
}
}
}
// Allocate heap for the table
State->NodeToSocketDieMap = NULL;
AllocHeapParams.RequestedBufferSize = (MAX_NODES * sizeof (NODE_TO_SOCKET_DIE_ITEM));
AllocHeapParams.BufferHandle = NODE_ID_MAP_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
if (HeapAllocateBuffer (&AllocHeapParams, State->ConfigHandle) == AGESA_SUCCESS) {
State->NodeToSocketDieMap = (NODE_TO_SOCKET_DIE_MAP)AllocHeapParams.BufferPtr;
// Initialize shared data structures
for (i = 0; i < MAX_NODES; i++) {
(*State->NodeToSocketDieMap)[i].Socket = HT_LIST_TERMINAL;
(*State->NodeToSocketDieMap)[i].Die = HT_LIST_TERMINAL;
}
}
}
示例13: IdsPerfTimestamp
/**
*
* Get Ids Performance analysis table pointer in the AGESA Heap.
*
* @param[in] LineInFile ((FILECODE) shift 16)+ Line number
* @param[in] Description ID for Description define idsperf.h
* @param[in,out] StdHeader The Pointer of AGESA Header
*
* @retval AGESA_SUCCESS Success to get the pointer of Performance analysis Table.
* @retval AGESA_ERROR Fail to get the pointer of Performance analysis Table.
* @retval AGESA_UNSUPPORTED Get an exclude testpoint
*
**/
AGESA_STATUS
IdsPerfTimestamp (
IN UINT32 LineInFile,
IN UINT32 Description,
IN OUT AMD_CONFIG_PARAMS *StdHeader
)
{
AGESA_STATUS status;
UINT32 Index;
TP_Perf_STRUCT *PerfTableEntry;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
LOCATE_HEAP_PTR LocateHeapStructPtr;
UINT64 CurrentTsc;
//if heap is not ready yet, don't invoke locate buffer, or else will cause event log & locate heap dead loop
if (StdHeader->HeapStatus != HEAP_DO_NOT_EXIST_YET ) {
LibAmdMsrRead (TSC, &CurrentTsc, StdHeader);
LocateHeapStructPtr.BufferHandle = IDS_CHECK_POINT_PERF_HANDLE;
LocateHeapStructPtr.BufferPtr = NULL;
status = HeapLocateBuffer (&LocateHeapStructPtr, StdHeader);
if (status == AGESA_SUCCESS) {
PerfTableEntry = (TP_Perf_STRUCT *) (LocateHeapStructPtr.BufferPtr);
} else {
AllocHeapParams.RequestedBufferSize = sizeof (TP_Perf_STRUCT);
AllocHeapParams.BufferHandle = IDS_CHECK_POINT_PERF_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
status = HeapAllocateBuffer (&AllocHeapParams, StdHeader);
if (status != AGESA_SUCCESS) {
return status;
}
PerfTableEntry = (TP_Perf_STRUCT *) (AllocHeapParams.BufferPtr);
LibAmdMemFill (PerfTableEntry, 0, sizeof (TP_Perf_STRUCT), StdHeader);
PerfTableEntry->Signature = 'FREP';
PerfTableEntry->Version = IDS_PERF_VERSION;
}
Index = PerfTableEntry ->Index;
if (Index >= MAX_PERFORMANCE_UNIT_NUM) {
return AGESA_WARNING;
}
ASSERT (Index < MAX_PERFORMANCE_UNIT_NUM);
PerfTableEntry ->TP[Index].LineInFile = LineInFile;
PerfTableEntry ->TP[Index].Description = Description;
PerfTableEntry ->TP[Index].StartTsc = CurrentTsc;
PerfTableEntry ->Index = ++Index;
}
return AGESA_SUCCESS;
}
示例14: MemS3ResumeInitNB
/**
*
*
* This function initialize the northbridge block and apply for heap space
* before any function call is made to memory component during S3 resume.
*
* @param[in] *StdHeader - Config handle for library and services
* @return AGESA_STATUS
* - AGESA_ALERT
* - AGESA_FATAL
* - AGESA_SUCCESS
* - AGESA_WARNING
*/
AGESA_STATUS
MemS3ResumeInitNB (
IN AMD_CONFIG_PARAMS *StdHeader
)
{
AGESA_STATUS RetVal;
MEM_MAIN_DATA_BLOCK mmData;
S3_MEM_NB_BLOCK *S3NBPtr;
MEM_DATA_STRUCT *MemData;
UINT8 Die;
UINT8 DieCount;
UINT8 SpecialCaseHeapSize;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
S3_SPECIAL_CASE_HEAP_HEADER SpecialHeapHeader[MAX_NODES_SUPPORTED];
SpecialCaseHeapSize = 0;
//---------------------------------------------
// Creation of NB Block for S3 resume
//---------------------------------------------
RetVal = MemS3InitNB (&S3NBPtr, &MemData, &mmData, StdHeader);
if (RetVal == AGESA_FATAL) {
return RetVal;
}
DieCount = mmData.DieCount;
//--------------------------------------------------
// Apply for heap space for special case registers
//--------------------------------------------------
for (Die = 0; Die < DieCount; Die ++) {
// Construct the header for the special case heap.
SpecialHeapHeader[Die].Node = S3NBPtr[Die].NBPtr->Node;
SpecialHeapHeader[Die].Offset = SpecialCaseHeapSize + (DieCount * (sizeof (S3_SPECIAL_CASE_HEAP_HEADER)));
SpecialCaseHeapSize = SpecialCaseHeapSize + S3NBPtr->MemS3SpecialCaseHeapSize;
}
AllocHeapParams.RequestedBufferSize = (DieCount * (sizeof (S3_SPECIAL_CASE_HEAP_HEADER))) + SpecialCaseHeapSize;
AllocHeapParams.BufferHandle = AMD_MEM_S3_DATA_HANDLE;
AllocHeapParams.Persist = HEAP_SYSTEM_MEM;
if (HeapAllocateBuffer (&AllocHeapParams, StdHeader) != AGESA_SUCCESS) {
PutEventLog (AGESA_FATAL, MEM_ERROR_HEAP_ALLOCATE_FOR_S3_SPECIAL_CASE_REGISTERS, S3NBPtr[Die].NBPtr->Node, 0, 0, 0, StdHeader);
SetMemError (AGESA_FATAL, S3NBPtr[Die].NBPtr->MCTPtr);
ASSERT(FALSE); // Could not allocate heap space for "S3_SPECIAL_CASE_HEAP_HEADER"
return AGESA_FATAL;
}
LibAmdMemCopy ((VOID *) AllocHeapParams.BufferPtr, (VOID *) SpecialHeapHeader, (sizeof (S3_SPECIAL_CASE_HEAP_HEADER) * DieCount), StdHeader);
return AGESA_SUCCESS;
}
示例15: S3ScriptInitState
/**
* Initialize S3 Script framework
*
*
*
* @param[in] StdHeader Pointer to standard header
*/
AGESA_STATUS
S3ScriptInitState (
IN AMD_CONFIG_PARAMS *StdHeader
)
{
AGESA_STATUS Status;
ALLOCATE_HEAP_PARAMS AllocHeapParams;
AllocHeapParams.RequestedBufferSize = S3_TABLE_LENGTH;
AllocHeapParams.BufferHandle = AMD_S3_SCRIPT_SAVE_TABLE_HANDLE;
AllocHeapParams.Persist = StdHeader->HeapStatus;
Status = HeapAllocateBuffer (&AllocHeapParams, StdHeader);
if (Status == AGESA_SUCCESS) {
((S3_SAVE_TABLE_HEADER *) AllocHeapParams.BufferPtr)->TableLength = S3_TABLE_LENGTH;
((S3_SAVE_TABLE_HEADER *) AllocHeapParams.BufferPtr)->SaveOffset = sizeof (S3_SAVE_TABLE_HEADER);
}
return Status;
}