summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Ppi/FirmwareVolume.h
blob: 3cafd0c00316c23eeebb7d6c656d18c6c9bcd2be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/* @file
  This file provides functions for accessing a memory-mapped firmware volume of a specific format.

  Copyright (c) 2006 - 2007, Intel Corporation                                                         
  All rights reserved. This program and the accompanying materials                          
  are licensed and made available under the terms and conditions of the BSD License         
  which accompanies this distribution.  The full text of the license may be found at        
  http://opensource.org/licenses/bsd-license.php                                            

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

  Module Name:  FirmwareVolume.h

  @par Revision Reference:
  This PPI is defined in PI.
  Version 1.00

**/

#ifndef __FIRMWARE_VOLUME_PPI_H__
#define __FIRMWARE_VOLUME_PPI_H__

//
// The GUID for this PPI is the same as the firmware volume format GUID.
// can be EFI_FIRMWARE_FILE_SYSTEM2_GUID or the GUID for a user-defined format. The
// EFI_FIRMWARE_FILE_SYSTEM2_GUID is the PI Firmware Volume format.
// 

typedef struct _EFI_PEI_FIRMWARE_VOLUME_PPI		EFI_PEI_FIRMWARE_VOLUME_PPI;


/**
  Create a volume handle from the information in the buffer. For
  memory-mapped firmware volumes, Buffer and BufferSize refer to
  the start of the firmware volume and the firmware volume size.
  For non memory-mapped firmware volumes, this points to a
  buffer which contains the necessary information for creating
  the firmware volume handle. Normally, these values are derived
  from the EFI_FIRMWARE_VOLUME_INFO_PPI.
  
  
  @param This 	      Points to this instance of the
                      EFI_PEI_FIRMWARE_VOLUME_PPI
  @param Buffer 			Points to the start of the buffer.
  @param BufferSize  	Size of the buffer.
  @param FvHandle 		Points to the returned firmware volume
                      handle. The firmware volume handle must
                      be unique within the system. 


  @retval EFI_SUCCESS 					Firmware volume handle.
  @retval EFI_VOLUME_CORRUPTED 	Volume was corrupt.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FV_PROCESS_FV) (
	IN CONST 	EFI_PEI_FIRMWARE_VOLUME_PPI *This,
	IN CONST	VOID 												*Buffer,
	IN CONST	UINTN 											BufferSize,
	OUT 			EFI_PEI_FV_HANDLE 					*FvHandle
);


/**
  Create a volume handle from the information in the buffer. For
  memory-mapped firmware volumes, Buffer and BufferSize refer to
  the start of the firmware volume and the firmware volume size.
  For non memory-mapped firmware volumes, this points to a
  buffer which contains the necessary information for creating
  the firmware volume handle. Normally, these values are derived
  from the EFI_FIRMWARE_VOLUME_INFO_PPI.
  
  
  @param This 	      Points to this instance of the
                      EFI_PEI_FIRMWARE_VOLUME_PPI
  @param Buffer 			Points to the start of the buffer.
  @param BufferSize  	Size of the buffer.
  @param FvHandle 		Points to the returned firmware volume
                      handle. The firmware volume handle must
                      be unique within the system. 


  @retval EFI_SUCCESS 					Firmware volume handle.
  @retval EFI_VOLUME_CORRUPTED 	Volume was corrupt.

**/

/**
  This service enables PEI modules to discover additional firmware files. The FileHandle must be
	unique within the system.

  @param This 			Points to this instance of the
										EFI_PEI_FIRMWARE_VOLUME_PPI. SearchType A filter
										to find only files of this type. Type
										EFI_FV_FILETYPE_ALL causes no filtering to be
										done.
  @param FvHandle 	Handle of firmware volume in which to
										search.

  @param FileHandle	Points to the current handle from which to
                    begin searching or NULL to start at the
                    beginning of the firmware volume. Updated
                    upon return to reflect the file found.


  @retval EFI_SUCCESS 	The file was found.
  @retval EFI_NOT_FOUND The file was not found. FileHandle
												contains NULL.
**/ 
typedef EFI_STATUS
(EFIAPI *EFI_PEI_FV_FIND_FILE_TYPE) ( 
	IN CONST 	EFI_PEI_FIRMWARE_VOLUME_PPI 	*This, 
	IN CONST  EFI_FV_FILETYPE 							SearchType, 
	IN CONST  EFI_PEI_FV_HANDLE 						FvHandle,
	IN OUT EFI_PEI_FILE_HANDLE 							*FileHandle 
);


