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