Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / ia64 / stand / efi / include / efiprot.h
blob01371a4279a233671815eb7cfa50cbee286ea4fb
1 /* $NetBSD: efiprot.h,v 1.1 2006/04/07 14:21:29 cherry Exp $ */
2 /* $FreeBSD: src/sys/boot/efi/include/efiprot.h,v 1.3 2002/05/19 03:17:20 marcel Exp $ */
4 #ifndef _EFI_PROT_H
5 #define _EFI_PROT_H
7 /*++
9 Copyright (c) 1998 Intel Corporation
11 Module Name:
13 efiprot.h
15 Abstract:
17 EFI Protocols
21 Revision History
23 --*/
26 * Device Path protocol
29 #define DEVICE_PATH_PROTOCOL \
30 { 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
34 * Block IO protocol
37 #define BLOCK_IO_PROTOCOL \
38 { 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
39 #define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000
41 INTERFACE_DECL(_EFI_BLOCK_IO);
43 typedef
44 EFI_STATUS
45 (EFIAPI *EFI_BLOCK_RESET) (
46 IN struct _EFI_BLOCK_IO *This,
47 IN BOOLEAN ExtendedVerification
50 typedef
51 EFI_STATUS
52 (EFIAPI *EFI_BLOCK_READ) (
53 IN struct _EFI_BLOCK_IO *This,
54 IN UINT32 MediaId,
55 IN EFI_LBA LBA,
56 IN UINTN BufferSize,
57 OUT VOID *Buffer
61 typedef
62 EFI_STATUS
63 (EFIAPI *EFI_BLOCK_WRITE) (
64 IN struct _EFI_BLOCK_IO *This,
65 IN UINT32 MediaId,
66 IN EFI_LBA LBA,
67 IN UINTN BufferSize,
68 IN VOID *Buffer
72 typedef
73 EFI_STATUS
74 (EFIAPI *EFI_BLOCK_FLUSH) (
75 IN struct _EFI_BLOCK_IO *This
80 typedef struct {
81 UINT32 MediaId;
82 BOOLEAN RemovableMedia;
83 BOOLEAN MediaPresent;
85 BOOLEAN LogicalPartition;
86 BOOLEAN ReadOnly;
87 BOOLEAN WriteCaching;
89 UINT32 BlockSize;
90 UINT32 IoAlign;
92 EFI_LBA LastBlock;
93 } EFI_BLOCK_IO_MEDIA;
95 typedef struct _EFI_BLOCK_IO {
96 UINT64 Revision;
98 EFI_BLOCK_IO_MEDIA *Media;
100 EFI_BLOCK_RESET Reset;
101 EFI_BLOCK_READ ReadBlocks;
102 EFI_BLOCK_WRITE WriteBlocks;
103 EFI_BLOCK_FLUSH FlushBlocks;
105 } EFI_BLOCK_IO;
110 * Disk Block IO protocol
113 #define DISK_IO_PROTOCOL \
114 { 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
115 #define EFI_DISK_IO_INTERFACE_REVISION 0x00010000
117 INTERFACE_DECL(_EFI_DISK_IO);
119 typedef
120 EFI_STATUS
121 (EFIAPI *EFI_DISK_READ) (
122 IN struct _EFI_DISK_IO *This,
123 IN UINT32 MediaId,
124 IN UINT64 Offset,
125 IN UINTN BufferSize,
126 OUT VOID *Buffer
130 typedef
131 EFI_STATUS
132 (EFIAPI *EFI_DISK_WRITE) (
133 IN struct _EFI_DISK_IO *This,
134 IN UINT32 MediaId,
135 IN UINT64 Offset,
136 IN UINTN BufferSize,
137 IN VOID *Buffer
141 typedef struct _EFI_DISK_IO {
142 UINT64 Revision;
143 EFI_DISK_READ ReadDisk;
144 EFI_DISK_WRITE WriteDisk;
145 } EFI_DISK_IO;
149 * Simple filesystem protocol
152 #define SIMPLE_FILE_SYSTEM_PROTOCOL \
153 { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
155 INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
156 INTERFACE_DECL(_EFI_FILE_HANDLE);
158 typedef
159 EFI_STATUS
160 (EFIAPI *EFI_VOLUME_OPEN) (
161 IN struct _EFI_FILE_IO_INTERFACE *This,
162 OUT struct _EFI_FILE_HANDLE **Root
165 #define EFI_FILE_IO_INTERFACE_REVISION 0x00010000
167 typedef struct _EFI_FILE_IO_INTERFACE {
168 UINT64 Revision;
169 EFI_VOLUME_OPEN OpenVolume;
170 } EFI_FILE_IO_INTERFACE;
172 typedef
173 EFI_STATUS
174 (EFIAPI *EFI_FILE_OPEN) (
175 IN struct _EFI_FILE_HANDLE *File,
176 OUT struct _EFI_FILE_HANDLE **NewHandle,
177 IN CHAR16 *FileName,
178 IN UINT64 OpenMode,
179 IN UINT64 Attributes
182 /* Open modes */
183 #define EFI_FILE_MODE_READ 0x0000000000000001
184 #define EFI_FILE_MODE_WRITE 0x0000000000000002
185 #define EFI_FILE_MODE_CREATE 0x8000000000000000
187 /* File attributes */
188 #define EFI_FILE_READ_ONLY 0x0000000000000001
189 #define EFI_FILE_HIDDEN 0x0000000000000002
190 #define EFI_FILE_SYSTEM 0x0000000000000004
191 #define EFI_FILE_RESERVIED 0x0000000000000008
192 #define EFI_FILE_DIRECTORY 0x0000000000000010
193 #define EFI_FILE_ARCHIVE 0x0000000000000020
194 #define EFI_FILE_VALID_ATTR 0x0000000000000037
196 typedef
197 EFI_STATUS
198 (EFIAPI *EFI_FILE_CLOSE) (
199 IN struct _EFI_FILE_HANDLE *File
202 typedef
203 EFI_STATUS
204 (EFIAPI *EFI_FILE_DELETE) (
205 IN struct _EFI_FILE_HANDLE *File
208 typedef
209 EFI_STATUS
210 (EFIAPI *EFI_FILE_READ) (
211 IN struct _EFI_FILE_HANDLE *File,
212 IN OUT UINTN *BufferSize,
213 OUT VOID *Buffer
216 typedef
217 EFI_STATUS
218 (EFIAPI *EFI_FILE_WRITE) (
219 IN struct _EFI_FILE_HANDLE *File,
220 IN OUT UINTN *BufferSize,
221 IN VOID *Buffer
224 typedef
225 EFI_STATUS
226 (EFIAPI *EFI_FILE_SET_POSITION) (
227 IN struct _EFI_FILE_HANDLE *File,
228 IN UINT64 Position
231 typedef
232 EFI_STATUS
233 (EFIAPI *EFI_FILE_GET_POSITION) (
234 IN struct _EFI_FILE_HANDLE *File,
235 OUT UINT64 *Position
238 typedef
239 EFI_STATUS
240 (EFIAPI *EFI_FILE_GET_INFO) (
241 IN struct _EFI_FILE_HANDLE *File,
242 IN EFI_GUID *InformationType,
243 IN OUT UINTN *BufferSize,
244 OUT VOID *Buffer
247 typedef
248 EFI_STATUS
249 (EFIAPI *EFI_FILE_SET_INFO) (
250 IN struct _EFI_FILE_HANDLE *File,
251 IN EFI_GUID *InformationType,
252 IN UINTN BufferSize,
253 IN VOID *Buffer
256 typedef
257 EFI_STATUS
258 (EFIAPI *EFI_FILE_FLUSH) (
259 IN struct _EFI_FILE_HANDLE *File
264 #define EFI_FILE_HANDLE_REVISION 0x00010000
265 typedef struct _EFI_FILE_HANDLE {
266 UINT64 Revision;
267 EFI_FILE_OPEN Open;
268 EFI_FILE_CLOSE Close;
269 EFI_FILE_DELETE Delete;
270 EFI_FILE_READ Read;
271 EFI_FILE_WRITE Write;
272 EFI_FILE_GET_POSITION GetPosition;
273 EFI_FILE_SET_POSITION SetPosition;
274 EFI_FILE_GET_INFO GetInfo;
275 EFI_FILE_SET_INFO SetInfo;
276 EFI_FILE_FLUSH Flush;
277 } EFI_FILE, *EFI_FILE_HANDLE;
281 * File information types
284 #define EFI_FILE_INFO_ID \
285 { 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
287 typedef struct {
288 UINT64 Size;
289 UINT64 FileSize;
290 UINT64 PhysicalSize;
291 EFI_TIME CreateTime;
292 EFI_TIME LastAccessTime;
293 EFI_TIME ModificationTime;
294 UINT64 Attribute;
295 CHAR16 FileName[1];
296 } EFI_FILE_INFO;
299 * The FileName field of the EFI_FILE_INFO data structure is variable length.
300 * Whenever code needs to know the size of the EFI_FILE_INFO data structure,
301 * it needs to be the size of the data structure without the FileName field.
302 * The following macro computes this size correctly no matter how big the
303 * FileName array is declared. This is required to make the EFI_FILE_INFO
304 * data structure ANSI compliant.
307 #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
309 #define EFI_FILE_SYSTEM_INFO_ID \
310 { 0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
312 typedef struct {
313 UINT64 Size;
314 BOOLEAN ReadOnly;
315 UINT64 VolumeSize;
316 UINT64 FreeSpace;
317 UINT32 BlockSize;
318 CHAR16 VolumeLabel[1];
319 } EFI_FILE_SYSTEM_INFO;
322 * The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is
323 * variable length. Whenever code needs to know the size of the
324 * EFI_FILE_SYSTEM_INFO data structure, it needs to be the size of the data
325 * structure without the VolumeLable field. The following macro computes
326 * this size correctly no matter how big the VolumeLable array is declared.
327 * This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI
328 * compilant.
331 #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
333 #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
334 { 0xDB47D7D3,0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
336 typedef struct {
337 CHAR16 VolumeLabel[1];
338 } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
340 #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
343 * Load file protocol
346 #define LOAD_FILE_PROTOCOL \
347 { 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
349 INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
351 typedef
352 EFI_STATUS
353 (EFIAPI *EFI_LOAD_FILE) (
354 IN struct _EFI_LOAD_FILE_INTERFACE *This,
355 IN EFI_DEVICE_PATH *FilePath,
356 IN BOOLEAN BootPolicy,
357 IN OUT UINTN *BufferSize,
358 IN VOID *Buffer OPTIONAL
361 typedef struct _EFI_LOAD_FILE_INTERFACE {
362 EFI_LOAD_FILE LoadFile;
363 } EFI_LOAD_FILE_INTERFACE;
367 * Device IO protocol
370 #define DEVICE_IO_PROTOCOL \
371 { 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
373 INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
375 typedef enum {
376 IO_UINT8,
377 IO_UINT16,
378 IO_UINT32,
379 IO_UINT64,
381 * Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to
382 * MMIO
384 MMIO_COPY_UINT8,
385 MMIO_COPY_UINT16,
386 MMIO_COPY_UINT32,
387 MMIO_COPY_UINT64
388 } EFI_IO_WIDTH;
390 #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
391 ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
394 typedef
395 EFI_STATUS
396 (EFIAPI *EFI_DEVICE_IO) (
397 IN struct _EFI_DEVICE_IO_INTERFACE *This,
398 IN EFI_IO_WIDTH Width,
399 IN UINT64 Address,
400 IN UINTN Count,
401 IN OUT VOID *Buffer
404 typedef struct {
405 EFI_DEVICE_IO Read;
406 EFI_DEVICE_IO Write;
407 } EFI_IO_ACCESS;
409 typedef
410 EFI_STATUS
411 (EFIAPI *EFI_PCI_DEVICE_PATH) (
412 IN struct _EFI_DEVICE_IO_INTERFACE *This,
413 IN UINT64 Address,
414 IN OUT EFI_DEVICE_PATH **PciDevicePath
417 typedef enum {
418 EfiBusMasterRead,
419 EfiBusMasterWrite,
420 EfiBusMasterCommonBuffer
421 } EFI_IO_OPERATION_TYPE;
423 typedef
424 EFI_STATUS
425 (EFIAPI *EFI_IO_MAP) (
426 IN struct _EFI_DEVICE_IO_INTERFACE *This,
427 IN EFI_IO_OPERATION_TYPE Operation,
428 IN EFI_PHYSICAL_ADDRESS *HostAddress,
429 IN OUT UINTN *NumberOfBytes,
430 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
431 OUT VOID **Mapping
434 typedef
435 EFI_STATUS
436 (EFIAPI *EFI_IO_UNMAP) (
437 IN struct _EFI_DEVICE_IO_INTERFACE *This,
438 IN VOID *Mapping
441 typedef
442 EFI_STATUS
443 (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
444 IN struct _EFI_DEVICE_IO_INTERFACE *This,
445 IN EFI_ALLOCATE_TYPE Type,
446 IN EFI_MEMORY_TYPE MemoryType,
447 IN UINTN Pages,
448 IN OUT EFI_PHYSICAL_ADDRESS *HostAddress
451 typedef
452 EFI_STATUS
453 (EFIAPI *EFI_IO_FLUSH) (
454 IN struct _EFI_DEVICE_IO_INTERFACE *This
457 typedef
458 EFI_STATUS
459 (EFIAPI *EFI_IO_FREE_BUFFER) (
460 IN struct _EFI_DEVICE_IO_INTERFACE *This,
461 IN UINTN Pages,
462 IN EFI_PHYSICAL_ADDRESS HostAddress
465 typedef struct _EFI_DEVICE_IO_INTERFACE {
466 EFI_IO_ACCESS Mem;
467 EFI_IO_ACCESS Io;
468 EFI_IO_ACCESS Pci;
469 EFI_IO_MAP Map;
470 EFI_PCI_DEVICE_PATH PciDevicePath;
471 EFI_IO_UNMAP Unmap;
472 EFI_IO_ALLOCATE_BUFFER AllocateBuffer;
473 EFI_IO_FLUSH Flush;
474 EFI_IO_FREE_BUFFER FreeBuffer;
475 } EFI_DEVICE_IO_INTERFACE;
479 * Unicode Collation protocol
482 #define UNICODE_COLLATION_PROTOCOL \
483 { 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
485 #define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)
487 INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
489 typedef
490 INTN
491 (EFIAPI *EFI_UNICODE_STRICOLL) (
492 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
493 IN CHAR16 *s1,
494 IN CHAR16 *s2
497 typedef
498 BOOLEAN
499 (EFIAPI *EFI_UNICODE_METAIMATCH) (
500 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
501 IN CHAR16 *String,
502 IN CHAR16 *Pattern
505 typedef
506 VOID
507 (EFIAPI *EFI_UNICODE_STRLWR) (
508 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
509 IN OUT CHAR16 *Str
512 typedef
513 VOID
514 (EFIAPI *EFI_UNICODE_STRUPR) (
515 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
516 IN OUT CHAR16 *Str
519 typedef
520 VOID
521 (EFIAPI *EFI_UNICODE_FATTOSTR) (
522 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
523 IN UINTN FatSize,
524 IN CHAR8 *Fat,
525 OUT CHAR16 *String
528 typedef
529 BOOLEAN
530 (EFIAPI *EFI_UNICODE_STRTOFAT) (
531 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
532 IN CHAR16 *String,
533 IN UINTN FatSize,
534 OUT CHAR8 *Fat
538 typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
540 /* general */
541 EFI_UNICODE_STRICOLL StriColl;
542 EFI_UNICODE_METAIMATCH MetaiMatch;
543 EFI_UNICODE_STRLWR StrLwr;
544 EFI_UNICODE_STRUPR StrUpr;
546 /* for supporting fat volumes */
547 EFI_UNICODE_FATTOSTR FatToStr;
548 EFI_UNICODE_STRTOFAT StrToFat;
550 CHAR8 *SupportedLanguages;
551 } EFI_UNICODE_COLLATION_INTERFACE;
553 #endif