Subversion Repositories HelenOS

Rev

Rev 2726 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2726 Rev 4687
1
#ifndef _EFI_PROT_H
1
#ifndef _EFI_PROT_H
2
#define _EFI_PROT_H
2
#define _EFI_PROT_H
3
 
3
 
4
/*++
4
/*++
5
 
5
 
6
Copyright (c) 1998  Intel Corporation
6
Copyright (c) 1998  Intel Corporation
7
 
7
 
8
Module Name:
8
Module Name:
9
 
9
 
10
    efiprot.h
10
    efiprot.h
11
 
11
 
12
Abstract:
12
Abstract:
13
 
13
 
14
    EFI Protocols
14
    EFI Protocols
15
 
15
 
16
 
16
 
17
 
17
 
18
Revision History
18
Revision History
19
 
19
 
20
--*/
20
--*/
21
 
21
 
22
//
22
//
23
//  FPSWA library protocol
23
//  FPSWA library protocol
24
//
24
//
25
#define FPSWA_PROTOCOL          \
25
#define FPSWA_PROTOCOL          \
26
    { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
26
    { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
27
 
27
 
28
//
28
//
29
// Device Path protocol
29
// Device Path protocol
30
//
30
//
31
 
31
 
32
#define DEVICE_PATH_PROTOCOL    \
32
#define DEVICE_PATH_PROTOCOL    \
33
    { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
33
    { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
34
 
34
 
35
 
35
 
36
//
36
//
37
// Block IO protocol
37
// Block IO protocol
38
//
38
//
39
 
39
 
40
#define BLOCK_IO_PROTOCOL \
40
#define BLOCK_IO_PROTOCOL \
41
    { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
41
    { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
42
#define EFI_BLOCK_IO_INTERFACE_REVISION   0x00010000
42
#define EFI_BLOCK_IO_INTERFACE_REVISION   0x00010000
43
 
43
 
44
INTERFACE_DECL(_EFI_BLOCK_IO);
44
INTERFACE_DECL(_EFI_BLOCK_IO);
45
 
45
 
46
typedef
46
typedef
47
EFI_STATUS
47
EFI_STATUS
48
(EFIAPI *EFI_BLOCK_RESET) (
48
(EFIAPI *EFI_BLOCK_RESET) (
49
    IN struct _EFI_BLOCK_IO     *This,
49
    IN struct _EFI_BLOCK_IO     *This,
50
    IN BOOLEAN                  ExtendedVerification
50
    IN BOOLEAN                  ExtendedVerification
51
    );
51
    );
52
 
52
 
53
typedef
53
typedef
54
EFI_STATUS
54
EFI_STATUS
55
(EFIAPI *EFI_BLOCK_READ) (
55
(EFIAPI *EFI_BLOCK_READ) (
56
    IN struct _EFI_BLOCK_IO     *This,
56
    IN struct _EFI_BLOCK_IO     *This,
57
    IN UINT32                   MediaId,
57
    IN UINT32                   MediaId,
58
    IN EFI_LBA                  LBA,
58
    IN EFI_LBA                  LBA,
59
    IN UINTN                    BufferSize,
59
    IN UINTN                    BufferSize,
60
    OUT VOID                    *Buffer
60
    OUT VOID                    *Buffer
61
    );
61
    );
62
 
62
 
63
 
63
 
64
typedef
64
typedef
65
EFI_STATUS
65
EFI_STATUS
66
(EFIAPI *EFI_BLOCK_WRITE) (
66
(EFIAPI *EFI_BLOCK_WRITE) (
67
    IN struct _EFI_BLOCK_IO     *This,
67
    IN struct _EFI_BLOCK_IO     *This,
68
    IN UINT32                   MediaId,
68
    IN UINT32                   MediaId,
69
    IN EFI_LBA                  LBA,
69
    IN EFI_LBA                  LBA,
70
    IN UINTN                    BufferSize,
70
    IN UINTN                    BufferSize,
71
    IN VOID                     *Buffer
71
    IN VOID                     *Buffer
72
    );
72
    );
73
 
73
 
74
 
74
 
75
typedef
75
typedef
76
EFI_STATUS
76
EFI_STATUS
77
(EFIAPI *EFI_BLOCK_FLUSH) (
77
(EFIAPI *EFI_BLOCK_FLUSH) (
78
    IN struct _EFI_BLOCK_IO     *This
78
    IN struct _EFI_BLOCK_IO     *This
79
    );
79
    );
80
 
80
 
81
 
81
 
82
 
82
 
83
typedef struct {
83
typedef struct {
84
    UINT32              MediaId;
84
    UINT32              MediaId;
85
    BOOLEAN             RemovableMedia;
85
    BOOLEAN             RemovableMedia;
86
    BOOLEAN             MediaPresent;
86
    BOOLEAN             MediaPresent;
87
 
87
 
88
    BOOLEAN             LogicalPartition;
88
    BOOLEAN             LogicalPartition;
89
    BOOLEAN             ReadOnly;
89
    BOOLEAN             ReadOnly;
90
    BOOLEAN             WriteCaching;
90
    BOOLEAN             WriteCaching;
91
 
91
 
92
    UINT32              BlockSize;
92
    UINT32              BlockSize;
93
    UINT32              IoAlign;
93
    UINT32              IoAlign;
94
 
94
 
95
    EFI_LBA             LastBlock;
95
    EFI_LBA             LastBlock;
96
} EFI_BLOCK_IO_MEDIA;
96
} EFI_BLOCK_IO_MEDIA;
97
 
97
 
98
typedef struct _EFI_BLOCK_IO {
98
typedef struct _EFI_BLOCK_IO {
99
    UINT64                  Revision;
99
    UINT64                  Revision;
100
 
100
 
101
    EFI_BLOCK_IO_MEDIA      *Media;
101
    EFI_BLOCK_IO_MEDIA      *Media;
102
 
102
 
103
    EFI_BLOCK_RESET         Reset;
103
    EFI_BLOCK_RESET         Reset;
104
    EFI_BLOCK_READ          ReadBlocks;
104
    EFI_BLOCK_READ          ReadBlocks;
105
    EFI_BLOCK_WRITE         WriteBlocks;
105
    EFI_BLOCK_WRITE         WriteBlocks;
106
    EFI_BLOCK_FLUSH         FlushBlocks;
106
    EFI_BLOCK_FLUSH         FlushBlocks;
107
 
107
 
108
} EFI_BLOCK_IO;
108
} EFI_BLOCK_IO;
109
 
109
 
110
 
110
 
111
 
111
 
112
//
112
//
113
// Disk Block IO protocol
113
// Disk Block IO protocol
114
//
114
//
115
 
115
 
116
#define DISK_IO_PROTOCOL \
116
#define DISK_IO_PROTOCOL \
117
    { 0xce345171, 0xba0b, 0x11d2,  {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
117
    { 0xce345171, 0xba0b, 0x11d2,  {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
118
#define EFI_DISK_IO_INTERFACE_REVISION   0x00010000
118
#define EFI_DISK_IO_INTERFACE_REVISION   0x00010000
119
 
119
 
120
INTERFACE_DECL(_EFI_DISK_IO);
120
INTERFACE_DECL(_EFI_DISK_IO);
121
 
121
 
122
typedef
122
typedef
123
EFI_STATUS
123
EFI_STATUS
124
(EFIAPI *EFI_DISK_READ) (
124
(EFIAPI *EFI_DISK_READ) (
125
    IN struct _EFI_DISK_IO      *This,
125
    IN struct _EFI_DISK_IO      *This,
126
    IN UINT32                   MediaId,
126
    IN UINT32                   MediaId,
127
    IN UINT64                   Offset,
127
    IN UINT64                   Offset,
128
    IN UINTN                    BufferSize,
128
    IN UINTN                    BufferSize,
129
    OUT VOID                    *Buffer
129
    OUT VOID                    *Buffer
130
    );
130
    );
131
 
131
 
132
 
132
 
133
typedef
133
typedef
134
EFI_STATUS
134
EFI_STATUS
135
(EFIAPI *EFI_DISK_WRITE) (
135
(EFIAPI *EFI_DISK_WRITE) (
136
    IN struct _EFI_DISK_IO      *This,
136
    IN struct _EFI_DISK_IO      *This,
137
    IN UINT32                   MediaId,
137
    IN UINT32                   MediaId,
138
    IN UINT64                   Offset,
138
    IN UINT64                   Offset,
139
    IN UINTN                    BufferSize,
139
    IN UINTN                    BufferSize,
140
    IN VOID                     *Buffer
140
    IN VOID                     *Buffer
141
    );
141
    );
142
 
142
 
143
 
143
 
144
typedef struct _EFI_DISK_IO {
144
typedef struct _EFI_DISK_IO {
145
    UINT64              Revision;
145
    UINT64              Revision;
146
    EFI_DISK_READ       ReadDisk;
146
    EFI_DISK_READ       ReadDisk;
147
    EFI_DISK_WRITE      WriteDisk;
147
    EFI_DISK_WRITE      WriteDisk;
148
} EFI_DISK_IO;
148
} EFI_DISK_IO;
149
 
149
 
150
 
150
 
151
//
151
//
152
// Simple file system protocol
152
// Simple file system protocol
153
//
153
//
154
 
154
 
155
#define SIMPLE_FILE_SYSTEM_PROTOCOL \
155
#define SIMPLE_FILE_SYSTEM_PROTOCOL \
156
    { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
156
    { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
157
 
157
 
158
INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
158
INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
159
INTERFACE_DECL(_EFI_FILE_HANDLE);
159
INTERFACE_DECL(_EFI_FILE_HANDLE);
160
 
160
 
161
typedef
161
typedef
162
EFI_STATUS
162
EFI_STATUS
163
(EFIAPI *EFI_VOLUME_OPEN) (
163
(EFIAPI *EFI_VOLUME_OPEN) (
164
    IN struct _EFI_FILE_IO_INTERFACE    *This,
164
    IN struct _EFI_FILE_IO_INTERFACE    *This,
165
    OUT struct _EFI_FILE_HANDLE         **Root
165
    OUT struct _EFI_FILE_HANDLE         **Root
166
    );
166
    );
167
 
167
 
168
#define EFI_FILE_IO_INTERFACE_REVISION   0x00010000
168
#define EFI_FILE_IO_INTERFACE_REVISION   0x00010000
169
 
169
 
170
typedef struct _EFI_FILE_IO_INTERFACE {
170
typedef struct _EFI_FILE_IO_INTERFACE {
171
    UINT64                  Revision;
171
    UINT64                  Revision;
172
    EFI_VOLUME_OPEN         OpenVolume;
172
    EFI_VOLUME_OPEN         OpenVolume;
173
} EFI_FILE_IO_INTERFACE;
173
} EFI_FILE_IO_INTERFACE;
174
 
174
 
175
//
175
//
176
//
176
//
177
//
177
//
178
 
178
 
179
typedef
179
typedef
180
EFI_STATUS
180
EFI_STATUS
181
(EFIAPI *EFI_FILE_OPEN) (
181
(EFIAPI *EFI_FILE_OPEN) (
182
    IN struct _EFI_FILE_HANDLE  *File,
182
    IN struct _EFI_FILE_HANDLE  *File,
183
    OUT struct _EFI_FILE_HANDLE **NewHandle,
183
    OUT struct _EFI_FILE_HANDLE **NewHandle,
184
    IN CHAR16                   *FileName,
184
    IN CHAR16                   *FileName,
185
    IN UINT64                   OpenMode,
185
    IN UINT64                   OpenMode,
186
    IN UINT64                   Attributes
186
    IN UINT64                   Attributes
187
    );
187
    );
188
 
188
 
189
// Open modes
189
// Open modes
190
#define EFI_FILE_MODE_READ      0x0000000000000001
190
#define EFI_FILE_MODE_READ      0x0000000000000001
191
#define EFI_FILE_MODE_WRITE     0x0000000000000002
191
#define EFI_FILE_MODE_WRITE     0x0000000000000002
192
#define EFI_FILE_MODE_CREATE    0x8000000000000000
192
#define EFI_FILE_MODE_CREATE    0x8000000000000000
193
 
193
 
194
// File attributes
194
// File attributes
195
#define EFI_FILE_READ_ONLY      0x0000000000000001
195
#define EFI_FILE_READ_ONLY      0x0000000000000001
196
#define EFI_FILE_HIDDEN         0x0000000000000002
196
#define EFI_FILE_HIDDEN         0x0000000000000002
197
#define EFI_FILE_SYSTEM         0x0000000000000004
197
#define EFI_FILE_SYSTEM         0x0000000000000004
198
#define EFI_FILE_RESERVIED      0x0000000000000008
198
#define EFI_FILE_RESERVIED      0x0000000000000008
199
#define EFI_FILE_DIRECTORY      0x0000000000000010
199
#define EFI_FILE_DIRECTORY      0x0000000000000010
200
#define EFI_FILE_ARCHIVE        0x0000000000000020
200
#define EFI_FILE_ARCHIVE        0x0000000000000020
201
#define EFI_FILE_VALID_ATTR     0x0000000000000037
201
#define EFI_FILE_VALID_ATTR     0x0000000000000037
202
 
202
 
203
typedef
203
typedef
204
EFI_STATUS
204
EFI_STATUS
205
(EFIAPI *EFI_FILE_CLOSE) (
205
(EFIAPI *EFI_FILE_CLOSE) (
206
    IN struct _EFI_FILE_HANDLE  *File
206
    IN struct _EFI_FILE_HANDLE  *File
207
    );
207
    );
208
 
208
 
209
typedef
209
typedef
210
EFI_STATUS
210
EFI_STATUS
211
(EFIAPI *EFI_FILE_DELETE) (
211
(EFIAPI *EFI_FILE_DELETE) (
212
    IN struct _EFI_FILE_HANDLE  *File
212
    IN struct _EFI_FILE_HANDLE  *File
213
    );
213
    );
214
 
214
 
215
typedef
215
typedef
216
EFI_STATUS
216
EFI_STATUS
217
(EFIAPI *EFI_FILE_READ) (
217
(EFIAPI *EFI_FILE_READ) (
218
    IN struct _EFI_FILE_HANDLE  *File,
218
    IN struct _EFI_FILE_HANDLE  *File,
219
    IN OUT UINTN                *BufferSize,
219
    IN OUT UINTN                *BufferSize,
220
    OUT VOID                    *Buffer
220
    OUT VOID                    *Buffer
221
    );
221
    );
222
 
222
 
223
typedef
223
typedef
224
EFI_STATUS
224
EFI_STATUS
225
(EFIAPI *EFI_FILE_WRITE) (
225
(EFIAPI *EFI_FILE_WRITE) (
226
    IN struct _EFI_FILE_HANDLE  *File,
226
    IN struct _EFI_FILE_HANDLE  *File,
227
    IN OUT UINTN                *BufferSize,
227
    IN OUT UINTN                *BufferSize,
228
    IN VOID                     *Buffer
228
    IN VOID                     *Buffer
229
    );
229
    );
230
 
230
 
231
typedef
231
typedef
232
EFI_STATUS
232
EFI_STATUS
233
(EFIAPI *EFI_FILE_SET_POSITION) (
233
(EFIAPI *EFI_FILE_SET_POSITION) (
234
    IN struct _EFI_FILE_HANDLE  *File,
234
    IN struct _EFI_FILE_HANDLE  *File,
235
    IN UINT64                   Position
235
    IN UINT64                   Position
236
    );
236
    );
237
 
237
 
238
typedef
238
typedef
239
EFI_STATUS
239
EFI_STATUS
240
(EFIAPI *EFI_FILE_GET_POSITION) (
240
(EFIAPI *EFI_FILE_GET_POSITION) (
241
    IN struct _EFI_FILE_HANDLE  *File,
241
    IN struct _EFI_FILE_HANDLE  *File,
242
    OUT UINT64                  *Position
242
    OUT UINT64                  *Position
243
    );
243
    );
244
 
244
 
245
typedef
245
typedef
246
EFI_STATUS
246
EFI_STATUS
247
(EFIAPI *EFI_FILE_GET_INFO) (
247
(EFIAPI *EFI_FILE_GET_INFO) (
248
    IN struct _EFI_FILE_HANDLE  *File,
248
    IN struct _EFI_FILE_HANDLE  *File,
249
    IN EFI_GUID                 *InformationType,
249
    IN EFI_GUID                 *InformationType,
250
    IN OUT UINTN                *BufferSize,
250
    IN OUT UINTN                *BufferSize,
251
    OUT VOID                    *Buffer
251
    OUT VOID                    *Buffer
252
    );
252
    );
253
 
253
 
254
typedef
254
typedef
255
EFI_STATUS
255
EFI_STATUS
256
(EFIAPI *EFI_FILE_SET_INFO) (
256
(EFIAPI *EFI_FILE_SET_INFO) (
257
    IN struct _EFI_FILE_HANDLE  *File,
257
    IN struct _EFI_FILE_HANDLE  *File,
258
    IN EFI_GUID                 *InformationType,
258
    IN EFI_GUID                 *InformationType,
259
    IN UINTN                    BufferSize,
259
    IN UINTN                    BufferSize,
260
    IN VOID                     *Buffer
260
    IN VOID                     *Buffer
261
    );
261
    );
262
 
262
 
263
typedef
263
typedef
264
EFI_STATUS
264
EFI_STATUS
265
(EFIAPI *EFI_FILE_FLUSH) (
265
(EFIAPI *EFI_FILE_FLUSH) (
266
    IN struct _EFI_FILE_HANDLE  *File
266
    IN struct _EFI_FILE_HANDLE  *File
267
    );
267
    );
268
 
268
 
269
 
269
 
270
 
270
 
271
#define EFI_FILE_HANDLE_REVISION         0x00010000
271
#define EFI_FILE_HANDLE_REVISION         0x00010000
272
typedef struct _EFI_FILE_HANDLE {
272
typedef struct _EFI_FILE_HANDLE {
273
    UINT64                  Revision;
273
    UINT64                  Revision;
274
    EFI_FILE_OPEN           Open;
274
    EFI_FILE_OPEN           Open;
275
    EFI_FILE_CLOSE          Close;
275
    EFI_FILE_CLOSE          Close;
276
    EFI_FILE_DELETE         Delete;
276
    EFI_FILE_DELETE         Delete;
277
    EFI_FILE_READ           Read;
277
    EFI_FILE_READ           Read;
278
    EFI_FILE_WRITE          Write;
278
    EFI_FILE_WRITE          Write;
279
    EFI_FILE_GET_POSITION   GetPosition;
279
    EFI_FILE_GET_POSITION   GetPosition;
280
    EFI_FILE_SET_POSITION   SetPosition;
280
    EFI_FILE_SET_POSITION   SetPosition;
281
    EFI_FILE_GET_INFO       GetInfo;
281
    EFI_FILE_GET_INFO       GetInfo;
282
    EFI_FILE_SET_INFO       SetInfo;
282
    EFI_FILE_SET_INFO       SetInfo;
283
    EFI_FILE_FLUSH          Flush;
283
    EFI_FILE_FLUSH          Flush;
284
} EFI_FILE, *EFI_FILE_HANDLE;
284
} EFI_FILE, *EFI_FILE_HANDLE;
285
 
285
 
286
 
286
 
287
//
287
//
288
// File information types
288
// File information types
289
//
289
//
290
 
290
 
291
#define EFI_FILE_INFO_ID   \
291
#define EFI_FILE_INFO_ID   \
292
    { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
292
    { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
293
 
293
 
294
typedef struct {
294
typedef struct {
295
    UINT64                  Size;
295
    UINT64                  Size;
296
    UINT64                  FileSize;
296
    UINT64                  FileSize;
297
    UINT64                  PhysicalSize;
297
    UINT64                  PhysicalSize;
298
    EFI_TIME                CreateTime;
298
    EFI_TIME                CreateTime;
299
    EFI_TIME                LastAccessTime;
299
    EFI_TIME                LastAccessTime;
300
    EFI_TIME                ModificationTime;
300
    EFI_TIME                ModificationTime;
301
    UINT64                  Attribute;
301
    UINT64                  Attribute;
302
    CHAR16                  FileName[1];
302
    CHAR16                  FileName[1];
303
} EFI_FILE_INFO;
303
} EFI_FILE_INFO;
304
 
304
 
305
//
305
//
306
// The FileName field of the EFI_FILE_INFO data structure is variable length.
306
// The FileName field of the EFI_FILE_INFO data structure is variable length.
307
// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
307
// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
308
// be the size of the data structure without the FileName field.  The following macro 
308
// be the size of the data structure without the FileName field.  The following macro 
309
// computes this size correctly no matter how big the FileName array is declared.
309
// computes this size correctly no matter how big the FileName array is declared.
310
// This is required to make the EFI_FILE_INFO data structure ANSI compilant. 
310
// This is required to make the EFI_FILE_INFO data structure ANSI compilant. 
311
//
311
//
312
 
312
 
313
#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
313
#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
314
 
314
 
315
#define EFI_FILE_SYSTEM_INFO_ID    \
315
#define EFI_FILE_SYSTEM_INFO_ID    \
316
    { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
316
    { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
317
 
317
 
318
typedef struct {
318
typedef struct {
319
    UINT64                  Size;
319
    UINT64                  Size;
320
    BOOLEAN                 ReadOnly;
320
    BOOLEAN                 ReadOnly;
321
    UINT64                  VolumeSize;
321
    UINT64                  VolumeSize;
322
    UINT64                  FreeSpace;
322
    UINT64                  FreeSpace;
323
    UINT32                  BlockSize;
323
    UINT32                  BlockSize;
324
    CHAR16                  VolumeLabel[1];
324
    CHAR16                  VolumeLabel[1];
325
} EFI_FILE_SYSTEM_INFO;
325
} EFI_FILE_SYSTEM_INFO;
326
 
326
 
327
//
327
//
328
// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
328
// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
329
// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
329
// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
330
// to be the size of the data structure without the VolumeLable field.  The following macro 
330
// to be the size of the data structure without the VolumeLable field.  The following macro 
331
// computes this size correctly no matter how big the VolumeLable array is declared.
331
// computes this size correctly no matter how big the VolumeLable array is declared.
332
// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. 
332
// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. 
333
//
333
//
334
 
334
 
335
#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
335
#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
336
 
336
 
337
#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID    \
337
#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID    \
338
    { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
338
    { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
339
 
339
 
340
typedef struct {
340
typedef struct {
341
    CHAR16                  VolumeLabel[1];
341
    CHAR16                  VolumeLabel[1];
342
} EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
342
} EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
343
 
343
 
344
#define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
344
#define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
345
 
345
 
346
//
346
//
347
// Load file protocol
347
// Load file protocol
348
//
348
//
349
 
349
 
350
 
350
 
351
#define LOAD_FILE_PROTOCOL \
351
#define LOAD_FILE_PROTOCOL \
352
    { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
352
    { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
353
 
353
 
354
INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
354
INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
355
 
355
 
356
typedef
356
typedef
357
EFI_STATUS
357
EFI_STATUS
358
(EFIAPI *EFI_LOAD_FILE) (
358
(EFIAPI *EFI_LOAD_FILE) (
359
    IN struct _EFI_LOAD_FILE_INTERFACE  *This,
359
    IN struct _EFI_LOAD_FILE_INTERFACE  *This,
360
    IN EFI_DEVICE_PATH                  *FilePath,
360
    IN EFI_DEVICE_PATH                  *FilePath,
361
    IN BOOLEAN                          BootPolicy,
361
    IN BOOLEAN                          BootPolicy,
362
    IN OUT UINTN                        *BufferSize,
362
    IN OUT UINTN                        *BufferSize,
363
    IN VOID                             *Buffer OPTIONAL
363
    IN VOID                             *Buffer OPTIONAL
364
    );
364
    );
365
 
365
 
366
typedef struct _EFI_LOAD_FILE_INTERFACE {
366
typedef struct _EFI_LOAD_FILE_INTERFACE {
367
    EFI_LOAD_FILE                       LoadFile;
367
    EFI_LOAD_FILE                       LoadFile;
368
} EFI_LOAD_FILE_INTERFACE;
368
} EFI_LOAD_FILE_INTERFACE;
369
 
369
 
370
 
370
 
371
//
371
//
372
// Device IO protocol
372
// Device IO protocol
373
//
373
//
374
 
374
 
375
#define DEVICE_IO_PROTOCOL \
375
#define DEVICE_IO_PROTOCOL \
376
    { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
376
    { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
377
 
377
 
378
INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
378
INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
379
 
379
 
380
typedef enum {
380
typedef enum {
381
    IO_UINT8,
381
    IO_UINT8,
382
    IO_UINT16,
382
    IO_UINT16,
383
    IO_UINT32,
383
    IO_UINT32,
384
    IO_UINT64,
384
    IO_UINT64,
385
//
385
//
386
// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
386
// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
387
//
387
//
388
    MMIO_COPY_UINT8,
388
    MMIO_COPY_UINT8,
389
    MMIO_COPY_UINT16,
389
    MMIO_COPY_UINT16,
390
    MMIO_COPY_UINT32,
390
    MMIO_COPY_UINT32,
391
    MMIO_COPY_UINT64
391
    MMIO_COPY_UINT64
392
} EFI_IO_WIDTH;
392
} EFI_IO_WIDTH;
393
 
393
 
394
#define EFI_PCI_ADDRESS(_bus,_dev,_func) \
394
#define EFI_PCI_ADDRESS(_bus,_dev,_func) \
395
    ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
395
    ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
396
 
396
 
397
 
397
 
398
typedef
398
typedef
399
EFI_STATUS
399
EFI_STATUS
400
(EFIAPI *EFI_DEVICE_IO) (
400
(EFIAPI *EFI_DEVICE_IO) (
401
    IN struct _EFI_DEVICE_IO_INTERFACE *This,
401
    IN struct _EFI_DEVICE_IO_INTERFACE *This,
402
    IN EFI_IO_WIDTH                 Width,
402
    IN EFI_IO_WIDTH                 Width,
403
    IN UINT64                       Address,
403
    IN UINT64                       Address,
404
    IN UINTN                        Count,
404
    IN UINTN                        Count,
405
    IN OUT VOID                     *Buffer
405
    IN OUT VOID                     *Buffer
406
    );
406
    );
407
 
407
 
408
typedef struct {
408
typedef struct {
409
    EFI_DEVICE_IO                   Read;
409
    EFI_DEVICE_IO                   Read;
410
    EFI_DEVICE_IO                   Write;
410
    EFI_DEVICE_IO                   Write;
411
} EFI_IO_ACCESS;
411
} EFI_IO_ACCESS;
412
 
412
 
413
typedef
413
typedef
414
EFI_STATUS
414
EFI_STATUS
415
(EFIAPI *EFI_PCI_DEVICE_PATH) (
415
(EFIAPI *EFI_PCI_DEVICE_PATH) (
416
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
416
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
417
    IN UINT64                           Address,
417
    IN UINT64                           Address,
418
    IN OUT EFI_DEVICE_PATH              **PciDevicePath
418
    IN OUT EFI_DEVICE_PATH              **PciDevicePath
419
    );
419
    );
420
 
420
 
421
typedef enum {
421
typedef enum {
422
    EfiBusMasterRead,
422
    EfiBusMasterRead,
423
    EfiBusMasterWrite,
423
    EfiBusMasterWrite,
424
    EfiBusMasterCommonBuffer
424
    EfiBusMasterCommonBuffer
425
} EFI_IO_OPERATION_TYPE;
425
} EFI_IO_OPERATION_TYPE;
426
 
426
 
427
typedef
427
typedef
428
EFI_STATUS
428
EFI_STATUS
429
(EFIAPI *EFI_IO_MAP) (
429
(EFIAPI *EFI_IO_MAP) (
430
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
430
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
431
    IN EFI_IO_OPERATION_TYPE            Operation,
431
    IN EFI_IO_OPERATION_TYPE            Operation,
432
    IN EFI_PHYSICAL_ADDRESS             *HostAddress,
432
    IN EFI_PHYSICAL_ADDRESS             *HostAddress,
433
    IN OUT UINTN                        *NumberOfBytes,
433
    IN OUT UINTN                        *NumberOfBytes,
434
    OUT EFI_PHYSICAL_ADDRESS            *DeviceAddress,
434
    OUT EFI_PHYSICAL_ADDRESS            *DeviceAddress,
435
    OUT VOID                            **Mapping
435
    OUT VOID                            **Mapping
436
    );
436
    );
437
 
437
 
438
typedef
438
typedef
439
EFI_STATUS
439
EFI_STATUS
440
(EFIAPI *EFI_IO_UNMAP) (
440
(EFIAPI *EFI_IO_UNMAP) (
441
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
441
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
442
    IN VOID                             *Mapping
442
    IN VOID                             *Mapping
443
    );
443
    );
444
 
444
 
445
typedef
445
typedef
446
EFI_STATUS
446
EFI_STATUS
447
(EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
447
(EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
448
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
448
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
449
    IN EFI_ALLOCATE_TYPE                Type,
449
    IN EFI_ALLOCATE_TYPE                Type,
450
    IN EFI_MEMORY_TYPE                  MemoryType,
450
    IN EFI_MEMORY_TYPE                  MemoryType,
451
    IN UINTN                            Pages,
451
    IN UINTN                            Pages,
452
    IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress
452
    IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress
453
    );
453
    );
454
 
454
 
455
typedef
455
typedef
456
EFI_STATUS
456
EFI_STATUS
457
(EFIAPI *EFI_IO_FLUSH) (
457
(EFIAPI *EFI_IO_FLUSH) (
458
    IN struct _EFI_DEVICE_IO_INTERFACE  *This
458
    IN struct _EFI_DEVICE_IO_INTERFACE  *This
459
    );
459
    );
460
 
460
 
461
typedef
461
typedef
462
EFI_STATUS
462
EFI_STATUS
463
(EFIAPI *EFI_IO_FREE_BUFFER) (
463
(EFIAPI *EFI_IO_FREE_BUFFER) (
464
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
464
    IN struct _EFI_DEVICE_IO_INTERFACE  *This,
465
    IN UINTN                            Pages,
465
    IN UINTN                            Pages,
466
    IN EFI_PHYSICAL_ADDRESS             HostAddress
466
    IN EFI_PHYSICAL_ADDRESS             HostAddress
467
    );
467
    );
468
 
468
 
469
typedef struct _EFI_DEVICE_IO_INTERFACE {
469
typedef struct _EFI_DEVICE_IO_INTERFACE {
470
    EFI_IO_ACCESS                       Mem;
470
    EFI_IO_ACCESS                       Mem;
471
    EFI_IO_ACCESS                       Io;
471
    EFI_IO_ACCESS                       Io;
472
    EFI_IO_ACCESS                       Pci;
472
    EFI_IO_ACCESS                       Pci;
473
    EFI_IO_MAP                          Map;
473
    EFI_IO_MAP                          Map;
474
    EFI_PCI_DEVICE_PATH                 PciDevicePath;
474
    EFI_PCI_DEVICE_PATH                 PciDevicePath;
475
    EFI_IO_UNMAP                        Unmap;
475
    EFI_IO_UNMAP                        Unmap;
476
    EFI_IO_ALLOCATE_BUFFER              AllocateBuffer;
476
    EFI_IO_ALLOCATE_BUFFER              AllocateBuffer;
477
    EFI_IO_FLUSH                        Flush;
477
    EFI_IO_FLUSH                        Flush;
478
    EFI_IO_FREE_BUFFER                  FreeBuffer;
478
    EFI_IO_FREE_BUFFER                  FreeBuffer;
479
} EFI_DEVICE_IO_INTERFACE;
479
} EFI_DEVICE_IO_INTERFACE;
480
 
480
 
481
 
481
 
482
//
482
//
483
// Unicode Collation protocol
483
// Unicode Collation protocol
484
//
484
//
485
 
485
 
486
#define UNICODE_COLLATION_PROTOCOL \
486
#define UNICODE_COLLATION_PROTOCOL \
487
    { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc,  0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
487
    { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc,  0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
488
 
488
 
489
#define UNICODE_BYTE_ORDER_MARK       (CHAR16)(0xfeff)
489
#define UNICODE_BYTE_ORDER_MARK       (CHAR16)(0xfeff)
490
 
490
 
491
INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
491
INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
492
 
492
 
493
typedef
493
typedef
494
INTN
494
INTN
495
(EFIAPI *EFI_UNICODE_STRICOLL) (
495
(EFIAPI *EFI_UNICODE_STRICOLL) (
496
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
496
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
497
    IN CHAR16                         *s1,
497
    IN CHAR16                         *s1,
498
    IN CHAR16                         *s2
498
    IN CHAR16                         *s2
499
    );
499
    );
500
 
500
 
501
typedef
501
typedef
502
BOOLEAN
502
BOOLEAN
503
(EFIAPI *EFI_UNICODE_METAIMATCH) (
503
(EFIAPI *EFI_UNICODE_METAIMATCH) (
504
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
504
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
505
    IN CHAR16                         *String,
505
    IN CHAR16                         *String,
506
    IN CHAR16                         *Pattern
506
    IN CHAR16                         *Pattern
507
    );
507
    );
508
 
508
 
509
typedef
509
typedef
510
VOID
510
VOID
511
(EFIAPI *EFI_UNICODE_STRLWR) (
511
(EFIAPI *EFI_UNICODE_STRLWR) (
512
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
512
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
513
    IN OUT CHAR16                       *Str
513
    IN OUT CHAR16                       *Str
514
    );
514
    );
515
 
515
 
516
typedef
516
typedef
517
VOID
517
VOID
518
(EFIAPI *EFI_UNICODE_STRUPR) (
518
(EFIAPI *EFI_UNICODE_STRUPR) (
519
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
519
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
520
    IN OUT CHAR16                       *Str
520
    IN OUT CHAR16                       *Str
521
    );
521
    );
522
 
522
 
523
typedef
523
typedef
524
VOID
524
VOID
525
(EFIAPI *EFI_UNICODE_FATTOSTR) (
525
(EFIAPI *EFI_UNICODE_FATTOSTR) (
526
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
526
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
527
    IN UINTN                            FatSize,
527
    IN UINTN                            FatSize,
528
    IN CHAR8                            *Fat,
528
    IN CHAR8                            *Fat,
529
    OUT CHAR16                          *String
529
    OUT CHAR16                          *String
530
    );
530
    );
531
 
531
 
532
typedef
532
typedef
533
BOOLEAN
533
BOOLEAN
534
(EFIAPI *EFI_UNICODE_STRTOFAT) (
534
(EFIAPI *EFI_UNICODE_STRTOFAT) (
535
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
535
    IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
536
    IN CHAR16                           *String,
536
    IN CHAR16                           *String,
537
    IN UINTN                            FatSize,
537
    IN UINTN                            FatSize,
538
    OUT CHAR8                           *Fat
538
    OUT CHAR8                           *Fat
539
    );
539
    );
540
 
540
 
541
 
541
 
542
typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
542
typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
543
 
543
 
544
    // general
544
    // general
545
    EFI_UNICODE_STRICOLL                StriColl;
545
    EFI_UNICODE_STRICOLL                StriColl;
546
    EFI_UNICODE_METAIMATCH              MetaiMatch;
546
    EFI_UNICODE_METAIMATCH              MetaiMatch;
547
    EFI_UNICODE_STRLWR                  StrLwr;
547
    EFI_UNICODE_STRLWR                  StrLwr;
548
    EFI_UNICODE_STRUPR                  StrUpr;
548
    EFI_UNICODE_STRUPR                  StrUpr;
549
 
549
 
550
    // for supporting fat volumes
550
    // for supporting fat volumes
551
    EFI_UNICODE_FATTOSTR                FatToStr;
551
    EFI_UNICODE_FATTOSTR                FatToStr;
552
    EFI_UNICODE_STRTOFAT                StrToFat;
552
    EFI_UNICODE_STRTOFAT                StrToFat;
553
 
553
 
554
    CHAR8                               *SupportedLanguages;
554
    CHAR8                               *SupportedLanguages;
555
} EFI_UNICODE_COLLATION_INTERFACE;
555
} EFI_UNICODE_COLLATION_INTERFACE;
556
 
556
 
557
#endif
557
#endif
558
 
558
 
559
 
559