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