xref: /DragonStub/inc/efiprot.h (revision 447ad9aa3af1b2f6ef8a41e1f00197249a81aab6)
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 struct _EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL;
831 typedef EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_INTERFACE;
832 
833 /* Graphics output protocol */
834 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
835    { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } }
836 typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
837 
838 typedef struct {
839   UINT32            RedMask;
840   UINT32            GreenMask;
841   UINT32            BlueMask;
842   UINT32            ReservedMask;
843 } EFI_PIXEL_BITMASK;
844 
845 typedef enum {
846   PixelRedGreenBlueReserved8BitPerColor,
847   PixelBlueGreenRedReserved8BitPerColor,
848   PixelBitMask,
849   PixelBltOnly,
850   PixelFormatMax
851 } EFI_GRAPHICS_PIXEL_FORMAT;
852 
853 typedef struct {
854   UINT32                     Version;
855   UINT32                     HorizontalResolution;
856   UINT32                     VerticalResolution;
857   EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
858   EFI_PIXEL_BITMASK          PixelInformation;
859   UINT32                     PixelsPerScanLine;
860 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
861 
862 /**
863   Return the current video mode information.
864 
865   @param  This       Protocol instance pointer.
866   @param  ModeNumber The mode number to return information on.
867   @param  SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
868   @param  Info       A pointer to callee allocated buffer that returns information about ModeNumber.
869 
870   @retval EFI_SUCCESS           Mode information returned.
871   @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.
872   @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.
873   @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()
874   @retval EFI_INVALID_PARAMETER One of the input args was NULL.
875 
876 **/
877 typedef
878 EFI_STATUS
879 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
880   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
881   IN  UINT32                                ModeNumber,
882   OUT UINTN                                 *SizeOfInfo,
883   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
884   )
885 ;
886 
887 /**
888   Return the current video mode information.
889 
890   @param  This              Protocol instance pointer.
891   @param  ModeNumber        The mode number to be set.
892 
893   @retval EFI_SUCCESS       Graphics mode was changed.
894   @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.
895   @retval EFI_UNSUPPORTED   ModeNumber is not supported by this device.
896 
897 **/
898 typedef
899 EFI_STATUS
900 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
901   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
902   IN  UINT32                       ModeNumber
903   );
904 
905 typedef struct {
906   UINT8 Blue;
907   UINT8 Green;
908   UINT8 Red;
909   UINT8 Reserved;
910 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
911 
912 typedef union {
913   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
914   UINT32                        Raw;
915 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
916 
917 typedef enum {
918   EfiBltVideoFill,
919   EfiBltVideoToBltBuffer,
920   EfiBltBufferToVideo,
921   EfiBltVideoToVideo,
922   EfiGraphicsOutputBltOperationMax
923 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
924 
925 /**
926   The following table defines actions for BltOperations:
927 
928   <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY)
929   directly to every pixel of the video display rectangle
930   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
931   Only one pixel will be used from the BltBuffer. Delta is NOT used.
932 
933   <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
934   (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
935   the BltBuffer rectangle (DestinationX, DestinationY )
936   (DestinationX + Width, DestinationY + Height). If DestinationX or
937   DestinationY is not zero then Delta must be set to the length in bytes
938   of a row in the BltBuffer.
939 
940   <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle
941   (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
942   video display rectangle (DestinationX, DestinationY)
943   (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
944   not zero then Delta must be set to the length in bytes of a row in the
945   BltBuffer.
946 
947   <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
948   (SourceX + Width, SourceY + Height) .to the video display rectangle
949   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
950   The BltBuffer and Delta  are not used in this mode.
951 
952   @param  This         Protocol instance pointer.
953   @param  BltBuffer    Buffer containing data to blit into video buffer. This
954                        buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
955   @param  BltOperation Operation to perform on BlitBuffer and video memory
956   @param  SourceX      X coordinate of source for the BltBuffer.
957   @param  SourceY      Y coordinate of source for the BltBuffer.
958   @param  DestinationX X coordinate of destination for the BltBuffer.
959   @param  DestinationY Y coordinate of destination for the BltBuffer.
960   @param  Width        Width of rectangle in BltBuffer in pixels.
961   @param  Height       Hight of rectangle in BltBuffer in pixels.
962   @param  Delta        OPTIONAL
963 
964   @retval EFI_SUCCESS           The Blt operation completed.
965   @retval EFI_INVALID_PARAMETER BltOperation is not valid.
966   @retval EFI_DEVICE_ERROR      A hardware error occured writting to the video buffer.
967 
968 **/
969 typedef
970 EFI_STATUS
971 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
972   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,
973   IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           *BltBuffer,   OPTIONAL
974   IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,
975   IN  UINTN                                   SourceX,
976   IN  UINTN                                   SourceY,
977   IN  UINTN                                   DestinationX,
978   IN  UINTN                                   DestinationY,
979   IN  UINTN                                   Width,
980   IN  UINTN                                   Height,
981   IN  UINTN                                   Delta         OPTIONAL
982   );
983 
984 typedef struct {
985   UINT32                                 MaxMode;
986   UINT32                                 Mode;
987   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;
988   UINTN                                  SizeOfInfo;
989   EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
990   UINTN                                  FrameBufferSize;
991 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
992 
993 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
994   EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;
995   EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;
996   EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;
997   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;
998 };
999 
1000 
1001 
1002 /*
1003  * EFI EDID Discovered Protocol
1004  * UEFI Specification Version 2.5 Section 11.9
1005  */
1006 #define EFI_EDID_DISCOVERED_PROTOCOL_GUID \
1007     { 0x1C0C34F6, 0xD380, 0x41FA, { 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA} }
1008 
1009 typedef struct _EFI_EDID_DISCOVERED_PROTOCOL {
1010     UINT32   SizeOfEdid;
1011     UINT8   *Edid;
1012 } EFI_EDID_DISCOVERED_PROTOCOL;
1013 
1014 
1015 
1016 /*
1017  * EFI EDID Active Protocol
1018  * UEFI Specification Version 2.5 Section 11.9
1019  */
1020 #define EFI_EDID_ACTIVE_PROTOCOL_GUID \
1021     { 0xBD8C1056, 0x9F36, 0x44EC, { 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86} }
1022 
1023 typedef struct _EFI_EDID_ACTIVE_PROTOCOL {
1024     UINT32   SizeOfEdid;
1025     UINT8   *Edid;
1026 } EFI_EDID_ACTIVE_PROTOCOL;
1027 
1028 
1029 
1030 /*
1031  * EFI EDID Override Protocol
1032  * UEFI Specification Version 2.5 Section 11.9
1033  */
1034 #define EFI_EDID_OVERRIDE_PROTOCOL_GUID \
1035     { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5} }
1036 
1037 INTERFACE_DECL(_EFI_EDID_OVERRIDE_PROTOCOL);
1038 
1039 typedef
1040 EFI_STATUS
1041 (EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) (
1042   IN      struct _EFI_EDID_OVERRIDE_PROTOCOL   *This,
1043   IN      EFI_HANDLE                           *ChildHandle,
1044   OUT     UINT32                               *Attributes,
1045   IN OUT  UINTN                                *EdidSize,
1046   IN OUT  UINT8                               **Edid);
1047 
1048 typedef struct _EFI_EDID_OVERRIDE_PROTOCOL {
1049     EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID  GetEdid;
1050 } EFI_EDID_OVERRIDE_PROTOCOL;
1051 
1052 
1053 
1054 INTERFACE_DECL(_EFI_SERVICE_BINDING);
1055 
1056 typedef
1057 EFI_STATUS
1058 (EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) (
1059     IN struct _EFI_SERVICE_BINDING *This,
1060     IN EFI_HANDLE                  *ChildHandle
1061     );
1062 
1063 typedef
1064 EFI_STATUS
1065 (EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) (
1066     IN struct _EFI_SERVICE_BINDING *This,
1067     IN EFI_HANDLE                  ChildHandle
1068     );
1069 
1070 typedef struct _EFI_SERVICE_BINDING {
1071     EFI_SERVICE_BINDING_CREATE_CHILD  CreateChild;
1072     EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild;
1073 } EFI_SERVICE_BINDING;
1074 
1075 
1076 
1077 /*
1078  * EFI Driver Binding Protocol
1079  * UEFI Specification Version 2.5 Section 10.1
1080  */
1081 #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
1082     { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71} }
1083 #define DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL_GUID
1084 
1085 INTERFACE_DECL(_EFI_DRIVER_BINDING_PROTOCOL);
1086 
1087 typedef
1088 EFI_STATUS
1089 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED) (
1090   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1091   IN      EFI_HANDLE                          ControllerHandle,
1092   IN      EFI_DEVICE_PATH                     *RemainingDevicePath OPTIONAL);
1093 
1094 typedef
1095 EFI_STATUS
1096 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_START) (
1097   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1098   IN      EFI_HANDLE                          ControllerHandle,
1099   IN      EFI_DEVICE_PATH                     *RemainingDevicePath OPTIONAL);
1100 
1101 typedef
1102 EFI_STATUS
1103 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_STOP) (
1104   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1105   IN      EFI_HANDLE                          ControllerHandle,
1106   IN      UINTN                               NumberOfChildren,
1107   IN      EFI_HANDLE                          *ChildHandleBuffer OPTIONAL);
1108 
1109 typedef struct _EFI_DRIVER_BINDING_PROTOCOL {
1110   EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED       Supported;
1111   EFI_DRIVER_BINDING_PROTOCOL_START           Start;
1112   EFI_DRIVER_BINDING_PROTOCOL_STOP            Stop;
1113   UINT32                                      Version;
1114   EFI_HANDLE                                  ImageHandle;
1115   EFI_HANDLE                                  DriverBindingHandle;
1116 } EFI_DRIVER_BINDING_PROTOCOL;
1117 
1118 typedef struct _EFI_DRIVER_BINDING_PROTOCOL _EFI_DRIVER_BINDING;
1119 typedef EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING;
1120 
1121 
1122 /*
1123  * Backwards compatibility with older GNU-EFI versions. Deprecated.
1124  */
1125 #define EFI_DRIVER_SUPPORTED         EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED
1126 #define EFI_DRIVER_START             EFI_DRIVER_BINDING_PROTOCOL_START
1127 #define EFI_DRIVER_STOP              EFI_DRIVER_BINDING_PROTOCOL_STOP
1128 
1129 
1130 
1131 /*
1132  * EFI Component Name Protocol
1133  * Deprecated - use EFI Component Name 2 Protocol instead
1134  */
1135 #define EFI_COMPONENT_NAME_PROTOCOL_GUID \
1136     {0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
1137 #define COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL_GUID
1138 
1139 INTERFACE_DECL(_EFI_COMPONENT_NAME_PROTOCOL);
1140 
1141 typedef
1142 EFI_STATUS
1143 (EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) (
1144   IN      struct _EFI_COMPONENT_NAME_PROTOCOL   *This,
1145   IN      CHAR8                                 *Language,
1146   OUT     CHAR16                                **DriverName);
1147 
1148 typedef
1149 EFI_STATUS
1150 (EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) (
1151   IN      struct _EFI_COMPONENT_NAME_PROTOCOL   *This,
1152   IN      EFI_HANDLE                            ControllerHandle,
1153   IN      EFI_HANDLE                            ChildHandle OPTIONAL,
1154   IN      CHAR8                                 *Language,
1155   OUT     CHAR16                                **ControllerName);
1156 
1157 typedef struct _EFI_COMPONENT_NAME_PROTOCOL {
1158   EFI_COMPONENT_NAME_GET_DRIVER_NAME      GetDriverName;
1159   EFI_COMPONENT_NAME_GET_CONTROLLER_NAME  GetControllerName;
1160   CHAR8                                   *SupportedLanguages;
1161 } EFI_COMPONENT_NAME_PROTOCOL;
1162 
1163 typedef struct _EFI_COMPONENT_NAME_PROTOCOL _EFI_COMPONENT_NAME;
1164 typedef EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME;
1165 
1166 
1167 /*
1168  * EFI Component Name 2 Protocol
1169  * UEFI Specification Version 2.5 Section 10.5
1170  */
1171 #define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
1172     {0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14} }
1173 #define COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL_GUID
1174 
1175 INTERFACE_DECL(_EFI_COMPONENT_NAME2_PROTOCOL);
1176 
1177 typedef
1178 EFI_STATUS
1179 (EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) (
1180   IN      struct _EFI_COMPONENT_NAME2_PROTOCOL   *This,
1181   IN      CHAR8                                  *Language,
1182   OUT     CHAR16                                 **DriverName);
1183 
1184 typedef
1185 EFI_STATUS
1186 (EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) (
1187   IN      struct _EFI_COMPONENT_NAME2_PROTOCOL   *This,
1188   IN      EFI_HANDLE                             ControllerHandle,
1189   IN      EFI_HANDLE                             ChildHandle OPTIONAL,
1190   IN      CHAR8                                  *Language,
1191   OUT     CHAR16                                 **ControllerName);
1192 
1193 typedef struct _EFI_COMPONENT_NAME2_PROTOCOL {
1194   EFI_COMPONENT_NAME2_GET_DRIVER_NAME       GetDriverName;
1195   EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME   GetControllerName;
1196   CHAR8                                     *SupportedLanguages;
1197 } EFI_COMPONENT_NAME2_PROTOCOL;
1198 
1199 typedef struct _EFI_COMPONENT_NAME2_PROTOCOL _EFI_COMPONENT_NAME2;
1200 typedef EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2;
1201 
1202 
1203 
1204 /*
1205  * EFI Loaded Image Protocol
1206  * UEFI Specification Version 2.5 Section 8.1
1207  */
1208 #define EFI_LOADED_IMAGE_PROTOCOL_GUID \
1209     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
1210 #define LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE_PROTOCOL_GUID
1211 
1212 #define EFI_LOADED_IMAGE_PROTOCOL_REVISION  0x1000
1213 #define EFI_IMAGE_INFORMATION_REVISION  EFI_LOADED_IMAGE_PROTOCOL_REVISION
1214 
1215 typedef
1216 EFI_STATUS
1217 (EFIAPI *EFI_IMAGE_UNLOAD) (
1218     IN EFI_HANDLE                   ImageHandle
1219     );
1220 
1221 typedef struct {
1222     UINT32                          Revision;
1223     EFI_HANDLE                      ParentHandle;
1224     struct _EFI_SYSTEM_TABLE        *SystemTable;
1225 
1226     // Source location of image
1227     EFI_HANDLE                      DeviceHandle;
1228     EFI_DEVICE_PATH                 *FilePath;
1229     VOID                            *Reserved;
1230 
1231     // Images load options
1232     UINT32                          LoadOptionsSize;
1233     VOID                            *LoadOptions;
1234 
1235     // Location of where image was loaded
1236     VOID                            *ImageBase;
1237     UINT64                          ImageSize;
1238     EFI_MEMORY_TYPE                 ImageCodeType;
1239     EFI_MEMORY_TYPE                 ImageDataType;
1240 
1241     // If the driver image supports a dynamic unload request
1242     EFI_IMAGE_UNLOAD                Unload;
1243 } EFI_LOADED_IMAGE_PROTOCOL;
1244 
1245 typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE;
1246 
1247 
1248 
1249 /*
1250  * Random Number Generator Protocol
1251  * UEFI Specification Version 2.5 Section 35.5
1252  */
1253 #define EFI_RNG_PROTOCOL_GUID                          \
1254           { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} }
1255 
1256 typedef EFI_GUID EFI_RNG_ALGORITHM;
1257 
1258 #define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID       \
1259      {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} }
1260 
1261 #define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID       \
1262      {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} }
1263 
1264 #define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID        \
1265      {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} }
1266 
1267 #define EFI_RNG_ALGORITHM_X9_31_3DES_GUID              \
1268      {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} }
1269 
1270 #define EFI_RNG_ALGORITHM_X9_31_AES_GUID               \
1271      {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} }
1272 
1273 #define EFI_RNG_ALGORITHM_RAW                          \
1274      {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} }
1275 
1276 INTERFACE_DECL(_EFI_RNG_PROTOCOL);
1277 
1278 typedef
1279 EFI_STATUS
1280 (EFIAPI *EFI_RNG_GET_INFO) (
1281   IN      struct _EFI_RNG_PROTOCOL   *This,
1282   IN OUT  UINTN                      *RNGAlgorithmListSize,
1283   OUT     EFI_RNG_ALGORITHM          *RNGAlgorithmList
1284 );
1285 
1286 typedef
1287 EFI_STATUS
1288 (EFIAPI *EFI_RNG_GET_RNG) (
1289   IN      struct _EFI_RNG_PROTOCOL   *This,
1290   IN      EFI_RNG_ALGORITHM          *RNGAlgorithm,           OPTIONAL
1291   IN      UINTN                      RNGValueLength,
1292   OUT     UINT8                      *RNGValue
1293 );
1294 
1295 typedef struct _EFI_RNG_PROTOCOL {
1296           EFI_RNG_GET_INFO           GetInfo;
1297           EFI_RNG_GET_RNG            GetRNG;
1298 } EFI_RNG_PROTOCOL;
1299 
1300 
1301 //
1302 // EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL
1303 //
1304 
1305 #define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID          \
1306           { 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
1307 
1308 INTERFACE_DECL(_EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL);
1309 
1310 typedef
1311 EFI_STATUS
1312 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) (
1313 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1314 IN      EFI_HANDLE                                      ControllerHandle,
1315 IN OUT  EFI_HANDLE                                     *DriverImageHandle);
1316 
1317 typedef
1318 EFI_STATUS
1319 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) (
1320 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1321 IN      EFI_HANDLE                                      ControllerHandle,
1322 IN OUT  EFI_DEVICE_PATH                               **DriverImagePath);
1323 
1324 typedef
1325 EFI_STATUS
1326 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) (
1327 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1328 IN      EFI_HANDLE                                      ControllerHandle,
1329 IN      EFI_DEVICE_PATH                                *DriverImagePath,
1330 IN      EFI_HANDLE                                      DriverImageHandle);
1331 
1332 typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL {
1333   EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;
1334   EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH  GetDriverPath;
1335   EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED    DriverLoaded;
1336 } EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL;
1337 
1338 //
1339 // EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL
1340 //
1341 
1342 #define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID          \
1343           { 0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65} }
1344 
1345 INTERFACE_DECL(_EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL);
1346 
1347 typedef
1348 EFI_STATUS
1349 (EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) (
1350 IN      struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  *This,
1351 IN OUT  EFI_HANDLE                                         *DriverImageHandle);
1352 
1353 typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {
1354   EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;
1355 } EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;
1356 
1357 //
1358 // EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL
1359 //
1360 
1361 #define EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID          \
1362           { 0xb1ee129e, 0xda36, 0x4181, {0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7} }
1363 
1364 INTERFACE_DECL(_EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL);
1365 
1366 typedef
1367 UINT32
1368 (EFIAPI *EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION) (
1369 IN      struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL  *This);
1370 
1371 typedef struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL {
1372   EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION       GetVersion;
1373 } EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL;
1374 
1375 //
1376 // EFI_EBC_PROTOCOL
1377 //
1378 
1379 #define EFI_EBC_INTERPRETER_PROTOCOL_GUID              \
1380      {0x13ac6dd1, 0x73d0, 0x11d4, {0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7} }
1381 
1382 #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
1383 
1384 INTERFACE_DECL(_EFI_EBC_PROTOCOL);
1385 
1386 typedef
1387 EFI_STATUS
1388 (EFIAPI *EFI_EBC_CREATE_THUNK)(
1389   IN struct _EFI_EBC_PROTOCOL   *This,
1390   IN EFI_HANDLE                 ImageHandle,
1391   IN VOID                       *EbcEntryPoint,
1392   OUT VOID                      **Thunk);
1393 
1394 typedef
1395 EFI_STATUS
1396 (EFIAPI *EFI_EBC_UNLOAD_IMAGE)(
1397   IN struct _EFI_EBC_PROTOCOL   *This,
1398   IN EFI_HANDLE                 ImageHandle);
1399 
1400 typedef
1401 EFI_STATUS
1402 (EFIAPI *EBC_ICACHE_FLUSH)(
1403   IN EFI_PHYSICAL_ADDRESS       Start,
1404   IN UINT64                     Length);
1405 
1406 typedef
1407 EFI_STATUS
1408 (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(
1409   IN struct _EFI_EBC_PROTOCOL   *This,
1410   IN EBC_ICACHE_FLUSH           Flush);
1411 
1412 typedef
1413 EFI_STATUS
1414 (EFIAPI *EFI_EBC_GET_VERSION)(
1415   IN struct _EFI_EBC_PROTOCOL   *This,
1416   IN OUT UINT64                 *Version);
1417 
1418 typedef struct _EFI_EBC_PROTOCOL {
1419   EFI_EBC_CREATE_THUNK          CreateThunk;
1420   EFI_EBC_UNLOAD_IMAGE          UnloadImage;
1421   EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;
1422   EFI_EBC_GET_VERSION           GetVersion;
1423 } EFI_EBC_PROTOCOL;
1424 
1425 #endif
1426