/**@file\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
+Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
http://opensource.org/licenses/bsd-license.php \r
// 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
#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
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
// 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