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.
23 // The package level header files this module uses
26 #include <WinNtPeim.h>
28 // The protocols, PPI and GUID defintions for this module
30 #include <Ppi/NtAutoscan.h>
32 // The Library classes this module consumes
34 #include <Library/DebugLib.h>
35 #include <Library/PeimEntryPoint.h>
36 #include <Library/HobLib.h>
37 #include <Library/PeiServicesLib.h>
41 PeimInitializeWinNtAutoScan (
42 IN EFI_PEI_FILE_HANDLE FileHandle
,
43 IN CONST EFI_PEI_SERVICES
**PeiServices
48 Perform a call-back into the SEC simulator to get a memory value
51 FfsHeader - General purpose data available to every PEIM
52 PeiServices - General purpose services available to every PEIM.
60 EFI_PEI_PPI_DESCRIPTOR
*PpiDescriptor
;
61 PEI_NT_AUTOSCAN_PPI
*PeiNtService
;
63 EFI_PHYSICAL_ADDRESS MemoryBase
;
65 EFI_RESOURCE_ATTRIBUTE_TYPE Attributes
;
68 DEBUG ((EFI_D_ERROR
, "NT 32 Autoscan PEIM Loaded\n"));
71 // Get the PEI NT Autoscan PPI
73 Status
= PeiServicesLocatePpi (
74 &gPeiNtAutoScanPpiGuid
, // GUID
76 &PpiDescriptor
, // EFI_PEI_PPI_DESCRIPTOR
77 (VOID
**)&PeiNtService
// PPI
79 ASSERT_EFI_ERROR (Status
);
83 Status
= PeiNtService
->NtAutoScan (Index
, &MemoryBase
, &MemorySize
);
84 if (!EFI_ERROR (Status
)) {
87 EFI_RESOURCE_ATTRIBUTE_PRESENT
|
88 EFI_RESOURCE_ATTRIBUTE_INITIALIZED
|
89 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE
|
90 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE
|
91 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE
|
92 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
97 // Register the memory with the PEI Core
99 Status
= PeiServicesInstallPeiMemory (MemoryBase
, MemorySize
);
100 ASSERT_EFI_ERROR (Status
);
102 Attributes
|= EFI_RESOURCE_ATTRIBUTE_TESTED
;
105 BuildResourceDescriptorHob (
106 EFI_RESOURCE_SYSTEM_MEMORY
,
113 } while (!EFI_ERROR (Status
));
116 // Build the CPU hob with 36-bit addressing and 16-bits of IO space.
118 BuildCpuHob (36, 16);