]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
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 | |
ce53a8c3 | 28 | #include <string.h>\r |
29 | \r | |
30 | #include <Common/UefiBaseTypes.h>\r | |
878ddf1f | 31 | #include <Common/EfiImage.h>\r |
32 | #include <Common/FirmwareVolumeImageFormat.h>\r | |
33 | #include <Common/FirmwareFileSystem.h>\r | |
34 | #include <Common/FirmwareVolumeHeader.h>\r | |
ce53a8c3 | 35 | #include <Common/MultiPhase.h>\r |
878ddf1f | 36 | \r |
37 | EFI_STATUS\r | |
38 | InitializeFvLib (\r | |
39 | IN VOID *Fv,\r | |
40 | IN UINT32 FvLength\r | |
41 | )\r | |
42 | ;\r | |
43 | \r | |
44 | EFI_STATUS\r | |
45 | GetFvHeader (\r | |
46 | OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader,\r | |
47 | OUT UINT32 *FvLength\r | |
48 | )\r | |
49 | ;\r | |
50 | \r | |
51 | EFI_STATUS\r | |
52 | GetNextFile (\r | |
53 | IN EFI_FFS_FILE_HEADER *CurrentFile,\r | |
54 | OUT EFI_FFS_FILE_HEADER **NextFile\r | |
55 | )\r | |
56 | ;\r | |
57 | \r | |
58 | EFI_STATUS\r | |
59 | GetFileByName (\r | |
60 | IN EFI_GUID *FileName,\r | |
61 | OUT EFI_FFS_FILE_HEADER **File\r | |
62 | )\r | |
63 | ;\r | |
64 | \r | |
65 | EFI_STATUS\r | |
66 | GetFileByType (\r | |
67 | IN EFI_FV_FILETYPE FileType,\r | |
68 | IN UINTN Instance,\r | |
69 | OUT EFI_FFS_FILE_HEADER **File\r | |
70 | )\r | |
71 | ;\r | |
72 | \r | |
73 | EFI_STATUS\r | |
74 | GetSectionByType (\r | |
75 | IN EFI_FFS_FILE_HEADER *File,\r | |
76 | IN EFI_SECTION_TYPE SectionType,\r | |
77 | IN UINTN Instance,\r | |
78 | OUT EFI_FILE_SECTION_POINTER *Section\r | |
79 | )\r | |
80 | ;\r | |
81 | //\r | |
82 | // will not parse compressed sections\r | |
83 | //\r | |
84 | EFI_STATUS\r | |
85 | VerifyFv (\r | |
86 | IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r | |
87 | )\r | |
88 | ;\r | |
89 | \r | |
90 | EFI_STATUS\r | |
91 | VerifyFfsFile (\r | |
92 | IN EFI_FFS_FILE_HEADER *FfsHeader\r | |
93 | )\r | |
94 | ;\r | |
95 | \r | |
96 | /*++\r | |
97 | \r | |
98 | Routine Description:\r | |
99 | \r | |
100 | Verify the current pointer points to a FFS file header.\r | |
101 | \r | |
102 | Arguments:\r | |
103 | \r | |
104 | FfsHeader Pointer to an alleged FFS file.\r | |
105 | \r | |
106 | Returns:\r | |
107 | \r | |
108 | EFI_SUCCESS The Ffs header is valid.\r | |
109 | EFI_NOT_FOUND This "file" is the beginning of free space.\r | |
110 | EFI_VOLUME_CORRUPTED The Ffs header is not valid.\r | |
111 | \r | |
112 | --*/\r | |
113 | UINT32\r | |
114 | GetLength (\r | |
115 | UINT8 *ThreeByteLength\r | |
116 | )\r | |
117 | ;\r | |
118 | \r | |
119 | /*++\r | |
120 | \r | |
121 | Routine Description:\r | |
122 | \r | |
123 | Converts a three byte length value into a UINT32.\r | |
124 | \r | |
125 | Arguments:\r | |
126 | \r | |
127 | ThreeByteLength Pointer to the first of the 3 byte length.\r | |
128 | \r | |
129 | Returns:\r | |
130 | \r | |
131 | UINT32 Size of the section\r | |
132 | \r | |
133 | --*/\r | |
134 | EFI_STATUS\r | |
135 | GetErasePolarity (\r | |
136 | OUT BOOLEAN *ErasePolarity\r | |
137 | )\r | |
138 | ;\r | |
139 | \r | |
140 | /*++\r | |
141 | \r | |
142 | Routine Description:\r | |
143 | \r | |
144 | This function returns with the FV erase polarity. If the erase polarity\r | |
145 | for a bit is 1, the function return TRUE.\r | |
146 | \r | |
147 | Arguments:\r | |
148 | \r | |
149 | ErasePolarity A pointer to the erase polarity.\r | |
150 | \r | |
151 | Returns:\r | |
152 | \r | |
153 | EFI_SUCCESS The function completed successfully.\r | |
154 | EFI_INVALID_PARAMETER One of the input parameters was invalid.\r | |
155 | \r | |
156 | --*/\r | |
157 | UINT8\r | |
158 | GetFileState (\r | |
159 | IN BOOLEAN ErasePolarity,\r | |
160 | IN EFI_FFS_FILE_HEADER *FfsHeader\r | |
161 | )\r | |
162 | ;\r | |
163 | \r | |
164 | /*++\r | |
165 | \r | |
166 | Routine Description:\r | |
167 | \r | |
168 | This function returns a the highest state bit in the FFS that is set.\r | |
169 | It in no way validate the FFS file.\r | |
170 | \r | |
171 | Arguments:\r | |
172 | \r | |
173 | ErasePolarity The erase polarity for the file state bits.\r | |
174 | FfsHeader Pointer to a FFS file.\r | |
175 | \r | |
176 | Returns:\r | |
177 | \r | |
178 | UINT8 The hightest set state of the file.\r | |
179 | \r | |
180 | --*/\r | |
181 | #endif\r |