]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/FvbServicesRuntimeDxe/FvbInfo.c
Change 'WatchDog' to 'Watchdog' in FDF file.
[mirror_edk2.git] / Nt32Pkg / FvbServicesRuntimeDxe / FvbInfo.c
CommitLineData
6ae81428 1/**@file\r
55e6660f 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
6ae81428 21**/\r
55e6660f 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
55e6660f 34#include <Protocol/FirmwareVolumeBlock.h>\r
55e6660f 35#include <Protocol/DevicePath.h>\r
36//\r
37// The Library classes this module consumes\r
38//\r
39#include <Library/UefiLib.h>\r
40#include <Library/UefiDriverEntryPoint.h>\r
41#include <Library/BaseLib.h>\r
42#include <Library/DxeServicesTableLib.h>\r
43#include <Library/UefiRuntimeLib.h>\r
44#include <Library/DebugLib.h>\r
45#include <Library/HobLib.h>\r
46#include <Library/BaseMemoryLib.h>\r
47#include <Library/MemoryAllocationLib.h>\r
48#include <Library/UefiBootServicesTableLib.h>\r
6d3aa33e 49#include <Library/PcdLib.h>\r
55e6660f 50\r
51typedef struct {\r
52 UINT64 FvLength;\r
53 EFI_FIRMWARE_VOLUME_HEADER FvbInfo;\r
54 //\r
55 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0\r
56 //\r
57 EFI_FV_BLOCK_MAP_ENTRY End[1];\r
58} EFI_FVB_MEDIA_INFO;\r
59\r
55e6660f 60EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {\r
61 //\r
62 // Recovery BOIS FVB\r
63 //\r
64 {\r
6d3aa33e 65 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),\r
55e6660f 66 {\r
67 {\r
68 0,\r
69 }, // ZeroVector[16]\r
70 EFI_FIRMWARE_FILE_SYSTEM2_GUID,\r
6d3aa33e 71 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),\r
55e6660f 72 EFI_FVH_SIGNATURE,\r
73 EFI_FVB2_READ_ENABLED_CAP |\r
74 EFI_FVB2_READ_STATUS |\r
75 EFI_FVB2_WRITE_ENABLED_CAP |\r
76 EFI_FVB2_WRITE_STATUS |\r
77 EFI_FVB2_ERASE_POLARITY,\r
78 sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),\r
79 0, // CheckSum\r
80 0, // ExtHeaderOffset\r
81 {\r
82 0,\r
83 }, // Reserved[1]\r
fc5f0e3f 84 2, // Revision\r
55e6660f 85 {\r
6d3aa33e 86 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
87 FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
55e6660f 88 }\r
89 },\r
90 {\r
91 0,\r
92 0\r
93 }\r
94 },\r
95 //\r
96 // Systen NvStorage FVB\r
97 //\r
98 {\r
6d3aa33e 99 FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
100 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
101 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
102 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),\r
55e6660f 103 {\r
104 {\r
105 0,\r
106 }, // ZeroVector[16]\r
627abd57 107 EFI_SYSTEM_NV_DATA_FV_GUID,\r
6d3aa33e 108 FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
109 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
110 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
111 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),\r
55e6660f 112 EFI_FVH_SIGNATURE,\r
113 EFI_FVB2_READ_ENABLED_CAP |\r
114 EFI_FVB2_READ_STATUS |\r
115 EFI_FVB2_WRITE_ENABLED_CAP |\r
116 EFI_FVB2_WRITE_STATUS |\r
117 EFI_FVB2_ERASE_POLARITY,\r
118 sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),\r
119 0, // CheckSum\r
120 0, // ExtHeaderOffset\r
121 {\r
122 0,\r
123 }, // Reserved[1]\r
fc5f0e3f 124 2, // Revision\r
55e6660f 125 {\r
6d3aa33e 126 (FixedPcdGet32 (PcdFlashNvStorageVariableSize) +\r
127 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +\r
128 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +\r
129 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
130 FixedPcdGet32 (PcdWinNtFirmwareBlockSize),\r
55e6660f 131 }\r
132 },\r
133 {\r
134 0,\r
135 0\r
136 }\r
137 }\r
138};\r
139\r
140EFI_STATUS\r
141GetFvbInfo (\r
142 IN UINT64 FvLength,\r
143 OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo\r
144 )\r
145{\r
146 UINTN Index;\r
147\r
148 for (Index = 0; Index < sizeof (mPlatformFvbMediaInfo) / sizeof (EFI_FVB_MEDIA_INFO); Index += 1) {\r
149 if (mPlatformFvbMediaInfo[Index].FvLength == FvLength) {\r
150 *FvbInfo = &mPlatformFvbMediaInfo[Index].FvbInfo;\r
151 return EFI_SUCCESS;\r
152 }\r
153 }\r
154\r
155 return EFI_NOT_FOUND;\r
156}\r