]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - Nt32Pkg/WinNtAutoScanPei/WinNtAutoScan.c
Remove BaseMemoryTest PPI and related producers and consumers.
[mirror_edk2.git] / Nt32Pkg / WinNtAutoScanPei / WinNtAutoScan.c
... / ...
CommitLineData
1/**@file\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13 WinNtAutoscan.c\r
14\r
15Abstract:\r
16 This PEIM to abstract memory auto-scan in a Windows NT environment.\r
17\r
18Revision History\r
19\r
20**/\r
21\r
22//\r
23// The package level header files this module uses\r
24//\r
25#include <PiPei.h>\r
26#include <WinNtPeim.h>\r
27//\r
28// The protocols, PPI and GUID defintions for this module\r
29//\r
30#include <Ppi/NtAutoscan.h>\r
31//\r
32// The Library classes this module consumes\r
33//\r
34#include <Library/DebugLib.h>\r
35#include <Library/PeimEntryPoint.h>\r
36#include <Library/HobLib.h>\r
37#include <Library/PeiServicesLib.h>\r
38\r
39EFI_STATUS\r
40EFIAPI\r
41PeimInitializeWinNtAutoScan (\r
42 IN EFI_PEI_FILE_HANDLE FileHandle,\r
43 IN CONST EFI_PEI_SERVICES **PeiServices\r
44 )\r
45/*++\r
46\r
47Routine Description:\r
48 Perform a call-back into the SEC simulator to get a memory value\r
49\r
50Arguments:\r
51 FfsHeader - General purpose data available to every PEIM\r
52 PeiServices - General purpose services available to every PEIM.\r
53 \r
54Returns:\r
55 None\r
56\r
57--*/\r
58{\r
59 EFI_STATUS Status;\r
60 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
61 PEI_NT_AUTOSCAN_PPI *PeiNtService;\r
62 UINT64 MemorySize;\r
63 EFI_PHYSICAL_ADDRESS MemoryBase;\r
64 UINTN Index;\r
65 EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;\r
66\r
67\r
68 DEBUG ((EFI_D_ERROR, "NT 32 Autoscan PEIM Loaded\n"));\r
69\r
70 //\r
71 // Get the PEI NT Autoscan PPI\r
72 //\r
73 Status = PeiServicesLocatePpi (\r
74 &gPeiNtAutoScanPpiGuid, // GUID\r
75 0, // INSTANCE\r
76 &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
77 (VOID**)&PeiNtService // PPI\r
78 );\r
79 ASSERT_EFI_ERROR (Status);\r
80\r
81 Index = 0;\r
82 do {\r
83 Status = PeiNtService->NtAutoScan (Index, &MemoryBase, &MemorySize);\r
84 if (!EFI_ERROR (Status)) {\r
85 Attributes =\r
86 (\r
87 EFI_RESOURCE_ATTRIBUTE_PRESENT |\r
88 EFI_RESOURCE_ATTRIBUTE_INITIALIZED |\r
89 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |\r
90 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |\r
91 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |\r
92 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE\r
93 );\r
94\r
95 if (Index == 0) {\r
96 //\r
97 // Register the memory with the PEI Core\r
98 //\r
99 Status = PeiServicesInstallPeiMemory (MemoryBase, MemorySize);\r
100 ASSERT_EFI_ERROR (Status);\r
101\r
102 Attributes |= EFI_RESOURCE_ATTRIBUTE_TESTED;\r
103 }\r
104 \r
105 BuildResourceDescriptorHob (\r
106 EFI_RESOURCE_SYSTEM_MEMORY,\r
107 Attributes,\r
108 MemoryBase,\r
109 MemorySize\r
110 );\r
111 }\r
112 Index++;\r
113 } while (!EFI_ERROR (Status));\r
114\r
115 //\r
116 // Build the CPU hob with 36-bit addressing and 16-bits of IO space.\r
117 //\r
118 BuildCpuHob (36, 16);\r
119 \r
120 return Status;\r
121}\r