]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/Common/FvLib.h
7815baae3ffa7513cffbfe0d5bbfefe404389762
[mirror_edk2.git] / BaseTools / Source / C / Common / FvLib.h
1 /** @file
2
3 Copyright (c) 2004 - 2008, 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 /*++
94
95 Routine Description:
96
97 Verify the current pointer points to a FFS file header.
98
99 Arguments:
100
101 FfsHeader Pointer to an alleged FFS file.
102
103 Returns:
104
105 EFI_SUCCESS The Ffs header is valid.
106 EFI_NOT_FOUND This "file" is the beginning of free space.
107 EFI_VOLUME_CORRUPTED The Ffs header is not valid.
108
109 --*/
110 UINT32
111 GetLength (
112 UINT8 *ThreeByteLength
113 )
114 ;
115
116 /*++
117
118 Routine Description:
119
120 Converts a three byte length value into a UINT32.
121
122 Arguments:
123
124 ThreeByteLength Pointer to the first of the 3 byte length.
125
126 Returns:
127
128 UINT32 Size of the section
129
130 --*/
131 EFI_STATUS
132 GetErasePolarity (
133 OUT BOOLEAN *ErasePolarity
134 )
135 ;
136
137 /*++
138
139 Routine Description:
140
141 This function returns with the FV erase polarity. If the erase polarity
142 for a bit is 1, the function return TRUE.
143
144 Arguments:
145
146 ErasePolarity A pointer to the erase polarity.
147
148 Returns:
149
150 EFI_SUCCESS The function completed successfully.
151 EFI_INVALID_PARAMETER One of the input parameters was invalid.
152
153 --*/
154 UINT8
155 GetFileState (
156 IN BOOLEAN ErasePolarity,
157 IN EFI_FFS_FILE_HEADER *FfsHeader
158 )
159 ;
160
161 /*++
162
163 Routine Description:
164
165 This function returns a the highest state bit in the FFS that is set.
166 It in no way validate the FFS file.
167
168 Arguments:
169
170 ErasePolarity The erase polarity for the file state bits.
171 FfsHeader Pointer to a FFS file.
172
173 Returns:
174
175 UINT8 The hightest set state of the file.
176
177 --*/
178 #endif