/**
   
	This service searches for files with a specific name, within
	either the specified firmware volume or all firmware volumes.

  @param This   Points to this instance of the
                EFI_PEI_FIRMWARE_VOLUME_PPI.

  @param FileName 	A pointer to the name of the file to find
                    within the firmware volume.

  @param FvHandle 	Upon entry, the pointer to the firmware
                    volume to search or NULL if all firmware
                    volumes should be searched. Upon exit, the
                    actual firmware volume in which the file was
                    found.

  @param FileHandle 	Upon exit, points to the found file's
                      handle or NULL if it could not be found.

  @retval EFI_SUCCESS 	File was found.

  @param EFI_NOT_FOUND 	File was not found.

  @param EFI_INVALID_PARAMETER 	FvHandle or FileHandle or
                                FileName was NULL.


**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FV_FIND_FILE_NAME) (
	IN CONST 	EFI_PEI_FIRMWARE_VOLUME_PPI *This,
	IN CONST 	EFI_GUID 										*FileName,
	IN CONST	EFI_PEI_FV_HANDLE 					FvHandle,
	OUT 			EFI_PEI_FILE_HANDLE 				*FileHandle
);


/**
  This function returns information about a specific
	file, including its file name, type, attributes, starting
  address and size. 
   
  @param This 			Points to this instance of the
										EFI_PEI_FIRMWARE_VOLUME_PPI.

  @param FileHandle Handle of the file.

  @param FileInfo 	Upon exit, points to the file????s
										information.

  @retval EFI_SUCCESS 						File information returned.
  
  @retval EFI_INVALID_PARAMETER 	If FileHandle does not
                                  represent a valid file.
                                  EFI_INVALID_PARAMETER If
                                  FileInfo is NULL
  
**/ 

typedef
EFI_STATUS (EFIAPI *EFI_PEI_FV_GET_FILE_INFO) (
	IN	CONST	EFI_PEI_FIRMWARE_VOLUME_PPI 	*This, 
	IN  CONST	EFI_PEI_FILE_HANDLE 					FileHandle, 
	OUT 			EFI_FV_FILE_INFO 							*FileInfo
);

/**
	This function returns information about the firmware
  volume.
  
  @param This 			Points to this instance of the
										EFI_PEI_FIRMWARE_VOLUME_PPI.
  
  @param FvHandle 	Handle to the firmware handle.
  
  @param VolumeInfo Points to the returned firmware volume
                    information.
  
  
  @retval EFI_SUCCESS 						Information returned
                                  successfully.
  
  @retval EFI_INVALID_PARAMETER 	FvHandle does not indicate a
																	valid firmware volume or VolumeInfo is NULL
**/ 
typedef
EFI_STATUS (EFIAPI *EFI_PEI_FV_GET_INFO)(
	IN CONST 	EFI_PEI_FIRMWARE_VOLUME_PPI 	*This, 
	IN CONST 	EFI_PEI_FV_HANDLE 						FvHandle, 
	OUT 			EFI_FV_INFO 									*VolumeInfo
);

/**
  This service enables PEI modules to discover sections of a given type within a valid file.
  
  @param This 	Points to this instance of the
                EFI_PEI_FIRMWARE_VOLUME_PPI.
  
  @param SearchType 	A filter to find only sections of this
                      type.
  
  @param FileHandle 	Handle of firmware file in which to
                      search.
  
  @param SectionData  Updated upon  return to point to the
                      section found.
  
  @retval EFI_SUCCESS 		Section was found.
  
  @retval EFI_NOT_FOUND  	Section of the specified type was not
													found. SectionData contains NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FV_FIND_SECTION) (
	IN CONST 	EFI_PEI_FIRMWARE_VOLUME_PPI 	*This,
	IN CONST 	EFI_SECTION_TYPE 							SearchType,
	IN CONST 	EFI_PEI_FILE_HANDLE 					FileHandle,
	OUT 			VOID 													**SectionData
);



/*
	This PPI provides functions for accessing a memory-mapped firmware volume of a specific format.

	@param	ProcessVolume 			Process a firmware volume and create a volume handle.
	@param	FindFileByType 			Find all files of a specific type.
	@param	FindFileByName 			Find the file with a specific name.
	@param	GetFileInfo 				Return the information about a specific file
	@param	GetVolumeInfo 			Return the firmware volume attributes.
	@param	FindSectionByType 	Find all sections of a specific type.

**/
struct _EFI_PEI_FIRMWARE_VOLUME_PPI {
	EFI_PEI_FV_PROCESS_FV 			ProcessVolume;
	EFI_PEI_FV_FIND_FILE_TYPE 	FindFileByType;
	EFI_PEI_FV_FIND_FILE_NAME 	FindFileByName;
	EFI_PEI_FV_GET_FILE_INFO 		GetFileInfo;
	EFI_PEI_FV_GET_INFO 				GetVolumeInfo;
	EFI_PEI_FV_FIND_SECTION 		FindSectionByType;
} ;

extern EFI_GUID	gEfiPeiFirmwareVolumePpiGuid;

#endif