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