]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - EdkNt32Pkg/Pei/FirmwareVolume/WinntFwh.c
removed unnecessary name space declarations in some top level elements
[mirror_edk2.git] / EdkNt32Pkg / Pei / FirmwareVolume / WinntFwh.c
... / ...
CommitLineData
1/*++\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 WinNtFwh.c\r
14 \r
15Abstract:\r
16 PEIM to abstract construction of firmware volume in a Windows NT environment.\r
17\r
18Revision History\r
19\r
20--*/\r
21\r
22\r
23#include <FlashLayout.h>\r
24\r
25\r
26EFI_STATUS\r
27EFIAPI\r
28PeimInitializeWinNtFwh (\r
29 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
30 IN EFI_PEI_SERVICES **PeiServices\r
31 )\r
32/*++\r
33\r
34Routine Description:\r
35 Perform a call-back into the SEC simulator to get address of the Firmware Hub\r
36\r
37Arguments:\r
38 FfsHeader - Ffs Header availible to every PEIM\r
39 PeiServices - General purpose services available to every PEIM.\r
40 \r
41Returns:\r
42 None\r
43\r
44--*/\r
45{\r
46 EFI_STATUS Status;\r
47 EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
48 NT_FWH_PPI *FwhPpi;\r
49 EFI_PHYSICAL_ADDRESS FdBase;\r
50 EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r
51 UINT64 FdSize;\r
52 UINTN Index;\r
53\r
54 DEBUG ((EFI_D_ERROR, "NT 32 Firmware Volume PEIM Loaded\n"));\r
55\r
56 //\r
57 // Get the Fwh Information PPI\r
58 //\r
59 Status = (**PeiServices).LocatePpi (\r
60 PeiServices,\r
61 &gNtFwhPpiGuid, // GUID\r
62 0, // INSTANCE\r
63 &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
64 &FwhPpi // PPI\r
65 );\r
66 ASSERT_EFI_ERROR (Status);\r
67\r
68 Index = 0;\r
69 do {\r
70 //\r
71 // Get information about all the FD's in the system\r
72 //\r
73 Status = FwhPpi->NtFwh (Index, &FdBase, &FdSize);\r
74 if (!EFI_ERROR (Status)) {\r
75 //\r
76 // Assume the FD starts with an FV header\r
77 //\r
78 FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FdBase;\r
79\r
80 //\r
81 // Make an FV Hob for the first FV in the FD\r
82 //\r
83 BuildFvHob (FdBase, FvHeader->FvLength);\r
84\r
85 if (Index == 0) {\r
86 //\r
87 // Assume the first FD was produced by the NT32.DSC\r
88 // All these strange offests are needed to keep in\r
89 // sync with the FlashMap and NT32.dsc file\r
90 //\r
91 BuildResourceDescriptorHob (\r
92 EFI_RESOURCE_FIRMWARE_DEVICE,\r
93 (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),\r
94 FdBase,\r
95 (FvHeader->FvLength + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH)\r
96 );\r
97\r
98 //\r
99 // Hard code the address of the spare block and variable services.\r
100 // Assume it's a hard coded offset from FV0 in FD0.\r
101 //\r
102 FdBase = FdBase + EFI_WINNT_RUNTIME_UPDATABLE_OFFSET;\r
103 FdSize = EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH;\r
104\r
105 BuildFvHob (FdBase, FdSize);\r
106 } else {\r
107 //\r
108 // For other FD's just map them in.\r
109 //\r
110 BuildResourceDescriptorHob (\r
111 EFI_RESOURCE_FIRMWARE_DEVICE,\r
112 (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),\r
113 FdBase,\r
114 FdSize\r
115 );\r
116 }\r
117 }\r
118\r
119 Index++;\r
120 } while (!EFI_ERROR (Status));\r
121\r
122 return Status;\r
123}\r