]>
Commit | Line | Data |
---|---|---|
30fdf114 | 1 | /** @file\r |
97fa0ee9 YL |
2 | These functions assist in parsing and manipulating a Firmware Volume.\r |
3 | \r | |
4 | Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
40d841f6 | 5 | This program and the accompanying materials \r |
30fdf114 LG |
6 | are licensed and made available under the terms and conditions of the BSD License \r |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
30fdf114 LG |
13 | **/\r |
14 | \r | |
15 | #ifndef _EFI_FV_LIB_H\r | |
16 | #define _EFI_FV_LIB_H\r | |
17 | \r | |
18 | //\r | |
19 | // Include files\r | |
20 | //\r | |
21 | #include <string.h>\r | |
22 | \r | |
23 | #include <Common/UefiBaseTypes.h>\r | |
24 | #include <Common/PiFirmwareFile.h>\r | |
25 | #include <Common/PiFirmwareVolume.h>\r | |
26 | \r | |
27 | EFI_STATUS\r | |
28 | InitializeFvLib (\r | |
29 | IN VOID *Fv,\r | |
30 | IN UINT32 FvLength\r | |
31 | )\r | |
32 | ;\r | |
33 | \r | |
34 | EFI_STATUS\r | |
35 | GetFvHeader (\r | |
36 | OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader,\r | |
37 | OUT UINT32 *FvLength\r | |
38 | )\r | |
39 | ;\r | |
40 | \r | |
41 | EFI_STATUS\r | |
42 | GetNextFile (\r | |
43 | IN EFI_FFS_FILE_HEADER *CurrentFile,\r | |
44 | OUT EFI_FFS_FILE_HEADER **NextFile\r | |
45 | )\r | |
46 | ;\r | |
47 | \r | |
48 | EFI_STATUS\r | |
49 | GetFileByName (\r | |
50 | IN EFI_GUID *FileName,\r | |
51 | OUT EFI_FFS_FILE_HEADER **File\r | |
52 | )\r | |
53 | ;\r | |
54 | \r | |
55 | EFI_STATUS\r | |
56 | GetFileByType (\r | |
57 | IN EFI_FV_FILETYPE FileType,\r | |
58 | IN UINTN Instance,\r | |
59 | OUT EFI_FFS_FILE_HEADER **File\r | |
60 | )\r | |
61 | ;\r | |
62 | \r | |
63 | EFI_STATUS\r | |
64 | GetSectionByType (\r | |
65 | IN EFI_FFS_FILE_HEADER *File,\r | |
66 | IN EFI_SECTION_TYPE SectionType,\r | |
67 | IN UINTN Instance,\r | |
68 | OUT EFI_FILE_SECTION_POINTER *Section\r | |
69 | )\r | |
70 | ;\r | |
71 | //\r | |
72 | // will not parse compressed sections\r | |
73 | //\r | |
74 | EFI_STATUS\r | |
75 | VerifyFv (\r | |
76 | IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r | |
77 | )\r | |
78 | ;\r | |
79 | \r | |
80 | EFI_STATUS\r | |
81 | VerifyFfsFile (\r | |
82 | IN EFI_FFS_FILE_HEADER *FfsHeader\r | |
83 | )\r | |
84 | ;\r | |
85 | \r | |
e8a47801 LG |
86 | UINT32\r |
87 | GetFfsFileLength (\r | |
88 | EFI_FFS_FILE_HEADER *FfsHeader\r | |
89 | )\r | |
90 | ;\r | |
91 | \r | |
92 | UINT32\r | |
93 | GetSectionFileLength (\r | |
94 | EFI_COMMON_SECTION_HEADER *SectionHeader\r | |
95 | )\r | |
96 | ;\r | |
97 | \r | |
98 | UINT32\r | |
99 | GetFfsHeaderLength(\r | |
100 | IN EFI_FFS_FILE_HEADER *FfsHeader\r | |
101 | )\r | |
102 | ;\r | |
103 | \r | |
104 | UINT32\r | |
105 | GetSectionHeaderLength(\r | |
106 | IN EFI_COMMON_SECTION_HEADER *SectionHeader\r | |
107 | )\r | |
108 | ;\r | |
109 | \r | |
30fdf114 LG |
110 | /*++\r |
111 | \r | |
112 | Routine Description:\r | |
113 | \r | |
114 | Verify the current pointer points to a FFS file header.\r | |
115 | \r | |
116 | Arguments:\r | |
117 | \r | |
118 | FfsHeader Pointer to an alleged FFS file.\r | |
119 | \r | |
120 | Returns:\r | |
121 | \r | |
122 | EFI_SUCCESS The Ffs header is valid.\r | |
123 | EFI_NOT_FOUND This "file" is the beginning of free space.\r | |
124 | EFI_VOLUME_CORRUPTED The Ffs header is not valid.\r | |
125 | \r | |
126 | --*/\r | |
127 | UINT32\r | |
128 | GetLength (\r | |
129 | UINT8 *ThreeByteLength\r | |
130 | )\r | |
131 | ;\r | |
132 | \r | |
133 | /*++\r | |
134 | \r | |
135 | Routine Description:\r | |
136 | \r | |
137 | Converts a three byte length value into a UINT32.\r | |
138 | \r | |
139 | Arguments:\r | |
140 | \r | |
141 | ThreeByteLength Pointer to the first of the 3 byte length.\r | |
142 | \r | |
143 | Returns:\r | |
144 | \r | |
145 | UINT32 Size of the section\r | |
146 | \r | |
147 | --*/\r | |
148 | EFI_STATUS\r | |
149 | GetErasePolarity (\r | |
150 | OUT BOOLEAN *ErasePolarity\r | |
151 | )\r | |
152 | ;\r | |
153 | \r | |
154 | /*++\r | |
155 | \r | |
156 | Routine Description:\r | |
157 | \r | |
158 | This function returns with the FV erase polarity. If the erase polarity\r | |
159 | for a bit is 1, the function return TRUE.\r | |
160 | \r | |
161 | Arguments:\r | |
162 | \r | |
163 | ErasePolarity A pointer to the erase polarity.\r | |
164 | \r | |
165 | Returns:\r | |
166 | \r | |
167 | EFI_SUCCESS The function completed successfully.\r | |
168 | EFI_INVALID_PARAMETER One of the input parameters was invalid.\r | |
169 | \r | |
170 | --*/\r | |
171 | UINT8\r | |
172 | GetFileState (\r | |
173 | IN BOOLEAN ErasePolarity,\r | |
174 | IN EFI_FFS_FILE_HEADER *FfsHeader\r | |
175 | )\r | |
176 | ;\r | |
177 | \r | |
178 | /*++\r | |
179 | \r | |
180 | Routine Description:\r | |
181 | \r | |
182 | This function returns a the highest state bit in the FFS that is set.\r | |
183 | It in no way validate the FFS file.\r | |
184 | \r | |
185 | Arguments:\r | |
186 | \r | |
187 | ErasePolarity The erase polarity for the file state bits.\r | |
188 | FfsHeader Pointer to a FFS file.\r | |
189 | \r | |
190 | Returns:\r | |
191 | \r | |
192 | UINT8 The hightest set state of the file.\r | |
193 | \r | |
194 | --*/\r | |
195 | #endif\r |