]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Common/FvLib.h
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / Common / FvLib.h
CommitLineData
30fdf114 1/** @file\r
97fa0ee9 2These functions assist in parsing and manipulating a Firmware Volume.\r
f7496d71
LG
3\r
4Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
2e351cbe 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
30fdf114 6\r
30fdf114
LG
7**/\r
8\r
9#ifndef _EFI_FV_LIB_H\r
10#define _EFI_FV_LIB_H\r
11\r
12//\r
13// Include files\r
14//\r
15#include <string.h>\r
16\r
17#include <Common/UefiBaseTypes.h>\r
18#include <Common/PiFirmwareFile.h>\r
19#include <Common/PiFirmwareVolume.h>\r
20\r
21EFI_STATUS\r
22InitializeFvLib (\r
23 IN VOID *Fv,\r
24 IN UINT32 FvLength\r
25 )\r
26;\r
27\r
28EFI_STATUS\r
29GetFvHeader (\r
30 OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader,\r
31 OUT UINT32 *FvLength\r
32 )\r
33;\r
34\r
35EFI_STATUS\r
36GetNextFile (\r
37 IN EFI_FFS_FILE_HEADER *CurrentFile,\r
38 OUT EFI_FFS_FILE_HEADER **NextFile\r
39 )\r
40;\r
41\r
42EFI_STATUS\r
43GetFileByName (\r
44 IN EFI_GUID *FileName,\r
45 OUT EFI_FFS_FILE_HEADER **File\r
46 )\r
47;\r
48\r
49EFI_STATUS\r
50GetFileByType (\r
51 IN EFI_FV_FILETYPE FileType,\r
52 IN UINTN Instance,\r
53 OUT EFI_FFS_FILE_HEADER **File\r
54 )\r
55;\r
56\r
57EFI_STATUS\r
58GetSectionByType (\r
59 IN EFI_FFS_FILE_HEADER *File,\r
60 IN EFI_SECTION_TYPE SectionType,\r
61 IN UINTN Instance,\r
62 OUT EFI_FILE_SECTION_POINTER *Section\r
63 )\r
64;\r
65//\r
66// will not parse compressed sections\r
67//\r
68EFI_STATUS\r
69VerifyFv (\r
70 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
71 )\r
72;\r
73\r
74EFI_STATUS\r
75VerifyFfsFile (\r
76 IN EFI_FFS_FILE_HEADER *FfsHeader\r
77 )\r
78;\r
79\r
e8a47801
LG
80UINT32\r
81GetFfsFileLength (\r
82 EFI_FFS_FILE_HEADER *FfsHeader\r
83 )\r
84;\r
85\r
86UINT32\r
87GetSectionFileLength (\r
88 EFI_COMMON_SECTION_HEADER *SectionHeader\r
89 )\r
90;\r
91\r
92UINT32\r
93GetFfsHeaderLength(\r
94 IN EFI_FFS_FILE_HEADER *FfsHeader\r
95 )\r
96;\r
97\r
98UINT32\r
99GetSectionHeaderLength(\r
100 IN EFI_COMMON_SECTION_HEADER *SectionHeader\r
101 )\r
102;\r
103\r
30fdf114
LG
104/*++\r
105\r
106Routine Description:\r
107\r
108 Verify the current pointer points to a FFS file header.\r
109\r
110Arguments:\r
111\r
112 FfsHeader Pointer to an alleged FFS file.\r
113\r
114Returns:\r
115\r
116 EFI_SUCCESS The Ffs header is valid.\r
117 EFI_NOT_FOUND This "file" is the beginning of free space.\r
118 EFI_VOLUME_CORRUPTED The Ffs header is not valid.\r
119\r
120--*/\r
121UINT32\r
122GetLength (\r
123 UINT8 *ThreeByteLength\r
124 )\r
125;\r
126\r
127/*++\r
128\r
129Routine Description:\r
130\r
131 Converts a three byte length value into a UINT32.\r
132\r
133Arguments:\r
134\r
135 ThreeByteLength Pointer to the first of the 3 byte length.\r
136\r
137Returns:\r
138\r
139 UINT32 Size of the section\r
140\r
141--*/\r
142EFI_STATUS\r
143GetErasePolarity (\r
144 OUT BOOLEAN *ErasePolarity\r
145 )\r
146;\r
147\r
148/*++\r
149\r
150Routine Description:\r
151\r
152 This function returns with the FV erase polarity. If the erase polarity\r
153 for a bit is 1, the function return TRUE.\r
154\r
155Arguments:\r
156\r
157 ErasePolarity A pointer to the erase polarity.\r
158\r
159Returns:\r
160\r
161 EFI_SUCCESS The function completed successfully.\r
162 EFI_INVALID_PARAMETER One of the input parameters was invalid.\r
163\r
164--*/\r
165UINT8\r
166GetFileState (\r
167 IN BOOLEAN ErasePolarity,\r
168 IN EFI_FFS_FILE_HEADER *FfsHeader\r
169 )\r
170;\r
171\r
172/*++\r
173\r
174Routine Description:\r
175\r
176 This function returns a the highest state bit in the FFS that is set.\r
177 It in no way validate the FFS file.\r
178\r
179Arguments:\r
f7496d71 180\r
30fdf114
LG
181 ErasePolarity The erase polarity for the file state bits.\r
182 FfsHeader Pointer to a FFS file.\r
183\r
184Returns:\r
185\r
186 UINT8 The hightest set state of the file.\r
187\r
188--*/\r
189#endif\r