summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-14 23:29:06 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-14 23:29:06 +0000
commit57b3102955693be2d3e44575b1d98c13a8a535e7 (patch)
treeeb227e79119400a6ad0d247e4fcb8a115e518277
parentea3cfce6a5b3b32a7214ae469fa4cdd2f8d96546 (diff)
downloadedk2-platforms-57b3102955693be2d3e44575b1d98c13a8a535e7.tar.xz
Update NT32 to produce the gEfiMemoryTypeInformation HOB
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10582 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c58
-rw-r--r--Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf8
2 files changed, 63 insertions, 3 deletions
diff --git a/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c b/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c
index cba5d936bd..90a97b9767 100644
--- a/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c
+++ b/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c
@@ -28,6 +28,10 @@ Revision History
// The protocols, PPI and GUID defintions for this module
//
#include <Ppi/NtAutoscan.h>
+#include <Ppi/ReadOnlyVariable2.h>
+
+#include <Guid/MemoryTypeInformation.h>
+
//
// The Library classes this module consumes
//
@@ -36,6 +40,15 @@ Revision History
#include <Library/HobLib.h>
#include <Library/PeiServicesLib.h>
+EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
+ { EfiReservedMemoryType, 0x0004 },
+ { EfiRuntimeServicesCode, 0x0040 },
+ { EfiRuntimeServicesData, 0x0040 },
+ { EfiBootServicesCode, 0x0300 },
+ { EfiBootServicesData, 0x1000 },
+ { EfiMaxMemoryType, 0 }
+};
+
EFI_STATUS
EFIAPI
PeimInitializeWinNtAutoScan (
@@ -63,6 +76,9 @@ Returns:
EFI_PHYSICAL_ADDRESS MemoryBase;
UINTN Index;
EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
+ EFI_PEI_READ_ONLY_VARIABLE2_PPI *Variable;
+ UINTN DataSize;
+ EFI_MEMORY_TYPE_INFORMATION MemoryData [EfiMaxMemoryType + 1];
DEBUG ((EFI_D_ERROR, "NT 32 Autoscan PEIM Loaded\n"));
@@ -116,6 +132,46 @@ Returns:
// Build the CPU hob with 36-bit addressing and 16-bits of IO space.
//
BuildCpuHob (36, 16);
-
+
+ //
+ // Build GUIDed Hob that contains the Memory Type Information array
+ //
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiReadOnlyVariable2PpiGuid,
+ 0,
+ NULL,
+ (VOID **)&Variable
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DataSize = sizeof (MemoryData);
+ Status = Variable->GetVariable (
+ Variable,
+ EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
+ &gEfiMemoryTypeInformationGuid,
+ NULL,
+ &DataSize,
+ &MemoryData
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // Create Memory Type Information HOB
+ //
+ BuildGuidDataHob (
+ &gEfiMemoryTypeInformationGuid,
+ mDefaultMemoryTypeInformation,
+ sizeof(mDefaultMemoryTypeInformation)
+ );
+ } else {
+ //
+ // Create Memory Type Information HOB
+ //
+ BuildGuidDataHob (
+ &gEfiMemoryTypeInformationGuid,
+ MemoryData,
+ DataSize
+ );
+ }
+
return Status;
}
diff --git a/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf b/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf
index a639c6c1aa..0971c0ea29 100644
--- a/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf
+++ b/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf
@@ -46,6 +46,10 @@
[Ppis]
gPeiNtAutoScanPpiGuid # PPI ALWAYS_CONSUMED
+ gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
-[depex]
- gPeiNtAutoScanPpiGuid AND gEfiPeiMasterBootModePpiGuid
+[Guids]
+ gEfiMemoryTypeInformationGuid
+
+[Depex]
+ gPeiNtAutoScanPpiGuid AND gEfiPeiMasterBootModePpiGuid AND gEfiPeiReadOnlyVariable2PpiGuid