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