]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - Nt32Pkg/FvbServicesRuntimeDxe/FvbInfo.c
Back the wrong check in for MdeModulePkg.dsc.
[mirror_edk2.git] / Nt32Pkg / FvbServicesRuntimeDxe / FvbInfo.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\r
14 FvbInfo.c\r
15\r
16Abstract:\r
17\r
18 Defines data structure that is the volume header found.These data is intent\r
19 to decouple FVB driver with FV header.\r
20\r
21--*/\r
22\r
23//\r
24// The package level header files this module uses\r
25//\r
26#include <PiDxe.h>\r
27#include <WinNtDxe.h>\r
28//\r
29// The protocols, PPI and GUID defintions for this module\r
30//\r
31#include <Guid/EventGroup.h>\r
32#include <Guid/FirmwareFileSystem2.h>\r
33#include <Guid/SystemNvDataGuid.h>\r
34#include <Protocol/FvbExtension.h>\r
35#include <Protocol/FirmwareVolumeBlock.h>\r
36#include <Guid/AlternateFvBlock.h>\r
37#include <Protocol/DevicePath.h>\r
38//\r
39// The Library classes this module consumes\r
40//\r
41#include <Library/UefiLib.h>\r
42#include <Library/UefiDriverEntryPoint.h>\r
43#include <Library/BaseLib.h>\r
44#include <Library/DxeServicesTableLib.h>\r
45#include <Library/UefiRuntimeLib.h>\r
46#include <Library/DebugLib.h>\r
47#include <Library/HobLib.h>\r
48#include <Library/BaseMemoryLib.h>\r
49#include <Library/MemoryAllocationLib.h>\r
50#include <Library/UefiBootServicesTableLib.h>\r
51#include <Library/PcdLib.h>\r
52\r
53typedef struct {\r
54 UINT64 FvLength;\r
55 EFI_FIRMWARE_VOLUME_HEADER FvbInfo;\r
56 //\r
57 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0\r
58 //\r
59 EFI_FV_BLOCK_MAP_ENTRY End[1];\r
60} EFI_FVB_MEDIA_INFO;\r
61\r
62EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {\r
63 //\r
64 // Recovery BOIS FVB\r
65 //\r
66 {\r
67 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),\r
68 {\r
69 {\r
70 0,\r
71 }, // ZeroVector[16]\r
72 EFI_FIRMWARE_FILE_SYSTEM2_GUID,\r
73 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),\r
74 EFI_FVH_SIGNATURE,\r
75 EFI_FVB2_READ_ENABLED_CAP |\r
76 EFI_FVB2_READ_STATUS |\r
77 EFI_FVB2_WRITE_ENABLED_CAP |\r
78 EFI_FVB2_WRITE_STATUS |\r
79 EFI_FVB2_ERASE_POLARITY,\r
80 sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),\r
81 0, // CheckSum\r
82 0, // ExtHeaderOffset\r
83 {\r
84 0,\r
85 }, // Reserved[1]\r
86 1, // Revision\r
87 {\r
88 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
89 FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
90 }\r
91 },\r
92 {\r
93 0,\r
94 0\r
95 }\r
96 },\r
97 //\r
98 // Systen NvStorage FVB\r
99 //\r
100 {\r
101 FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
102 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
103 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
104 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),\r
105 {\r
106 {\r
107 0,\r
108 }, // ZeroVector[16]\r
109 EFI_SYSTEM_NV_DATA_HOB_GUID,\r
110 FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
111 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
112 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
113 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),\r
114 EFI_FVH_SIGNATURE,\r
115 EFI_FVB2_READ_ENABLED_CAP |\r
116 EFI_FVB2_READ_STATUS |\r
117 EFI_FVB2_WRITE_ENABLED_CAP |\r
118 EFI_FVB2_WRITE_STATUS |\r
119 EFI_FVB2_ERASE_POLARITY,\r
120 sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),\r
121 0, // CheckSum\r
122 0, // ExtHeaderOffset\r
123 {\r
124 0,\r
125 }, // Reserved[1]\r
126 1, // Revision\r
127 {\r
128 (FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
129 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
130 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
131 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
132 FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
133 }\r
134 },\r
135 {\r
136 0,\r
137 0\r
138 }\r
139 }\r
140};\r
141\r
142EFI_STATUS\r
143GetFvbInfo (\r
144 IN UINT64 FvLength,\r
145 OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo\r
146 )\r
147{\r
148 UINTN Index;\r
149\r
150 for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {\r
151 if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {\r
152 *FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;\r
153 return EFI_SUCCESS;\r
154 }\r
155 }\r
156\r
157 return EFI_NOT_FOUND;\r
158}\r