xref: /DragonStub/inc/efiprot.h (revision 8d8a3b5dfff1b7ee09673ffb6be764f29ede9d60)
1 #ifndef _EFI_PROT_H
2 #define _EFI_PROT_H
3 
4 /*++
5 
6 Copyright (c) 1998  Intel Corporation
7 
8 Module Name:
9 
10     efiprot.h
11 
12 Abstract:
13 
14     EFI Protocols
15 
16 
17 
18 Revision History
19 
20 --*/
21 
22 //
23 //  FPSWA library protocol
24 //
25 #define EFI_FPSWA_PROTOCOL_GUID \
26     { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
27 #define FPSWA_PROTOCOL EFI_FPSWA_PROTOCOL_GUID
28 
29 //
30 // Device Path protocol
31 //
32 
33 #define EFI_DEVICE_PATH_PROTOCOL_GUID \
34     { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
35 #define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID
36 
37 
38 //
39 // Block IO protocol
40 //
41 
42 #define EFI_BLOCK_IO_PROTOCOL_GUID \
43     { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
44 #define BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL_GUID
45 
46 #define EFI_BLOCK_IO_PROTOCOL_REVISION    0x00010000
47 #define EFI_BLOCK_IO_PROTOCOL_REVISION2   0x00020001
48 #define EFI_BLOCK_IO_PROTOCOL_REVISION3   ((2<<16) | 31)
49 #define EFI_BLOCK_IO_INTERFACE_REVISION   EFI_BLOCK_IO_PROTOCOL_REVISION
50 #define EFI_BLOCK_IO_INTERFACE_REVISION2  EFI_BLOCK_IO_PROTOCOL_REVISION2
51 #define EFI_BLOCK_IO_INTERFACE_REVISION3  EFI_BLOCK_IO_PROTOCOL_REVISION3
52 
53 INTERFACE_DECL(_EFI_BLOCK_IO_PROTOCOL);
54 
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_BLOCK_RESET) (
58     IN struct _EFI_BLOCK_IO_PROTOCOL  *This,
59     IN BOOLEAN                        ExtendedVerification
60     );
61 
62 typedef
63 EFI_STATUS
64 (EFIAPI *EFI_BLOCK_READ) (
65     IN struct _EFI_BLOCK_IO_PROTOCOL  *This,
66     IN UINT32                         MediaId,
67     IN EFI_LBA                        LBA,
68     IN UINTN                          BufferSize,
69     OUT VOID                          *Buffer
70     );
71 
72 
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_BLOCK_WRITE) (
76     IN struct _EFI_BLOCK_IO_PROTOCOL  *This,
77     IN UINT32                         MediaId,
78     IN EFI_LBA                        LBA,
79     IN UINTN                          BufferSize,
80     IN VOID                           *Buffer
81     );
82 
83 
84 typedef
85 EFI_STATUS
86 (EFIAPI *EFI_BLOCK_FLUSH) (
87     IN struct _EFI_BLOCK_IO_PROTOCOL  *This
88     );
89 
90 
91 
92 typedef struct {
93     UINT32              MediaId;
94     BOOLEAN             RemovableMedia;
95     BOOLEAN             MediaPresent;
96 
97     BOOLEAN             LogicalPartition;
98     BOOLEAN             ReadOnly;
99     BOOLEAN             WriteCaching;
100 
101     UINT32              BlockSize;
102     UINT32              IoAlign;
103 
104     EFI_LBA             LastBlock;
105 
106     /* revision 2 */
107     EFI_LBA             LowestAlignedLba;
108     UINT32              LogicalBlocksPerPhysicalBlock;
109     /* revision 3 */
110     UINT32              OptimalTransferLengthGranularity;
111 } EFI_BLOCK_IO_MEDIA;
112 
113 typedef struct _EFI_BLOCK_IO_PROTOCOL {
114     UINT64                  Revision;
115 
116     EFI_BLOCK_IO_MEDIA      *Media;
117 
118     EFI_BLOCK_RESET         Reset;
119     EFI_BLOCK_READ          ReadBlocks;
120     EFI_BLOCK_WRITE         WriteBlocks;
121     EFI_BLOCK_FLUSH         FlushBlocks;
122 
123 } EFI_BLOCK_IO_PROTOCOL;
124 
125 typedef struct _EFI_BLOCK_IO_PROTOCOL _EFI_BLOCK_IO;
126 typedef EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO;
127 
128 #define EFI_BLOCK_IO2_PROTOCOL_GUID \
129     { 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1} }
130 
131 INTERFACE_DECL(_EFI_BLOCK_IO2_PROTOCOL);
132 
133 typedef struct {
134     EFI_EVENT               Event;
135     EFI_STATUS              TransactionStatus;
136 } EFI_BLOCK_IO2_TOKEN;
137 
138 typedef
139 EFI_STATUS
140 (EFIAPI *EFI_BLOCK_RESET_EX) (
141     IN struct _EFI_BLOCK_IO2_PROTOCOL  *This,
142     IN BOOLEAN                         ExtendedVerification
143     );
144 
145 typedef
146 EFI_STATUS
147 (EFIAPI *EFI_BLOCK_READ_EX) (
148     IN struct _EFI_BLOCK_IO2_PROTOCOL  *This,
149     IN UINT32                          MediaId,
150     IN EFI_LBA                         LBA,
151     IN OUT EFI_BLOCK_IO2_TOKEN         *Token,
152     IN UINTN                           BufferSize,
153     OUT VOID                           *Buffer
154     );
155 
156 typedef
157 EFI_STATUS
158 (EFIAPI *EFI_BLOCK_WRITE_EX) (
159     IN struct _EFI_BLOCK_IO2_PROTOCOL  *This,
160     IN UINT32                          MediaId,
161     IN EFI_LBA                         LBA,
162     IN OUT EFI_BLOCK_IO2_TOKEN         *Token,
163     IN UINTN                           BufferSize,
164     IN VOID                            *Buffer
165     );
166 
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_BLOCK_FLUSH_EX) (
170     IN struct _EFI_BLOCK_IO2_PROTOCOL  *This,
171     IN OUT EFI_BLOCK_IO2_TOKEN         *Token
172     );
173 
174 typedef struct _EFI_BLOCK_IO2_PROTOCOL {
175     EFI_BLOCK_IO_MEDIA  *Media;
176     EFI_BLOCK_RESET_EX  Reset;
177     EFI_BLOCK_READ_EX   ReadBlocksEx;
178     EFI_BLOCK_WRITE_EX  WriteBlocksEx;
179     EFI_BLOCK_FLUSH_EX  FlushBlocksEx;
180 } EFI_BLOCK_IO2_PROTOCOL;
181 
182 //
183 // Disk Block IO protocol
184 //
185 
186 #define EFI_DISK_IO_PROTOCOL_GUID \
187     { 0xce345171, 0xba0b, 0x11d2,  {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
188 #define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID
189 
190 #define EFI_DISK_IO_PROTOCOL_REVISION  0x00010000
191 #define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION
192 
193 INTERFACE_DECL(_EFI_DISK_IO_PROTOCOL);
194 
195 typedef
196 EFI_STATUS
197 (EFIAPI *EFI_DISK_READ) (
198     IN struct _EFI_DISK_IO_PROTOCOL  *This,
199     IN UINT32                        MediaId,
200     IN UINT64                        Offset,
201     IN UINTN                         BufferSize,
202     OUT VOID                         *Buffer
203     );
204 
205 
206 typedef
207 EFI_STATUS
208 (EFIAPI *EFI_DISK_WRITE) (
209     IN struct _EFI_DISK_IO_PROTOCOL  *This,
210     IN UINT32                        MediaId,
211     IN UINT64                        Offset,
212     IN UINTN                         BufferSize,
213     IN VOID                          *Buffer
214     );
215 
216 
217 typedef struct _EFI_DISK_IO_PROTOCOL {
218     UINT64              Revision;
219     EFI_DISK_READ       ReadDisk;
220     EFI_DISK_WRITE      WriteDisk;
221 } EFI_DISK_IO_PROTOCOL;
222 
223 typedef struct _EFI_DISK_IO_PROTOCOL _EFI_DISK_IO;
224 typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;
225 
226 
227 #define EFI_DISK_IO2_PROTOCOL_GUID \
228     { 0x151c8eae, 0x7f2c, 0x472c,  {0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88} }
229 
230 #define EFI_DISK_IO2_PROTOCOL_REVISION  0x00020000
231 
232 INTERFACE_DECL(_EFI_DISK_IO2_PROTOCOL);
233 
234 typedef struct {
235     EFI_EVENT  Event;
236     EFI_STATUS TransactionStatus;
237 } EFI_DISK_IO2_TOKEN;
238 
239 typedef
240 EFI_STATUS
241 (EFIAPI *EFI_DISK_CANCEL_EX) (
242     IN struct _EFI_DISK_IO2_PROTOCOL  *This
243     );
244 
245 typedef
246 EFI_STATUS
247 (EFIAPI *EFI_DISK_READ_EX) (
248     IN struct _EFI_DISK_IO2_PROTOCOL  *This,
249     IN UINT32                         MediaId,
250     IN UINT64                         Offset,
251     IN OUT EFI_DISK_IO2_TOKEN         *Token,
252     IN UINTN                          BufferSize,
253     OUT VOID                          *Buffer
254     );
255 
256 typedef
257 EFI_STATUS
258 (EFIAPI *EFI_DISK_WRITE_EX) (
259     IN struct _EFI_DISK_IO2_PROTOCOL  *This,
260     IN UINT32                         MediaId,
261     IN UINT64                         Offset,
262     IN OUT EFI_DISK_IO2_TOKEN         *Token,
263     IN UINTN                          BufferSize,
264     IN VOID                           *Buffer
265     );
266 
267 typedef
268 EFI_STATUS
269 (EFIAPI *EFI_DISK_FLUSH_EX) (
270     IN struct _EFI_DISK_IO2_PROTOCOL  *This,
271     IN OUT EFI_DISK_IO2_TOKEN         *Token
272     );
273 
274 typedef struct _EFI_DISK_IO2_PROTOCOL {
275     UINT64                            Revision;
276     EFI_DISK_CANCEL_EX                Cancel;
277     EFI_DISK_READ_EX                  ReadDiskEx;
278     EFI_DISK_WRITE_EX                 WriteDiskEx;
279     EFI_DISK_FLUSH_EX                 FlushDiskEx;
280 } EFI_DISK_IO2_PROTOCOL;
281 
282 //
283 // Simple file system protocol
284 //
285 
286 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
287     { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
288 #define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
289 
290 INTERFACE_DECL(_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL);
291 INTERFACE_DECL(_EFI_FILE_HANDLE);
292 
293 typedef
294 EFI_STATUS
295 (EFIAPI *EFI_VOLUME_OPEN) (
296     IN struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    *This,
297     OUT struct _EFI_FILE_HANDLE                   **Root
298     );
299 
300 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION  0x00010000
301 #define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION
302 
303 typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
304     UINT64                  Revision;
305     EFI_VOLUME_OPEN         OpenVolume;
306 } EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
307 
308 typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL _EFI_FILE_IO_INTERFACE;
309 typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE;
310 
311 //
312 //
313 //
314 
315 typedef
316 EFI_STATUS
317 (EFIAPI *EFI_FILE_OPEN) (
318     IN struct _EFI_FILE_HANDLE  *File,
319     OUT struct _EFI_FILE_HANDLE **NewHandle,
320     IN CHAR16                   *FileName,
321     IN UINT64                   OpenMode,
322     IN UINT64                   Attributes
323     );
324 
325 // Open modes
326 #define EFI_FILE_MODE_READ      0x0000000000000001
327 #define EFI_FILE_MODE_WRITE     0x0000000000000002
328 #define EFI_FILE_MODE_CREATE    0x8000000000000000
329 
330 // File attributes
331 #define EFI_FILE_READ_ONLY      0x0000000000000001
332 #define EFI_FILE_HIDDEN         0x0000000000000002
333 #define EFI_FILE_SYSTEM         0x0000000000000004
334 #define EFI_FILE_RESERVIED      0x0000000000000008
335 #define EFI_FILE_DIRECTORY      0x0000000000000010
336 #define EFI_FILE_ARCHIVE        0x0000000000000020
337 #define EFI_FILE_VALID_ATTR     0x0000000000000037
338 
339 typedef
340 EFI_STATUS
341 (EFIAPI *EFI_FILE_CLOSE) (
342     IN struct _EFI_FILE_HANDLE  *File
343     );
344 
345 typedef
346 EFI_STATUS
347 (EFIAPI *EFI_FILE_DELETE) (
348     IN struct _EFI_FILE_HANDLE  *File
349     );
350 
351 typedef
352 EFI_STATUS
353 (EFIAPI *EFI_FILE_READ) (
354     IN struct _EFI_FILE_HANDLE  *File,
355     IN OUT UINTN                *BufferSize,
356     OUT VOID                    *Buffer
357     );
358 
359 typedef
360 EFI_STATUS
361 (EFIAPI *EFI_FILE_WRITE) (
362     IN struct _EFI_FILE_HANDLE  *File,
363     IN OUT UINTN                *BufferSize,
364     IN VOID                     *Buffer
365     );
366 
367 typedef
368 EFI_STATUS
369 (EFIAPI *EFI_FILE_SET_POSITION) (
370     IN struct _EFI_FILE_HANDLE  *File,
371     IN UINT64                   Position
372     );
373 
374 typedef
375 EFI_STATUS
376 (EFIAPI *EFI_FILE_GET_POSITION) (
377     IN struct _EFI_FILE_HANDLE  *File,
378     OUT UINT64                  *Position
379     );
380 
381 typedef
382 EFI_STATUS
383 (EFIAPI *EFI_FILE_GET_INFO) (
384     IN struct _EFI_FILE_HANDLE  *File,
385     IN EFI_GUID                 *InformationType,
386     IN OUT UINTN                *BufferSize,
387     OUT VOID                    *Buffer
388     );
389 
390 typedef
391 EFI_STATUS
392 (EFIAPI *EFI_FILE_SET_INFO) (
393     IN struct _EFI_FILE_HANDLE  *File,
394     IN EFI_GUID                 *InformationType,
395     IN UINTN                    BufferSize,
396     IN VOID                     *Buffer
397     );
398 
399 typedef
400 EFI_STATUS
401 (EFIAPI *EFI_FILE_FLUSH) (
402     IN struct _EFI_FILE_HANDLE  *File
403     );
404 
405 typedef struct {
406     EFI_EVENT       Event;
407     EFI_STATUS      Status;
408     UINTN           BufferSize;
409     VOID            *Buffer;
410 } EFI_FILE_IO_TOKEN;
411 
412 typedef
413 EFI_STATUS
414 (EFIAPI *EFI_FILE_OPEN_EX)(
415     IN struct _EFI_FILE_HANDLE  *File,
416     OUT struct _EFI_FILE_HANDLE **NewHandle,
417     IN CHAR16                   *FileName,
418     IN UINT64                   OpenMode,
419     IN UINT64                   Attributes,
420     IN OUT EFI_FILE_IO_TOKEN    *Token
421     );
422 
423 typedef
424 EFI_STATUS
425 (EFIAPI *EFI_FILE_READ_EX) (
426     IN struct _EFI_FILE_HANDLE  *File,
427     IN OUT EFI_FILE_IO_TOKEN    *Token
428     );
429 
430 typedef
431 EFI_STATUS
432 (EFIAPI *EFI_FILE_WRITE_EX) (
433     IN struct _EFI_FILE_HANDLE  *File,
434     IN OUT EFI_FILE_IO_TOKEN    *Token
435     );
436 
437 typedef
438 EFI_STATUS
439 (EFIAPI *EFI_FILE_FLUSH_EX) (
440     IN struct _EFI_FILE_HANDLE  *File,
441     IN OUT EFI_FILE_IO_TOKEN    *Token
442     );
443 
444 #define EFI_FILE_PROTOCOL_REVISION         0x00010000
445 #define EFI_FILE_PROTOCOL_REVISION2        0x00020000
446 #define EFI_FILE_PROTOCOL_LATEST_REVISION  EFI_FILE_PROTOCOL_REVISION2
447 #define EFI_FILE_HANDLE_REVISION           EFI_FILE_PROTOCOL_REVISION
448 
449 typedef struct _EFI_FILE_HANDLE {
450     UINT64                  Revision;
451     EFI_FILE_OPEN           Open;
452     EFI_FILE_CLOSE          Close;
453     EFI_FILE_DELETE         Delete;
454     EFI_FILE_READ           Read;
455     EFI_FILE_WRITE          Write;
456     EFI_FILE_GET_POSITION   GetPosition;
457     EFI_FILE_SET_POSITION   SetPosition;
458     EFI_FILE_GET_INFO       GetInfo;
459     EFI_FILE_SET_INFO       SetInfo;
460     EFI_FILE_FLUSH          Flush;
461     EFI_FILE_OPEN_EX        OpenEx;
462     EFI_FILE_READ_EX        ReadEx;
463     EFI_FILE_WRITE_EX       WriteEx;
464     EFI_FILE_FLUSH_EX       FlushEx;
465 } EFI_FILE_PROTOCOL, *EFI_FILE_HANDLE;
466 
467 typedef EFI_FILE_PROTOCOL EFI_FILE;
468 
469 
470 //
471 // File information types
472 //
473 
474 #define EFI_FILE_INFO_ID   \
475     { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
476 
477 typedef struct {
478     UINT64                  Size;
479     UINT64                  FileSize;
480     UINT64                  PhysicalSize;
481     EFI_TIME                CreateTime;
482     EFI_TIME                LastAccessTime;
483     EFI_TIME                ModificationTime;
484     UINT64                  Attribute;
485     CHAR16                  FileName[1];
486 } EFI_FILE_INFO;
487 
488 //
489 // The FileName field of the EFI_FILE_INFO data structure is variable length.
490 // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
491 // be the size of the data structure without the FileName field.  The following macro
492 // computes this size correctly no matter how big the FileName array is declared.
493 // This is required to make the EFI_FILE_INFO data structure ANSI compilant.
494 //
495 
496 #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
497 
498 #define EFI_FILE_SYSTEM_INFO_ID    \
499     { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
500 
501 typedef struct {
502     UINT64                  Size;
503     BOOLEAN                 ReadOnly;
504     UINT64                  VolumeSize;
505     UINT64                  FreeSpace;
506     UINT32                  BlockSize;
507     CHAR16                  VolumeLabel[1];
508 } EFI_FILE_SYSTEM_INFO;
509 
510 //
511 // The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
512 // Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
513 // to be the size of the data structure without the VolumeLable field.  The following macro
514 // computes this size correctly no matter how big the VolumeLable array is declared.
515 // This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
516 //
517 
518 #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
519 
520 #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID    \
521     { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
522 
523 typedef struct {
524     CHAR16                  VolumeLabel[1];
525 } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
526 
527 #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
528 
529 //
530 // Load file protocol
531 //
532 
533 
534 #define EFI_LOAD_FILE_PROTOCOL_GUID \
535     { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
536 #define LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL_GUID
537 
538 INTERFACE_DECL(_EFI_LOAD_FILE_PROTOCOL);
539 
540 typedef
541 EFI_STATUS
542 (EFIAPI *EFI_LOAD_FILE) (
543     IN struct _EFI_LOAD_FILE_PROTOCOL  *This,
544     IN EFI_DEVICE_PATH                  *FilePath,
545     IN BOOLEAN                          BootPolicy,
546     IN OUT UINTN                        *BufferSize,
547     IN VOID                             *Buffer OPTIONAL
548     );
549 
550 typedef struct _EFI_LOAD_FILE_PROTOCOL {
551     EFI_LOAD_FILE                       LoadFile;
552 } EFI_LOAD_FILE_PROTOCOL;
553 
554 typedef struct _EFI_LOAD_FILE_PROTOCOL _EFI_LOAD_FILE_INTERFACE;
555 typedef EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_INTERFACE;
556 
557 //
558 // Device IO protocol
559 //
560 
561 #define EFI_DEVICE_IO_PROTOCOL_GUID \
562     { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
563 #define DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL_GUID
564 
565 INTERFACE_DECL(_EFI_DEVICE_IO_PROTOCOL);
566 
567 typedef enum {
568     IO_UINT8,
569     IO_UINT16,
570     IO_UINT32,
571     IO_UINT64,
572 //
573 // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
574 //
575     MMIO_COPY_UINT8,
576     MMIO_COPY_UINT16,
577     MMIO_COPY_UINT32,
578     MMIO_COPY_UINT64
579 } EFI_IO_WIDTH;
580 
581 #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
582     ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
583 
584 
585 typedef
586 EFI_STATUS
587 (EFIAPI *EFI_DEVICE_IO) (
588     IN struct _EFI_DEVICE_IO_PROTOCOL *This,
589     IN EFI_IO_WIDTH                 Width,
590     IN UINT64                       Address,
591     IN UINTN                        Count,
592     IN OUT VOID                     *Buffer
593     );
594 
595 typedef struct {
596     EFI_DEVICE_IO                   Read;
597     EFI_DEVICE_IO                   Write;
598 } EFI_IO_ACCESS;
599 
600 typedef
601 EFI_STATUS
602 (EFIAPI *EFI_PCI_DEVICE_PATH) (
603     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
604     IN UINT64                           Address,
605     IN OUT EFI_DEVICE_PATH              **PciDevicePath
606     );
607 
608 typedef enum {
609     EfiBusMasterRead,
610     EfiBusMasterWrite,
611     EfiBusMasterCommonBuffer
612 } EFI_IO_OPERATION_TYPE;
613 
614 typedef
615 EFI_STATUS
616 (EFIAPI *EFI_IO_MAP) (
617     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
618     IN EFI_IO_OPERATION_TYPE            Operation,
619     IN EFI_PHYSICAL_ADDRESS             *HostAddress,
620     IN OUT UINTN                        *NumberOfBytes,
621     OUT EFI_PHYSICAL_ADDRESS            *DeviceAddress,
622     OUT VOID                            **Mapping
623     );
624 
625 typedef
626 EFI_STATUS
627 (EFIAPI *EFI_IO_UNMAP) (
628     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
629     IN VOID                             *Mapping
630     );
631 
632 typedef
633 EFI_STATUS
634 (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
635     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
636     IN EFI_ALLOCATE_TYPE                Type,
637     IN EFI_MEMORY_TYPE                  MemoryType,
638     IN UINTN                            Pages,
639     IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress
640     );
641 
642 typedef
643 EFI_STATUS
644 (EFIAPI *EFI_IO_FLUSH) (
645     IN struct _EFI_DEVICE_IO_PROTOCOL   *This
646     );
647 
648 typedef
649 EFI_STATUS
650 (EFIAPI *EFI_IO_FREE_BUFFER) (
651     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
652     IN UINTN                            Pages,
653     IN EFI_PHYSICAL_ADDRESS             HostAddress
654     );
655 
656 typedef struct _EFI_DEVICE_IO_PROTOCOL {
657     EFI_IO_ACCESS                       Mem;
658     EFI_IO_ACCESS                       Io;
659     EFI_IO_ACCESS                       Pci;
660     EFI_IO_MAP                          Map;
661     EFI_PCI_DEVICE_PATH                 PciDevicePath;
662     EFI_IO_UNMAP                        Unmap;
663     EFI_IO_ALLOCATE_BUFFER              AllocateBuffer;
664     EFI_IO_FLUSH                        Flush;
665     EFI_IO_FREE_BUFFER                  FreeBuffer;
666 } EFI_DEVICE_IO_PROTOCOL;
667 
668 typedef struct _EFI_DEVICE_IO_PROTOCOL _EFI_DEVICE_IO_INTERFACE;
669 typedef EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_INTERFACE;
670 
671 //
672 // Unicode Collation protocol
673 //
674 
675 #define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
676     { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc,  0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
677 #define UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL_GUID
678 
679 #define EFI_UNICODE_BYTE_ORDER_MARK       (CHAR16)(0xfeff)
680 #define UNICODE_BYTE_ORDER_MARK EFI_UNICODE_BYTE_ORDER_MARK
681 
682 INTERFACE_DECL(_EFI_UNICODE_COLLATION_PROTOCOL);
683 
684 typedef
685 INTN
686 (EFIAPI *EFI_UNICODE_STRICOLL) (
687     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
688     IN CHAR16                         *s1,
689     IN CHAR16                         *s2
690     );
691 
692 typedef
693 BOOLEAN
694 (EFIAPI *EFI_UNICODE_METAIMATCH) (
695     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
696     IN CHAR16                         *String,
697     IN CHAR16                         *Pattern
698     );
699 
700 typedef
701 VOID
702 (EFIAPI *EFI_UNICODE_STRLWR) (
703     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
704     IN OUT CHAR16                       *Str
705     );
706 
707 typedef
708 VOID
709 (EFIAPI *EFI_UNICODE_STRUPR) (
710     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
711     IN OUT CHAR16                       *Str
712     );
713 
714 typedef
715 VOID
716 (EFIAPI *EFI_UNICODE_FATTOSTR) (
717     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
718     IN UINTN                            FatSize,
719     IN CHAR8                            *Fat,
720     OUT CHAR16                          *String
721     );
722 
723 typedef
724 BOOLEAN
725 (EFIAPI *EFI_UNICODE_STRTOFAT) (
726     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
727     IN CHAR16                           *String,
728     IN UINTN                            FatSize,
729     OUT CHAR8                           *Fat
730     );
731 
732 //
733 // Hash Protocol
734 //
735 #define EFI_HASH_PROTOCOL_GUID \
736   { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 } }
737 #define HASH_PROTOCOL EFI_HASH_PROTOCOL_GUID
738 
739 #define EFI_HASH_ALGORITHM_SHA1_GUID \
740   { 0x2AE9D80F, 0x3FB2, 0x4095, { 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6 } } // Deprecated
741 #define EFI_HASH_ALGORITHM_SHA1 EFI_HASH_ALGORITHM_SHA1_GUID
742 
743 #define EFI_HASH_ALGORITHM_SHA224_GUID \
744   { 0x8DF01A06, 0x9BD5, 0x4BF7, { 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B } } // Deprecated
745 #define EFI_HASH_ALGORITHM_SHA224 EFI_HASH_ALGORITHM_SHA224_GUID
746 
747 #define EFI_HASH_ALGORITHM_SHA256_GUID \
748   { 0x51AA59DE, 0xFDF2, 0x4EA3, { 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9 } } // Deprecated
749 #define EFI_HASH_ALGORITHM_SHA256 EFI_HASH_ALGORITHM_SHA256_GUID
750 
751 #define EFI_HASH_ALGORITHM_SHA384_GUID \
752   { 0xEFA96432, 0xDE33, 0x4DD2, { 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A } } // Deprecated
753 #define EFI_HASH_ALGORITHM_SHA384 EFI_HASH_ALGORITHM_SHA384_GUID
754 
755 #define EFI_HASH_ALGORITHM_SHA512_GUID \
756   { 0xCAA4381E, 0x750C, 0x4770, { 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30 } } // Deprecated
757 #define EFI_HASH_ALGORITHM_SHA512 EFI_HASH_ALGORITHM_SHA512_GUID
758 
759 #define EFI_HASH_ALGORITHM_MD5_GUID \
760   { 0x0AF7C79C, 0x65B5, 0x4319, { 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7 } } // Deprecated
761 #define EFI_HASH_ALGORITHM_MD5 EFI_HASH_ALGORITHM_MD5_GUID
762 
763 #define EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID \
764   { 0x24C5DC2F, 0x53E2, 0x40CA, { 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B } }
765 #define EFI_HASH_ALGORITHM_SHA1_NOPAD EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID
766 
767 #define EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID \
768   { 0x8628752A, 0x6CB7, 0x4814, { 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26 } }
769 #define EFI_HASH_ALGORITHM_SHA256_NOPAD EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID
770 
771 
772 INTERFACE_DECL(_EFI_HASH_PROTOCOL);
773 
774 typedef UINT8 EFI_MD5_HASH[16];
775 typedef UINT8 EFI_SHA1_HASH[20];
776 typedef UINT8 EFI_SHA224_HASH[28];
777 typedef UINT8 EFI_SHA256_HASH[32];
778 typedef UINT8 EFI_SHA384_HASH[48];
779 typedef UINT8 EFI_SHA512_HASH[64];
780 typedef union _EFI_HASH_OUTPUT {
781   EFI_MD5_HASH                    *Md5Hash;
782   EFI_SHA1_HASH                   *Sha1Hash;
783   EFI_SHA224_HASH                 *Sha224Hash;
784   EFI_SHA256_HASH                 *Sha256Hash;
785   EFI_SHA384_HASH                 *Sha384Hash;
786   EFI_SHA512_HASH                 *Sha512Hash;
787 } EFI_HASH_OUTPUT;
788 
789 typedef
790 EFI_STATUS
791 (EFIAPI *EFI_HASH_GET_HASH_SIZE) (
792   IN CONST struct _EFI_HASH_PROTOCOL  *This,
793   IN CONST EFI_GUID               *HashAlgorithm,
794   OUT UINTN                       *HashSize);
795 
796 typedef
797 EFI_STATUS
798 (EFIAPI *EFI_HASH_HASH) (
799   IN CONST struct _EFI_HASH_PROTOCOL  *This,
800   IN CONST EFI_GUID               *HashAlgorithm,
801   IN BOOLEAN                      Extend,
802   IN CONST UINT8                  *Message,
803   IN UINT64                       MessageSize,
804   IN OUT EFI_HASH_OUTPUT          *Hash);
805 
806 typedef struct _EFI_HASH_PROTOCOL {
807   EFI_HASH_GET_HASH_SIZE                  GetHashSize;
808   EFI_HASH_HASH                           Hash;
809 } EFI_HASH_PROTOCOL;
810 
811 typedef struct _EFI_HASH_PROTOCOL _EFI_HASH;
812 typedef EFI_HASH_PROTOCOL EFI_HASH;
813 
814 
815 typedef struct _EFI_UNICODE_COLLATION_PROTOCOL {
816 
817     // general
818     EFI_UNICODE_STRICOLL                StriColl;
819     EFI_UNICODE_METAIMATCH              MetaiMatch;
820     EFI_UNICODE_STRLWR                  StrLwr;
821     EFI_UNICODE_STRUPR                  StrUpr;
822 
823     // for supporting fat volumes
824     EFI_UNICODE_FATTOSTR                FatToStr;
825     EFI_UNICODE_STRTOFAT                StrToFat;
826 
827     CHAR8                               *SupportedLanguages;
828 } EFI_UNICODE_COLLATION_PROTOCOL;
829 
830 typedef EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_INTERFACE;
831 
832 /* Graphics output protocol */
833 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
834    { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } }
835 typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
836 
837 typedef struct {
838   UINT32            RedMask;
839   UINT32            GreenMask;
840   UINT32            BlueMask;
841   UINT32            ReservedMask;
842 } EFI_PIXEL_BITMASK;
843 
844 typedef enum {
845   PixelRedGreenBlueReserved8BitPerColor,
846   PixelBlueGreenRedReserved8BitPerColor,
847   PixelBitMask,
848   PixelBltOnly,
849   PixelFormatMax
850 } EFI_GRAPHICS_PIXEL_FORMAT;
851 
852 typedef struct {
853   UINT32                     Version;
854   UINT32                     HorizontalResolution;
855   UINT32                     VerticalResolution;
856   EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
857   EFI_PIXEL_BITMASK          PixelInformation;
858   UINT32                     PixelsPerScanLine;
859 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
860 
861 /**
862   Return the current video mode information.
863 
864   @param  This       Protocol instance pointer.
865   @param  ModeNumber The mode number to return information on.
866   @param  SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
867   @param  Info       A pointer to callee allocated buffer that returns information about ModeNumber.
868 
869   @retval EFI_SUCCESS           Mode information returned.
870   @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.
871   @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.
872   @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()
873   @retval EFI_INVALID_PARAMETER One of the input args was NULL.
874 
875 **/
876 typedef
877 EFI_STATUS
878 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
879   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
880   IN  UINT32                                ModeNumber,
881   OUT UINTN                                 *SizeOfInfo,
882   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
883   )
884 ;
885 
886 /**
887   Return the current video mode information.
888 
889   @param  This              Protocol instance pointer.
890   @param  ModeNumber        The mode number to be set.
891 
892   @retval EFI_SUCCESS       Graphics mode was changed.
893   @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.
894   @retval EFI_UNSUPPORTED   ModeNumber is not supported by this device.
895 
896 **/
897 typedef
898 EFI_STATUS
899 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
900   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
901   IN  UINT32                       ModeNumber
902   );
903 
904 typedef struct {
905   UINT8 Blue;
906   UINT8 Green;
907   UINT8 Red;
908   UINT8 Reserved;
909 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
910 
911 typedef union {
912   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
913   UINT32                        Raw;
914 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
915 
916 typedef enum {
917   EfiBltVideoFill,
918   EfiBltVideoToBltBuffer,
919   EfiBltBufferToVideo,
920   EfiBltVideoToVideo,
921   EfiGraphicsOutputBltOperationMax
922 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
923 
924 /**
925   The following table defines actions for BltOperations:
926 
927   <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY)
928   directly to every pixel of the video display rectangle
929   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
930   Only one pixel will be used from the BltBuffer. Delta is NOT used.
931 
932   <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
933   (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
934   the BltBuffer rectangle (DestinationX, DestinationY )
935   (DestinationX + Width, DestinationY + Height). If DestinationX or
936   DestinationY is not zero then Delta must be set to the length in bytes
937   of a row in the BltBuffer.
938 
939   <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle
940   (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
941   video display rectangle (DestinationX, DestinationY)
942   (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
943   not zero then Delta must be set to the length in bytes of a row in the
944   BltBuffer.
945 
946   <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
947   (SourceX + Width, SourceY + Height) .to the video display rectangle
948   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
949   The BltBuffer and Delta  are not used in this mode.
950 
951   @param  This         Protocol instance pointer.
952   @param  BltBuffer    Buffer containing data to blit into video buffer. This
953                        buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
954   @param  BltOperation Operation to perform on BlitBuffer and video memory
955   @param  SourceX      X coordinate of source for the BltBuffer.
956   @param  SourceY      Y coordinate of source for the BltBuffer.
957   @param  DestinationX X coordinate of destination for the BltBuffer.
958   @param  DestinationY Y coordinate of destination for the BltBuffer.
959   @param  Width        Width of rectangle in BltBuffer in pixels.
960   @param  Height       Hight of rectangle in BltBuffer in pixels.
961   @param  Delta        OPTIONAL
962 
963   @retval EFI_SUCCESS           The Blt operation completed.
964   @retval EFI_INVALID_PARAMETER BltOperation is not valid.
965   @retval EFI_DEVICE_ERROR      A hardware error occured writting to the video buffer.
966 
967 **/
968 typedef
969 EFI_STATUS
970 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
971   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,
972   IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           *BltBuffer,   OPTIONAL
973   IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,
974   IN  UINTN                                   SourceX,
975   IN  UINTN                                   SourceY,
976   IN  UINTN                                   DestinationX,
977   IN  UINTN                                   DestinationY,
978   IN  UINTN                                   Width,
979   IN  UINTN                                   Height,
980   IN  UINTN                                   Delta         OPTIONAL
981   );
982 
983 typedef struct {
984   UINT32                                 MaxMode;
985   UINT32                                 Mode;
986   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;
987   UINTN                                  SizeOfInfo;
988   EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
989   UINTN                                  FrameBufferSize;
990 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
991 
992 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
993   EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;
994   EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;
995   EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;
996   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;
997 };
998 
999 
1000 
1001 /*
1002  * EFI EDID Discovered Protocol
1003  * UEFI Specification Version 2.5 Section 11.9
1004  */
1005 #define EFI_EDID_DISCOVERED_PROTOCOL_GUID \
1006     { 0x1C0C34F6, 0xD380, 0x41FA, { 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA} }
1007 
1008 typedef struct _EFI_EDID_DISCOVERED_PROTOCOL {
1009     UINT32   SizeOfEdid;
1010     UINT8   *Edid;
1011 } EFI_EDID_DISCOVERED_PROTOCOL;
1012 
1013 
1014 
1015 /*
1016  * EFI EDID Active Protocol
1017  * UEFI Specification Version 2.5 Section 11.9
1018  */
1019 #define EFI_EDID_ACTIVE_PROTOCOL_GUID \
1020     { 0xBD8C1056, 0x9F36, 0x44EC, { 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86} }
1021 
1022 typedef struct _EFI_EDID_ACTIVE_PROTOCOL {
1023     UINT32   SizeOfEdid;
1024     UINT8   *Edid;
1025 } EFI_EDID_ACTIVE_PROTOCOL;
1026 
1027 
1028 
1029 /*
1030  * EFI EDID Override Protocol
1031  * UEFI Specification Version 2.5 Section 11.9
1032  */
1033 #define EFI_EDID_OVERRIDE_PROTOCOL_GUID \
1034     { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5} }
1035 
1036 INTERFACE_DECL(_EFI_EDID_OVERRIDE_PROTOCOL);
1037 
1038 typedef
1039 EFI_STATUS
1040 (EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) (
1041   IN      struct _EFI_EDID_OVERRIDE_PROTOCOL   *This,
1042   IN      EFI_HANDLE                           *ChildHandle,
1043   OUT     UINT32                               *Attributes,
1044   IN OUT  UINTN                                *EdidSize,
1045   IN OUT  UINT8                               **Edid);
1046 
1047 typedef struct _EFI_EDID_OVERRIDE_PROTOCOL {
1048     EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID  GetEdid;
1049 } EFI_EDID_OVERRIDE_PROTOCOL;
1050 
1051 
1052 
1053 INTERFACE_DECL(_EFI_SERVICE_BINDING);
1054 
1055 typedef
1056 EFI_STATUS
1057 (EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) (
1058     IN struct _EFI_SERVICE_BINDING *This,
1059     IN EFI_HANDLE                  *ChildHandle
1060     );
1061 
1062 typedef
1063 EFI_STATUS
1064 (EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) (
1065     IN struct _EFI_SERVICE_BINDING *This,
1066     IN EFI_HANDLE                  ChildHandle
1067     );
1068 
1069 typedef struct _EFI_SERVICE_BINDING {
1070     EFI_SERVICE_BINDING_CREATE_CHILD  CreateChild;
1071     EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild;
1072 } EFI_SERVICE_BINDING;
1073 
1074 
1075 
1076 /*
1077  * EFI Driver Binding Protocol
1078  * UEFI Specification Version 2.5 Section 10.1
1079  */
1080 #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
1081     { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71} }
1082 #define DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL_GUID
1083 
1084 INTERFACE_DECL(_EFI_DRIVER_BINDING_PROTOCOL);
1085 
1086 typedef
1087 EFI_STATUS
1088 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED) (
1089   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1090   IN      EFI_HANDLE                          ControllerHandle,
1091   IN      EFI_DEVICE_PATH                     *RemainingDevicePath OPTIONAL);
1092 
1093 typedef
1094 EFI_STATUS
1095 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_START) (
1096   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1097   IN      EFI_HANDLE                          ControllerHandle,
1098   IN      EFI_DEVICE_PATH                     *RemainingDevicePath OPTIONAL);
1099 
1100 typedef
1101 EFI_STATUS
1102 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_STOP) (
1103   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1104   IN      EFI_HANDLE                          ControllerHandle,
1105   IN      UINTN                               NumberOfChildren,
1106   IN      EFI_HANDLE                          *ChildHandleBuffer OPTIONAL);
1107 
1108 typedef struct _EFI_DRIVER_BINDING_PROTOCOL {
1109   EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED       Supported;
1110   EFI_DRIVER_BINDING_PROTOCOL_START           Start;
1111   EFI_DRIVER_BINDING_PROTOCOL_STOP            Stop;
1112   UINT32                                      Version;
1113   EFI_HANDLE                                  ImageHandle;
1114   EFI_HANDLE                                  DriverBindingHandle;
1115 } EFI_DRIVER_BINDING_PROTOCOL;
1116 
1117 typedef struct _EFI_DRIVER_BINDING_PROTOCOL _EFI_DRIVER_BINDING;
1118 typedef EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING;
1119 
1120 
1121 /*
1122  * Backwards compatibility with older GNU-EFI versions. Deprecated.
1123  */
1124 #define EFI_DRIVER_SUPPORTED         EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED
1125 #define EFI_DRIVER_START             EFI_DRIVER_BINDING_PROTOCOL_START
1126 #define EFI_DRIVER_STOP              EFI_DRIVER_BINDING_PROTOCOL_STOP
1127 
1128 
1129 
1130 /*
1131  * EFI Component Name Protocol
1132  * Deprecated - use EFI Component Name 2 Protocol instead
1133  */
1134 #define EFI_COMPONENT_NAME_PROTOCOL_GUID \
1135     {0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
1136 #define COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL_GUID
1137 
1138 INTERFACE_DECL(_EFI_COMPONENT_NAME_PROTOCOL);
1139 
1140 typedef
1141 EFI_STATUS
1142 (EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) (
1143   IN      struct _EFI_COMPONENT_NAME_PROTOCOL   *This,
1144   IN      CHAR8                                 *Language,
1145   OUT     CHAR16                                **DriverName);
1146 
1147 typedef
1148 EFI_STATUS
1149 (EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) (
1150   IN      struct _EFI_COMPONENT_NAME_PROTOCOL   *This,
1151   IN      EFI_HANDLE                            ControllerHandle,
1152   IN      EFI_HANDLE                            ChildHandle OPTIONAL,
1153   IN      CHAR8                                 *Language,
1154   OUT     CHAR16                                **ControllerName);
1155 
1156 typedef struct _EFI_COMPONENT_NAME_PROTOCOL {
1157   EFI_COMPONENT_NAME_GET_DRIVER_NAME      GetDriverName;
1158   EFI_COMPONENT_NAME_GET_CONTROLLER_NAME  GetControllerName;
1159   CHAR8                                   *SupportedLanguages;
1160 } EFI_COMPONENT_NAME_PROTOCOL;
1161 
1162 typedef struct _EFI_COMPONENT_NAME_PROTOCOL _EFI_COMPONENT_NAME;
1163 typedef EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME;
1164 
1165 
1166 /*
1167  * EFI Component Name 2 Protocol
1168  * UEFI Specification Version 2.5 Section 10.5
1169  */
1170 #define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
1171     {0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14} }
1172 #define COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL_GUID
1173 
1174 INTERFACE_DECL(_EFI_COMPONENT_NAME2_PROTOCOL);
1175 
1176 typedef
1177 EFI_STATUS
1178 (EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) (
1179   IN      struct _EFI_COMPONENT_NAME2_PROTOCOL   *This,
1180   IN      CHAR8                                  *Language,
1181   OUT     CHAR16                                 **DriverName);
1182 
1183 typedef
1184 EFI_STATUS
1185 (EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) (
1186   IN      struct _EFI_COMPONENT_NAME2_PROTOCOL   *This,
1187   IN      EFI_HANDLE                             ControllerHandle,
1188   IN      EFI_HANDLE                             ChildHandle OPTIONAL,
1189   IN      CHAR8                                  *Language,
1190   OUT     CHAR16                                 **ControllerName);
1191 
1192 typedef struct _EFI_COMPONENT_NAME2_PROTOCOL {
1193   EFI_COMPONENT_NAME2_GET_DRIVER_NAME       GetDriverName;
1194   EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME   GetControllerName;
1195   CHAR8                                     *SupportedLanguages;
1196 } EFI_COMPONENT_NAME2_PROTOCOL;
1197 
1198 typedef struct _EFI_COMPONENT_NAME2_PROTOCOL _EFI_COMPONENT_NAME2;
1199 typedef EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2;
1200 
1201 
1202 
1203 /*
1204  * EFI Loaded Image Protocol
1205  * UEFI Specification Version 2.5 Section 8.1
1206  */
1207 #define EFI_LOADED_IMAGE_PROTOCOL_GUID \
1208     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
1209 #define LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE_PROTOCOL_GUID
1210 
1211 #define EFI_LOADED_IMAGE_PROTOCOL_REVISION  0x1000
1212 #define EFI_IMAGE_INFORMATION_REVISION  EFI_LOADED_IMAGE_PROTOCOL_REVISION
1213 
1214 typedef
1215 EFI_STATUS
1216 (EFIAPI *EFI_IMAGE_UNLOAD) (
1217     IN EFI_HANDLE                   ImageHandle
1218     );
1219 
1220 typedef struct {
1221     UINT32                          Revision;
1222     EFI_HANDLE                      ParentHandle;
1223     struct _EFI_SYSTEM_TABLE        *SystemTable;
1224 
1225     // Source location of image
1226     EFI_HANDLE                      DeviceHandle;
1227     EFI_DEVICE_PATH                 *FilePath;
1228     VOID                            *Reserved;
1229 
1230     // Images load options
1231     UINT32                          LoadOptionsSize;
1232     VOID                            *LoadOptions;
1233 
1234     // Location of where image was loaded
1235     VOID                            *ImageBase;
1236     UINT64                          ImageSize;
1237     EFI_MEMORY_TYPE                 ImageCodeType;
1238     EFI_MEMORY_TYPE                 ImageDataType;
1239 
1240     // If the driver image supports a dynamic unload request
1241     EFI_IMAGE_UNLOAD                Unload;
1242 } EFI_LOADED_IMAGE_PROTOCOL;
1243 
1244 typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE;
1245 
1246 
1247 
1248 /*
1249  * Random Number Generator Protocol
1250  * UEFI Specification Version 2.5 Section 35.5
1251  */
1252 #define EFI_RNG_PROTOCOL_GUID                          \
1253           { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} }
1254 
1255 typedef EFI_GUID EFI_RNG_ALGORITHM;
1256 
1257 #define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID       \
1258      {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} }
1259 
1260 #define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID       \
1261      {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} }
1262 
1263 #define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID        \
1264      {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} }
1265 
1266 #define EFI_RNG_ALGORITHM_X9_31_3DES_GUID              \
1267      {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} }
1268 
1269 #define EFI_RNG_ALGORITHM_X9_31_AES_GUID               \
1270      {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} }
1271 
1272 #define EFI_RNG_ALGORITHM_RAW                          \
1273      {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} }
1274 
1275 INTERFACE_DECL(_EFI_RNG_PROTOCOL);
1276 
1277 typedef
1278 EFI_STATUS
1279 (EFIAPI *EFI_RNG_GET_INFO) (
1280   IN      struct _EFI_RNG_PROTOCOL   *This,
1281   IN OUT  UINTN                      *RNGAlgorithmListSize,
1282   OUT     EFI_RNG_ALGORITHM          *RNGAlgorithmList
1283 );
1284 
1285 typedef
1286 EFI_STATUS
1287 (EFIAPI *EFI_RNG_GET_RNG) (
1288   IN      struct _EFI_RNG_PROTOCOL   *This,
1289   IN      EFI_RNG_ALGORITHM          *RNGAlgorithm,           OPTIONAL
1290   IN      UINTN                      RNGValueLength,
1291   OUT     UINT8                      *RNGValue
1292 );
1293 
1294 typedef struct _EFI_RNG_PROTOCOL {
1295           EFI_RNG_GET_INFO           GetInfo;
1296           EFI_RNG_GET_RNG            GetRNG;
1297 } EFI_RNG_PROTOCOL;
1298 
1299 
1300 //
1301 // EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL
1302 //
1303 
1304 #define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID          \
1305           { 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
1306 
1307 INTERFACE_DECL(_EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL);
1308 
1309 typedef
1310 EFI_STATUS
1311 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) (
1312 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1313 IN      EFI_HANDLE                                      ControllerHandle,
1314 IN OUT  EFI_HANDLE                                     *DriverImageHandle);
1315 
1316 typedef
1317 EFI_STATUS
1318 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) (
1319 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1320 IN      EFI_HANDLE                                      ControllerHandle,
1321 IN OUT  EFI_DEVICE_PATH                               **DriverImagePath);
1322 
1323 typedef
1324 EFI_STATUS
1325 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) (
1326 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1327 IN      EFI_HANDLE                                      ControllerHandle,
1328 IN      EFI_DEVICE_PATH                                *DriverImagePath,
1329 IN      EFI_HANDLE                                      DriverImageHandle);
1330 
1331 typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL {
1332   EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;
1333   EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH  GetDriverPath;
1334   EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED    DriverLoaded;
1335 } EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL;
1336 
1337 //
1338 // EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL
1339 //
1340 
1341 #define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID          \
1342           { 0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65} }
1343 
1344 INTERFACE_DECL(_EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL);
1345 
1346 typedef
1347 EFI_STATUS
1348 (EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) (
1349 IN      struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  *This,
1350 IN OUT  EFI_HANDLE                                         *DriverImageHandle);
1351 
1352 typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {
1353   EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;
1354 } EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;
1355 
1356 //
1357 // EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL
1358 //
1359 
1360 #define EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID          \
1361           { 0xb1ee129e, 0xda36, 0x4181, {0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7} }
1362 
1363 INTERFACE_DECL(_EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL);
1364 
1365 typedef
1366 UINT32
1367 (EFIAPI *EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION) (
1368 IN      struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL  *This);
1369 
1370 typedef struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL {
1371   EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION       GetVersion;
1372 } EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL;
1373 
1374 //
1375 // EFI_EBC_PROTOCOL
1376 //
1377 
1378 #define EFI_EBC_INTERPRETER_PROTOCOL_GUID              \
1379      {0x13ac6dd1, 0x73d0, 0x11d4, {0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7} }
1380 
1381 #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
1382 
1383 INTERFACE_DECL(_EFI_EBC_PROTOCOL);
1384 
1385 typedef
1386 EFI_STATUS
1387 (EFIAPI *EFI_EBC_CREATE_THUNK)(
1388   IN struct _EFI_EBC_PROTOCOL   *This,
1389   IN EFI_HANDLE                 ImageHandle,
1390   IN VOID                       *EbcEntryPoint,
1391   OUT VOID                      **Thunk);
1392 
1393 typedef
1394 EFI_STATUS
1395 (EFIAPI *EFI_EBC_UNLOAD_IMAGE)(
1396   IN struct _EFI_EBC_PROTOCOL   *This,
1397   IN EFI_HANDLE                 ImageHandle);
1398 
1399 typedef
1400 EFI_STATUS
1401 (EFIAPI *EBC_ICACHE_FLUSH)(
1402   IN EFI_PHYSICAL_ADDRESS       Start,
1403   IN UINT64                     Length);
1404 
1405 typedef
1406 EFI_STATUS
1407 (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(
1408   IN struct _EFI_EBC_PROTOCOL   *This,
1409   IN EBC_ICACHE_FLUSH           Flush);
1410 
1411 typedef
1412 EFI_STATUS
1413 (EFIAPI *EFI_EBC_GET_VERSION)(
1414   IN struct _EFI_EBC_PROTOCOL   *This,
1415   IN OUT UINT64                 *Version);
1416 
1417 typedef struct _EFI_EBC_PROTOCOL {
1418   EFI_EBC_CREATE_THUNK          CreateThunk;
1419   EFI_EBC_UNLOAD_IMAGE          UnloadImage;
1420   EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;
1421   EFI_EBC_GET_VERSION           GetVersion;
1422 } EFI_EBC_PROTOCOL;
1423 
1424 #endif
1425