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