mirror of https://github.com/acidanthera/audk.git
1. Use AllocateAlignedPages() to remove tricky logic in DebugImageInfo.c
2. Add ReportStatusCodeLib instance in MdeModulePkg.dsc for DxeCore. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5774 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7bc5ca171e
commit
19e14fc9d9
|
@ -16,8 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#ifndef __DEBUG_IMAGE_INFO_H__
|
#ifndef __DEBUG_IMAGE_INFO_H__
|
||||||
#define __DEBUG_IMAGE_INFO_H__
|
#define __DEBUG_IMAGE_INFO_H__
|
||||||
|
|
||||||
#define FOUR_MEG_PAGES 0x400
|
#define FOUR_MEG_ALIGNMENT 0x400000
|
||||||
#define FOUR_MEG_MASK ((FOUR_MEG_PAGES * EFI_PAGE_SIZE) - 1)
|
|
||||||
|
|
||||||
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
|
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,6 @@ EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
|
||||||
Creates and initializes the DebugImageInfo Table. Also creates the configuration
|
Creates and initializes the DebugImageInfo Table. Also creates the configuration
|
||||||
table and registers it into the system table.
|
table and registers it into the system table.
|
||||||
|
|
||||||
Note:
|
|
||||||
This function allocates memory, frees it, and then allocates memory at an
|
|
||||||
address within the initial allocation. Since this function is called early
|
|
||||||
in DXE core initialization (before drivers are dispatched), this should not
|
|
||||||
be a problem.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
CoreInitializeDebugImageInfoTable (
|
CoreInitializeDebugImageInfoTable (
|
||||||
|
@ -43,44 +37,13 @@ CoreInitializeDebugImageInfoTable (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PHYSICAL_ADDRESS Mem;
|
|
||||||
UINTN NumberOfPages;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate boot services memory for the structure. It's required to be aligned on
|
// Allocate 4M aligned page for the structure and fill in the data.
|
||||||
// a 4M boundary, so allocate a 4M block (plus what we require), free it up, calculate
|
|
||||||
// a 4M aligned address within the memory we just freed, and then allocate memory at that
|
|
||||||
// address for our initial structure.
|
|
||||||
//
|
|
||||||
NumberOfPages = FOUR_MEG_PAGES + EFI_SIZE_TO_PAGES(sizeof (EFI_SYSTEM_TABLE_POINTER));
|
|
||||||
|
|
||||||
Status = CoreAllocatePages (AllocateAnyPages, EfiBootServicesData, NumberOfPages , &Mem);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
if (EFI_ERROR(Status)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Status = CoreFreePages (Mem, NumberOfPages);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
if (EFI_ERROR(Status)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Now get a 4M aligned address within the memory range we were given.
|
|
||||||
// Then allocate memory at that address
|
|
||||||
//
|
|
||||||
Mem = (Mem + FOUR_MEG_MASK) & (~FOUR_MEG_MASK);
|
|
||||||
|
|
||||||
Status = CoreAllocatePages (AllocateAddress, EfiBootServicesData, NumberOfPages - FOUR_MEG_PAGES, &Mem);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
if (EFI_ERROR(Status)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// We now have a 4M aligned page allocated, so fill in the data structure.
|
|
||||||
// Ideally we would update the CRC now as well, but the service may not yet be available.
|
// Ideally we would update the CRC now as well, but the service may not yet be available.
|
||||||
// See comments in the CoreUpdateDebugTableCrc32() function below for details.
|
// See comments in the CoreUpdateDebugTableCrc32() function below for details.
|
||||||
//
|
//
|
||||||
mDebugTable = (EFI_SYSTEM_TABLE_POINTER *)(UINTN)Mem;
|
mDebugTable = AllocateAlignedPages (EFI_SIZE_TO_PAGES (sizeof (EFI_SYSTEM_TABLE_POINTER)), FOUR_MEG_ALIGNMENT);
|
||||||
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
|
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
|
||||||
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
|
mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
|
||||||
mDebugTable->Crc32 = 0;
|
mDebugTable->Crc32 = 0;
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
|
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
|
||||||
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
||||||
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
|
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
|
||||||
|
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.DXE_DRIVER]
|
[LibraryClasses.common.DXE_DRIVER]
|
||||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||||
|
|
Loading…
Reference in New Issue