summaryrefslogtreecommitdiff
path: root/Include/Protocol/FirmwareVolume.h
blob: 21babbcc799359d59f0437bb12326791601aa26f (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
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2005, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**             6145-F Northbelt Pkwy, Norcross, GA 30071            **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************
//**********************************************************************
// $Header: /Alaska/BIN/Core/Include/Protocol/FirmwareVolume.h 4     6/16/11 3:22p Felixp $
//
// $Revision: 4 $
//
// $Date: 6/16/11 3:22p $
//*****************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Core/Include/Protocol/FirmwareVolume.h $
// 
// 4     6/16/11 3:22p Felixp
// Surround backward compatibility definitions with #if
// BACKWARD_COMPATIBLE_MODE
// 
// 3     5/27/11 5:53p Felixp
// Headers are updated to improve separation of the Framework and PI
// interfaces.
// The definitions that will be removed in the future versions are marked
// with the comments.
// 
// 2     2/05/11 2:30p Artems
// Added PI 1.0-1.1 compatibility
// 
// 1     3/13/06 1:38a Felixp
// 
// 1     1/28/05 12:44p Felixp
// 
// 2     1/18/05 3:22p Felixp
// PrintDebugMessage renamed to Trace
// 
// 1     12/23/04 9:41a Felixp
// 
// 4     12/31/03 2:41p Markw
// Fix structure help
// 
// 3     12/19/03 2:21p Markw
// Add EFI_FV_... Attribute definition
// 
// 2     12/18/03 12:53p Markw
// Header changes
// 
//*****************************************************************************
//<AMI_FHDR_START>
//
// Name:	FirmwareVolume.h 
//
// Description:	This file is an include file used to define the Protocol for the
//		        Firmware Volume Protocol.
//
//<AMI_FHDR_END>
//*****************************************************************************
#ifndef __FIRMWARE_VOLUME_PROTOCOL_H__
#define __FIRMWARE_VOLUME_PROTOCOL_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <FFS.h>

#if BACKWARD_COMPATIBLE_MODE && PI_SPECIFICATION_VERSION>=0x00010000
#include <Protocol/FirmwareVolume2.h>    
#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID
GUID_VARIABLE_DECLARATION(gEfiFirmwareVolumeProtocolGuid, EFI_FIRMWARE_VOLUME_PROTOCOL_GUID);
typedef EFI_FIRMWARE_VOLUME2_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;

#else
// 389F751F-1838-4388-8390-CD8154BD27F8
#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
    {0x389F751F,0x1838,0x4388,0x83,0x90,0xCD,0x81,0x54,0xBD,0x27,0xF8}

GUID_VARIABLE_DECLARATION(gEfiFirmwareVolumeProtocolGuid, EFI_FIRMWARE_VOLUME_PROTOCOL_GUID);

//************************************************************
// EFI_FV_ATTRIBUTES
//************************************************************
typedef UINT64 EFI_FV_ATTRIBUTES;

//************************************************************
// EFI_FV_ATTRIBUTES bit definitions
//************************************************************
#define EFI_FV_READ_DISABLE_CAP         0x0000000000000001
#define EFI_FV_READ_ENABLE_CAP          0x0000000000000002
#define EFI_FV_READ_STATUS              0x0000000000000004
#define EFI_FV_WRITE_DISABLE_CAP        0x0000000000000008
#define EFI_FV_WRITE_ENABLE_CAP         0x0000000000000010
#define EFI_FV_WRITE_STATUS             0x0000000000000020
#define EFI_FV_LOCK_CAP 		        0x0000000000000040
#define EFI_FV_LOCK_STATUS 		        0x0000000000000080
#define EFI_FV_WRITE_POLICY_RELIABLE    0x0000000000000100
#define EFI_FV_ALIGNMENT_CAP            0x0000000000008000
#define EFI_FV_ALIGNMENT_2              0x0000000000010000
#define EFI_FV_ALIGNMENT_4              0x0000000000020000
#define EFI_FV_ALIGNMENT_8              0x0000000000040000
#define EFI_FV_ALIGNMENT_16             0x0000000000080000
#define EFI_FV_ALIGNMENT_32             0x0000000000100000
#define EFI_FV_ALIGNMENT_64             0x0000000000200000
#define EFI_FV_ALIGNMENT_128            0x0000000000400000
#define EFI_FV_ALIGNMENT_256            0x0000000000800000
#define EFI_FV_ALIGNMENT_512            0x0000000001000000
#define EFI_FV_ALIGNMENT_1K             0x0000000002000000
#define EFI_FV_ALIGNMENT_2K             0x0000000004000000
#define EFI_FV_ALIGNMENT_4K             0x0000000008000000
#define EFI_FV_ALIGNMENT_8K             0x0000000010000000
#define EFI_FV_ALIGNMENT_16K            0x0000000020000000
#define EFI_FV_ALIGNMENT_32K            0x0000000040000000
#define EFI_FV_ALIGNMENT_64K            0x0000000080000000


struct _EFI_FIRMWARE_VOLUME_PROTOCOL;
typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;

typedef EFI_STATUS (EFIAPI * EFI_FV_GET_ATTRIBUTES) (
    IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
    OUT EFI_FV_ATTRIBUTES           *FvAttributes);


typedef EFI_STATUS (EFIAPI * EFI_FV_SET_ATTRIBUTES) (
    IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
    IN OUT EFI_FV_ATTRIBUTES        *FvAttributes);

typedef EFI_STATUS (EFIAPI * EFI_FV_READ_FILE) (
    IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
    IN EFI_GUID                     *NameGuid,
    IN OUT VOID                     **Buffer,
    IN OUT UINTN                    *BufferSize,
    OUT EFI_FV_FILETYPE             *FoundType,
    OUT EFI_FV_FILE_ATTRIBUTES      *FileAttributes,
    OUT UINT32                      *AuthenticationStatus);

typedef EFI_STATUS (EFIAPI * EFI_FV_READ_SECTION) (
    IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
    IN EFI_GUID                     *NameGuid,
    IN EFI_SECTION_TYPE             SectionType,
    IN UINTN                        SectionInstance,
    IN OUT VOID                     **Buffer,
    IN OUT UINTN                    *BufferSize,
    OUT UINT32                      *AuthenticationStatus);


//************************************************************
// EFI_FV_WRITE_POLICY
//************************************************************
typedef UINT32 EFI_FV_WRITE_POLICY;
#define EFI_FV_UNRELIABLE_WRITE 0x00000000
#define EFI_FV_RELIABLE_WRITE   0x00000001

//************************************************************
// EFI_FV_WRITE_FILE_DATA
//************************************************************
typedef struct {
    EFI_GUID                *NameGuid;
    EFI_FV_FILETYPE         Type;
    EFI_FV_FILE_ATTRIBUTES  FileAttributes;
    VOID                    *Buffer;
    UINT32                  BufferSize;
} EFI_FV_WRITE_FILE_DATA;

typedef EFI_STATUS (EFIAPI * EFI_FV_WRITE_FILE) (
    IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
    IN UINT32                       NumberOfFiles,
    IN EFI_FV_WRITE_POLICY          WritePolicy,
    IN EFI_FV_WRITE_FILE_DATA       *FileData);

typedef EFI_STATUS (EFIAPI * EFI_FV_GET_NEXT_FILE) (
    IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
    IN OUT VOID                     *Key,
    IN OUT EFI_FV_FILETYPE          *FileType,
    OUT EFI_GUID                    *NameGuid,
    OUT EFI_FV_FILE_ATTRIBUTES      *Attributes,
    OUT UINTN                       *Size);

//**********************************************************************
//<AMI_SHDR_START>
//
// Name:        EFI_FIRMWARE_VOLUME_PROTOCOL
//
// Description: Firmware Volume Protocol for Reading/Seting Volume Attributes
//		Read/Writing Files.
//
// Fields:     Name        Type        Description
//        ------------------------------------------------------------
//        GetVolumeAttributes EFI_FV_GET_ATTRIBUTES   
//        SetVolumeAttributes EFI_FV_SET_ATTRIBUTES   
//        ReadFile            EFI_FV_READ_FILE        
//        ReadSection         EFI_FV_READ_SECTION     
//        WriteFile           EFI_FV_WRITE_FILE       
//        GetNextFile         EFI_FV_GET_NEXT_FILE    
//        KeySize             UINT32                  
//        ParentHandle        EFI_HANDLE              
//
//<AMI_SHDR_END>
//**********************************************************************
typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL {
    EFI_FV_GET_ATTRIBUTES   GetVolumeAttributes;
    EFI_FV_SET_ATTRIBUTES   SetVolumeAttributes;
    EFI_FV_READ_FILE        ReadFile;
    EFI_FV_READ_SECTION     ReadSection;
    EFI_FV_WRITE_FILE       WriteFile;
    EFI_FV_GET_NEXT_FILE    GetNextFile;
    UINT32                  KeySize;
    EFI_HANDLE              ParentHandle;
} EFI_FIRMWARE_VOLUME_PROTOCOL;
#endif // #else PI_SPECIFICATION_VERSION>=0x00010000
/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2005, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**             6145-F Northbelt Pkwy, Norcross, GA 30071            **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************