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:
qhuang8 2008-09-02 05:51:05 +00:00
parent 7bc5ca171e
commit 19e14fc9d9
3 changed files with 4 additions and 41 deletions

View File

@ -16,8 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef __DEBUG_IMAGE_INFO_H__
#define __DEBUG_IMAGE_INFO_H__
#define FOUR_MEG_PAGES 0x400
#define FOUR_MEG_MASK ((FOUR_MEG_PAGES * EFI_PAGE_SIZE) - 1)
#define FOUR_MEG_ALIGNMENT 0x400000
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))

View File

@ -30,12 +30,6 @@ EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
Creates and initializes the DebugImageInfo Table. Also creates the configuration
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
CoreInitializeDebugImageInfoTable (
@ -43,44 +37,13 @@ CoreInitializeDebugImageInfoTable (
)
{
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS Mem;
UINTN NumberOfPages;
//
// Allocate boot services memory for the structure. It's required to be aligned on
// 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.
// Allocate 4M aligned page for the structure and fill in the data.
// 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.
//
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->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
mDebugTable->Crc32 = 0;

View File

@ -115,6 +115,7 @@
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
[LibraryClasses.common.DXE_DRIVER]
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf