]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update NT32 to produce the gEfiMemoryTypeInformation HOB
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 14 Jun 2010 23:29:06 +0000 (23:29 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 14 Jun 2010 23:29:06 +0000 (23:29 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10582 6f19259b-4bc3-4df7-8a09-765794883524

Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c
Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf

index cba5d936bd5912975eea62cb59493350d08a4bc5..90a97b97676393035c12fcc3151e93d869b3d682 100644 (file)
@@ -28,6 +28,10 @@ Revision History
 // The protocols, PPI and GUID defintions for this module\r
 //\r
 #include <Ppi/NtAutoscan.h>\r
+#include <Ppi/ReadOnlyVariable2.h>\r
+\r
+#include <Guid/MemoryTypeInformation.h>\r
+\r
 //\r
 // The Library classes this module consumes\r
 //\r
@@ -36,6 +40,15 @@ Revision History
 #include <Library/HobLib.h>\r
 #include <Library/PeiServicesLib.h>\r
 \r
+EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {\r
+  { EfiReservedMemoryType,  0x0004 },\r
+  { EfiRuntimeServicesCode, 0x0040 },\r
+  { EfiRuntimeServicesData, 0x0040 },\r
+  { EfiBootServicesCode,    0x0300 },\r
+  { EfiBootServicesData,    0x1000 },\r
+  { EfiMaxMemoryType,       0      }\r
+};\r
+\r
 EFI_STATUS\r
 EFIAPI\r
 PeimInitializeWinNtAutoScan (\r
@@ -63,6 +76,9 @@ Returns:
   EFI_PHYSICAL_ADDRESS        MemoryBase;\r
   UINTN                       Index;\r
   EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;\r
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI       *Variable;\r
+  UINTN                                 DataSize;\r
+  EFI_MEMORY_TYPE_INFORMATION           MemoryData [EfiMaxMemoryType + 1];\r
 \r
 \r
   DEBUG ((EFI_D_ERROR, "NT 32 Autoscan PEIM Loaded\n"));\r
@@ -116,6 +132,46 @@ Returns:
   // Build the CPU hob with 36-bit addressing and 16-bits of IO space.\r
   //\r
   BuildCpuHob (36, 16);\r
-  \r
+\r
+  //\r
+  // Build GUIDed Hob that contains the Memory Type Information array\r
+  //\r
+  Status = PeiServicesLocatePpi (\r
+             &gEfiPeiReadOnlyVariable2PpiGuid,\r
+             0,\r
+             NULL,\r
+             (VOID **)&Variable\r
+             );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  DataSize = sizeof (MemoryData);\r
+  Status = Variable->GetVariable (\r
+                       Variable,\r
+                       EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,\r
+                       &gEfiMemoryTypeInformationGuid,\r
+                       NULL,\r
+                       &DataSize,\r
+                       &MemoryData\r
+                       );\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // Create Memory Type Information HOB\r
+    //\r
+    BuildGuidDataHob (\r
+      &gEfiMemoryTypeInformationGuid,\r
+      mDefaultMemoryTypeInformation,\r
+      sizeof(mDefaultMemoryTypeInformation)\r
+      );\r
+  } else {\r
+    //\r
+    // Create Memory Type Information HOB\r
+    //\r
+    BuildGuidDataHob (\r
+      &gEfiMemoryTypeInformationGuid,\r
+      MemoryData,\r
+      DataSize\r
+      );\r
+  }\r
+\r
   return Status;\r
 }\r
index a639c6c1aa4ce52694e669ad5b830a3c3aeccc69..0971c0ea29d5753e4c6d0b3b9d22cd79f34c24f8 100644 (file)
 \r
 [Ppis]\r
   gPeiNtAutoScanPpiGuid                         # PPI ALWAYS_CONSUMED\r
+  gEfiPeiReadOnlyVariable2PpiGuid               # PPI ALWAYS_CONSUMED\r
 \r
-[depex]\r
-  gPeiNtAutoScanPpiGuid AND gEfiPeiMasterBootModePpiGuid\r
+[Guids]\r
+  gEfiMemoryTypeInformationGuid\r
+  \r
+[Depex]\r
+  gPeiNtAutoScanPpiGuid AND gEfiPeiMasterBootModePpiGuid AND gEfiPeiReadOnlyVariable2PpiGuid\r