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