3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 This PEIM to abstract memory auto-scan in a Windows NT environment.
24 PeimInitializeWinNtAutoScan (
25 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
26 IN EFI_PEI_SERVICES
**PeiServices
31 Perform a call-back into the SEC simulator to get a memory value
34 FfsHeader - General purpose data available to every PEIM
35 PeiServices - General purpose services available to every PEIM.
43 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
44 PEI_NT_AUTOSCAN_PPI
*PeiNtService
;
46 EFI_PHYSICAL_ADDRESS MemoryBase
;
47 PEI_BASE_MEMORY_TEST_PPI
*MemoryTestPpi
;
48 EFI_PHYSICAL_ADDRESS ErrorAddress
;
50 EFI_RESOURCE_ATTRIBUTE_TYPE Attributes
;
53 DEBUG ((EFI_D_ERROR
, "NT 32 Autoscan PEIM Loaded\n"));
56 // Get the PEI NT Autoscan PPI
58 Status
= (**PeiServices
).LocatePpi (
60 &gPeiNtAutoScanPpiGuid
, // GUID
62 &PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
65 ASSERT_EFI_ERROR (Status
);
68 // Get the Memory Test PPI
70 Status
= (**PeiServices
).LocatePpi (
72 &gPeiBaseMemoryTestPpiGuid
,
77 ASSERT_EFI_ERROR (Status
);
81 Status
= PeiNtService
->NtAutoScan (Index
, &MemoryBase
, &MemorySize
);
82 if (!EFI_ERROR (Status
)) {
85 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
86 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
|
87 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
88 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE
|
89 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE
|
90 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
95 // For the first area register it as PEI tested memory
97 Status
= MemoryTestPpi
->BaseMemoryTest (
105 ASSERT_EFI_ERROR (Status
);
108 // Register the "tested" memory with the PEI Core
110 Status
= (**PeiServices
).InstallPeiMemory (PeiServices
, MemoryBase
, MemorySize
);
111 ASSERT_EFI_ERROR (Status
);
113 Attributes
|= EFI_RESOURCE_ATTRIBUTE_TESTED
;
116 BuildResourceDescriptorHob (
117 EFI_RESOURCE_SYSTEM_MEMORY
,
124 } while (!EFI_ERROR (Status
));
127 // Build the CPU hob with 36-bit addressing and 16-bits of IO space.
129 BuildCpuHob (36, 16);