]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Use AllocateAlignedPages() to remove tricky logic in DebugImageInfo.c
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Sep 2008 05:51:05 +0000 (05:51 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Sep 2008 05:51:05 +0000 (05:51 +0000)
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

MdeModulePkg/Core/Dxe/DebugImageInfo.h
MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
MdeModulePkg/MdeModulePkg.dsc

index 8074fa209827475a6210def4ca8ce81aba795b2c..317546b5ba75b8d58e39e041e1b86c862fb4ab76 100644 (file)
@@ -16,8 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef __DEBUG_IMAGE_INFO_H__\r
 #define __DEBUG_IMAGE_INFO_H__\r
 \r
-#define FOUR_MEG_PAGES  0x400\r
-#define FOUR_MEG_MASK   ((FOUR_MEG_PAGES * EFI_PAGE_SIZE) - 1)\r
+#define FOUR_MEG_ALIGNMENT   0x400000\r
 \r
 #define EFI_DEBUG_TABLE_ENTRY_SIZE       (sizeof (VOID *))\r
 \r
index 50e44683996350e833f76919035a8513a6be56c5..556c14c5850f40e58ec92b8f2a4920e5001fd2e3 100644 (file)
@@ -30,12 +30,6 @@ EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
   Creates and initializes the DebugImageInfo Table.  Also creates the configuration\r
   table and registers it into the system table.\r
 \r
-  Note:\r
-    This function allocates memory, frees it, and then allocates memory at an\r
-    address within the initial allocation. Since this function is called early\r
-    in DXE core initialization (before drivers are dispatched), this should not\r
-    be a problem.\r
-\r
 **/\r
 VOID\r
 CoreInitializeDebugImageInfoTable (\r
@@ -43,44 +37,13 @@ CoreInitializeDebugImageInfoTable (
   )\r
 {\r
   EFI_STATUS                          Status;\r
-  EFI_PHYSICAL_ADDRESS                Mem;\r
-  UINTN                               NumberOfPages;\r
-\r
-  //\r
-  // Allocate boot services memory for the structure. It's required to be aligned on\r
-  // a 4M boundary, so allocate a 4M block (plus what we require), free it up, calculate\r
-  // a 4M aligned address within the memory we just freed, and then allocate memory at that\r
-  // address for our initial structure.\r
-  //\r
-  NumberOfPages = FOUR_MEG_PAGES + EFI_SIZE_TO_PAGES(sizeof (EFI_SYSTEM_TABLE_POINTER));\r
 \r
-  Status = CoreAllocatePages (AllocateAnyPages, EfiBootServicesData, NumberOfPages , &Mem);\r
-  ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR(Status)) {\r
-    return;\r
-  }\r
-  Status = CoreFreePages (Mem, NumberOfPages);\r
-  ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR(Status)) {\r
-    return;\r
-  }\r
-  //\r
-  // Now get a 4M aligned address within the memory range we were given.\r
-  // Then allocate memory at that address\r
-  //\r
-  Mem = (Mem + FOUR_MEG_MASK) & (~FOUR_MEG_MASK);\r
-\r
-  Status = CoreAllocatePages (AllocateAddress, EfiBootServicesData, NumberOfPages - FOUR_MEG_PAGES, &Mem);\r
-  ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR(Status)) {\r
-    return;\r
-  }\r
   //\r
-  // We now have a 4M aligned page allocated, so fill in the data structure.\r
+  // Allocate 4M aligned page for the structure and fill in the data.\r
   // Ideally we would update the CRC now as well, but the service may not yet be available.\r
   // See comments in the CoreUpdateDebugTableCrc32() function below for details.\r
   //\r
-  mDebugTable = (EFI_SYSTEM_TABLE_POINTER *)(UINTN)Mem;\r
+  mDebugTable = AllocateAlignedPages (EFI_SIZE_TO_PAGES (sizeof (EFI_SYSTEM_TABLE_POINTER)), FOUR_MEG_ALIGNMENT); \r
   mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;\r
   mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;\r
   mDebugTable->Crc32 = 0;\r
index a4ad5663731e47c8231ab1229ab3e12fe5f25671..fc876ce4959fd7a056061de4c995d308b21f3ad1 100644 (file)
   HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf\r
   MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf\r
   ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf\r
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf\r
 \r
 [LibraryClasses.common.DXE_DRIVER]\r
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r