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