IN CONST CHAR8 *Token\r
)\r
{\r
+ if (Token == NULL) {\r
+ return FALSE;\r
+ }\r
+\r
if (AsciiStrCmp (Token, SEC_TOK) == 0 ||\r
AsciiStrCmp (Token, PEI_TOK) == 0 ||\r
AsciiStrCmp (Token, DXE_TOK) == 0 ||\r
}\r
}\r
\r
-/**\r
- Allocate EfiReservedMemoryType below 4G memory address.\r
-\r
- This function allocates EfiReservedMemoryType below 4G memory address.\r
-\r
- @param[in] Size Size of memory to allocate.\r
-\r
- @return Allocated address for output.\r
-\r
-**/\r
-VOID *\r
-FpdtAllocateReservedMemoryBelow4G (\r
- IN UINTN Size\r
- )\r
-{\r
- UINTN Pages;\r
- EFI_PHYSICAL_ADDRESS Address;\r
- EFI_STATUS Status;\r
- VOID *Buffer;\r
-\r
- Buffer = NULL;\r
- Pages = EFI_SIZE_TO_PAGES (Size);\r
- Address = 0xffffffff;\r
-\r
- Status = gBS->AllocatePages (\r
- AllocateMaxAddress,\r
- EfiReservedMemoryType,\r
- Pages,\r
- &Address\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- if (!EFI_ERROR (Status)) {\r
- Buffer = (VOID *) (UINTN) Address;\r
- ZeroMem (Buffer, Size);\r
- }\r
-\r
- return Buffer;\r
-}\r
-\r
/**\r
Allocate buffer for Boot Performance table.\r
\r
SmmCommData->Function = SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE;\r
SmmCommData->BootRecordData = NULL;\r
Status = Communication->Communicate (Communication, SmmBootRecordCommBuffer, &CommSize);\r
- ASSERT_EFI_ERROR (Status);\r
\r
- if (!EFI_ERROR (SmmCommData->ReturnStatus) && SmmCommData->BootRecordSize != 0) {\r
+ if (!EFI_ERROR (Status) && !EFI_ERROR (SmmCommData->ReturnStatus) && SmmCommData->BootRecordSize != 0) {\r
//\r
// Get all boot records\r
//\r
// Boot Performance table includes BasicBoot record, and one or more appended Boot Records.\r
//\r
BootPerformanceDataSize = sizeof (BOOT_PERFORMANCE_TABLE) + mPerformanceLength + PcdGet32 (PcdExtFpdtBootRecordPadSize);\r
- if (SmmCommData != NULL) {\r
+ if (SmmCommData != NULL && SmmBootRecordData != NULL) {\r
BootPerformanceDataSize += SmmBootRecordDataSize;\r
}\r
\r
//\r
// Fail to allocate at specified address, continue to allocate at any address.\r
//\r
- mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize);\r
+ mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages (\r
+ EfiReservedMemoryType,\r
+ EFI_SIZE_TO_PAGES (BootPerformanceDataSize)\r
+ );\r
+ if (mAcpiBootPerformanceTable != NULL) {\r
+ ZeroMem (mAcpiBootPerformanceTable, BootPerformanceDataSize);\r
+ }\r
}\r
DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));\r
\r
\r
//\r
// If PERF_START()/PERF_END() have specified the ProgressID,it has high priority.\r
- // !!! Note: If the Pref is not the known Token used in the core but have same\r
+ // !!! Note: If the Perf is not the known Token used in the core but have same\r
// ID with the core Token, this case will not be supported.\r
// And in currtnt usage mode, for the unkown ID, there is a general rule:\r
// If it is start pref: the lower 4 bits of the ID should be 0.\r