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