summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-02 05:51:05 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-02 05:51:05 +0000
commit19e14fc9d947eccdfcfe2d1464dfac791015b465 (patch)
tree489c81c886040ca09b635377b6cc92d268a882e5 /MdeModulePkg/Core/Dxe
parent7bc5ca171e0c68f6da7e36d633dbd3d83caa37ec (diff)
downloadedk2-platforms-19e14fc9d947eccdfcfe2d1464dfac791015b465.tar.xz
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
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r--MdeModulePkg/Core/Dxe/DebugImageInfo.h3
-rw-r--r--MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c41
2 files changed, 3 insertions, 41 deletions
diff --git a/MdeModulePkg/Core/Dxe/DebugImageInfo.h b/MdeModulePkg/Core/Dxe/DebugImageInfo.h
index 8074fa2098..317546b5ba 100644
--- a/MdeModulePkg/Core/Dxe/DebugImageInfo.h
+++ b/MdeModulePkg/Core/Dxe/DebugImageInfo.h
@@ -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 *))
diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
index 50e4468399..556c14c585 100644
--- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
+++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
@@ -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;