xref: /DragonStub/inc/efiprot.h (revision f5bb5112de133f8bbeac4585099ba76d16147565)
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_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;
526 
527 #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL,VolumeLabel)
528 
529 //
530 // For compatibility with older versions of gnu-efi
531 //
532 #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID EFI_FILE_SYSTEM_VOLUME_LABEL_ID
533 #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO    EFI_FILE_SYSTEM_VOLUME_LABEL
534 
535 //
536 // Load file protocol
537 //
538 
539 
540 #define EFI_LOAD_FILE_PROTOCOL_GUID \
541     { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
542 #define LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL_GUID
543 
544 INTERFACE_DECL(_EFI_LOAD_FILE_PROTOCOL);
545 
546 typedef
547 EFI_STATUS
548 (EFIAPI *EFI_LOAD_FILE) (
549     IN struct _EFI_LOAD_FILE_PROTOCOL  *This,
550     IN EFI_DEVICE_PATH                  *FilePath,
551     IN BOOLEAN                          BootPolicy,
552     IN OUT UINTN                        *BufferSize,
553     IN VOID                             *Buffer OPTIONAL
554     );
555 
556 typedef struct _EFI_LOAD_FILE_PROTOCOL {
557     EFI_LOAD_FILE                       LoadFile;
558 } EFI_LOAD_FILE_PROTOCOL;
559 
560 typedef struct _EFI_LOAD_FILE_PROTOCOL _EFI_LOAD_FILE_INTERFACE;
561 typedef EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_INTERFACE;
562 
563 //
564 // Device IO protocol
565 //
566 
567 #define EFI_DEVICE_IO_PROTOCOL_GUID \
568     { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
569 #define DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL_GUID
570 
571 INTERFACE_DECL(_EFI_DEVICE_IO_PROTOCOL);
572 
573 typedef enum {
574     IO_UINT8,
575     IO_UINT16,
576     IO_UINT32,
577     IO_UINT64,
578 //
579 // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
580 //
581     MMIO_COPY_UINT8,
582     MMIO_COPY_UINT16,
583     MMIO_COPY_UINT32,
584     MMIO_COPY_UINT64
585 } EFI_IO_WIDTH;
586 
587 #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
588     ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
589 
590 
591 typedef
592 EFI_STATUS
593 (EFIAPI *EFI_DEVICE_IO) (
594     IN struct _EFI_DEVICE_IO_PROTOCOL *This,
595     IN EFI_IO_WIDTH                 Width,
596     IN UINT64                       Address,
597     IN UINTN                        Count,
598     IN OUT VOID                     *Buffer
599     );
600 
601 typedef struct {
602     EFI_DEVICE_IO                   Read;
603     EFI_DEVICE_IO                   Write;
604 } EFI_IO_ACCESS;
605 
606 typedef
607 EFI_STATUS
608 (EFIAPI *EFI_PCI_DEVICE_PATH) (
609     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
610     IN UINT64                           Address,
611     IN OUT EFI_DEVICE_PATH              **PciDevicePath
612     );
613 
614 typedef enum {
615     EfiBusMasterRead,
616     EfiBusMasterWrite,
617     EfiBusMasterCommonBuffer
618 } EFI_IO_OPERATION_TYPE;
619 
620 typedef
621 EFI_STATUS
622 (EFIAPI *EFI_IO_MAP) (
623     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
624     IN EFI_IO_OPERATION_TYPE            Operation,
625     IN EFI_PHYSICAL_ADDRESS             *HostAddress,
626     IN OUT UINTN                        *NumberOfBytes,
627     OUT EFI_PHYSICAL_ADDRESS            *DeviceAddress,
628     OUT VOID                            **Mapping
629     );
630 
631 typedef
632 EFI_STATUS
633 (EFIAPI *EFI_IO_UNMAP) (
634     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
635     IN VOID                             *Mapping
636     );
637 
638 typedef
639 EFI_STATUS
640 (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
641     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
642     IN EFI_ALLOCATE_TYPE                Type,
643     IN EFI_MEMORY_TYPE                  MemoryType,
644     IN UINTN                            Pages,
645     IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress
646     );
647 
648 typedef
649 EFI_STATUS
650 (EFIAPI *EFI_IO_FLUSH) (
651     IN struct _EFI_DEVICE_IO_PROTOCOL   *This
652     );
653 
654 typedef
655 EFI_STATUS
656 (EFIAPI *EFI_IO_FREE_BUFFER) (
657     IN struct _EFI_DEVICE_IO_PROTOCOL   *This,
658     IN UINTN                            Pages,
659     IN EFI_PHYSICAL_ADDRESS             HostAddress
660     );
661 
662 typedef struct _EFI_DEVICE_IO_PROTOCOL {
663     EFI_IO_ACCESS                       Mem;
664     EFI_IO_ACCESS                       Io;
665     EFI_IO_ACCESS                       Pci;
666     EFI_IO_MAP                          Map;
667     EFI_PCI_DEVICE_PATH                 PciDevicePath;
668     EFI_IO_UNMAP                        Unmap;
669     EFI_IO_ALLOCATE_BUFFER              AllocateBuffer;
670     EFI_IO_FLUSH                        Flush;
671     EFI_IO_FREE_BUFFER                  FreeBuffer;
672 } EFI_DEVICE_IO_PROTOCOL;
673 
674 typedef struct _EFI_DEVICE_IO_PROTOCOL _EFI_DEVICE_IO_INTERFACE;
675 typedef EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_INTERFACE;
676 
677 //
678 // Unicode Collation protocol
679 //
680 
681 #define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
682     { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc,  0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
683 #define UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL_GUID
684 
685 #define EFI_UNICODE_BYTE_ORDER_MARK       (CHAR16)(0xfeff)
686 #define UNICODE_BYTE_ORDER_MARK EFI_UNICODE_BYTE_ORDER_MARK
687 
688 INTERFACE_DECL(_EFI_UNICODE_COLLATION_PROTOCOL);
689 
690 typedef
691 INTN
692 (EFIAPI *EFI_UNICODE_STRICOLL) (
693     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
694     IN CHAR16                         *s1,
695     IN CHAR16                         *s2
696     );
697 
698 typedef
699 BOOLEAN
700 (EFIAPI *EFI_UNICODE_METAIMATCH) (
701     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
702     IN CHAR16                         *String,
703     IN CHAR16                         *Pattern
704     );
705 
706 typedef
707 VOID
708 (EFIAPI *EFI_UNICODE_STRLWR) (
709     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
710     IN OUT CHAR16                       *Str
711     );
712 
713 typedef
714 VOID
715 (EFIAPI *EFI_UNICODE_STRUPR) (
716     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
717     IN OUT CHAR16                       *Str
718     );
719 
720 typedef
721 VOID
722 (EFIAPI *EFI_UNICODE_FATTOSTR) (
723     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
724     IN UINTN                            FatSize,
725     IN CHAR8                            *Fat,
726     OUT CHAR16                          *String
727     );
728 
729 typedef
730 BOOLEAN
731 (EFIAPI *EFI_UNICODE_STRTOFAT) (
732     IN struct _EFI_UNICODE_COLLATION_PROTOCOL  *This,
733     IN CHAR16                           *String,
734     IN UINTN                            FatSize,
735     OUT CHAR8                           *Fat
736     );
737 
738 //
739 // Hash Protocol
740 //
741 #define EFI_HASH_PROTOCOL_GUID \
742   { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 } }
743 #define HASH_PROTOCOL EFI_HASH_PROTOCOL_GUID
744 
745 #define EFI_HASH_ALGORITHM_SHA1_GUID \
746   { 0x2AE9D80F, 0x3FB2, 0x4095, { 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6 } } // Deprecated
747 #define EFI_HASH_ALGORITHM_SHA1 EFI_HASH_ALGORITHM_SHA1_GUID
748 
749 #define EFI_HASH_ALGORITHM_SHA224_GUID \
750   { 0x8DF01A06, 0x9BD5, 0x4BF7, { 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B } } // Deprecated
751 #define EFI_HASH_ALGORITHM_SHA224 EFI_HASH_ALGORITHM_SHA224_GUID
752 
753 #define EFI_HASH_ALGORITHM_SHA256_GUID \
754   { 0x51AA59DE, 0xFDF2, 0x4EA3, { 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9 } } // Deprecated
755 #define EFI_HASH_ALGORITHM_SHA256 EFI_HASH_ALGORITHM_SHA256_GUID
756 
757 #define EFI_HASH_ALGORITHM_SHA384_GUID \
758   { 0xEFA96432, 0xDE33, 0x4DD2, { 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A } } // Deprecated
759 #define EFI_HASH_ALGORITHM_SHA384 EFI_HASH_ALGORITHM_SHA384_GUID
760 
761 #define EFI_HASH_ALGORITHM_SHA512_GUID \
762   { 0xCAA4381E, 0x750C, 0x4770, { 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30 } } // Deprecated
763 #define EFI_HASH_ALGORITHM_SHA512 EFI_HASH_ALGORITHM_SHA512_GUID
764 
765 #define EFI_HASH_ALGORITHM_MD5_GUID \
766   { 0x0AF7C79C, 0x65B5, 0x4319, { 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7 } } // Deprecated
767 #define EFI_HASH_ALGORITHM_MD5 EFI_HASH_ALGORITHM_MD5_GUID
768 
769 #define EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID \
770   { 0x24C5DC2F, 0x53E2, 0x40CA, { 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B } }
771 #define EFI_HASH_ALGORITHM_SHA1_NOPAD EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID
772 
773 #define EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID \
774   { 0x8628752A, 0x6CB7, 0x4814, { 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26 } }
775 #define EFI_HASH_ALGORITHM_SHA256_NOPAD EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID
776 
777 
778 INTERFACE_DECL(_EFI_HASH_PROTOCOL);
779 
780 typedef UINT8 EFI_MD5_HASH[16];
781 typedef UINT8 EFI_SHA1_HASH[20];
782 typedef UINT8 EFI_SHA224_HASH[28];
783 typedef UINT8 EFI_SHA256_HASH[32];
784 typedef UINT8 EFI_SHA384_HASH[48];
785 typedef UINT8 EFI_SHA512_HASH[64];
786 typedef union _EFI_HASH_OUTPUT {
787   EFI_MD5_HASH                    *Md5Hash;
788   EFI_SHA1_HASH                   *Sha1Hash;
789   EFI_SHA224_HASH                 *Sha224Hash;
790   EFI_SHA256_HASH                 *Sha256Hash;
791   EFI_SHA384_HASH                 *Sha384Hash;
792   EFI_SHA512_HASH                 *Sha512Hash;
793 } EFI_HASH_OUTPUT;
794 
795 typedef
796 EFI_STATUS
797 (EFIAPI *EFI_HASH_GET_HASH_SIZE) (
798   IN CONST struct _EFI_HASH_PROTOCOL  *This,
799   IN CONST EFI_GUID               *HashAlgorithm,
800   OUT UINTN                       *HashSize);
801 
802 typedef
803 EFI_STATUS
804 (EFIAPI *EFI_HASH_HASH) (
805   IN CONST struct _EFI_HASH_PROTOCOL  *This,
806   IN CONST EFI_GUID               *HashAlgorithm,
807   IN BOOLEAN                      Extend,
808   IN CONST UINT8                  *Message,
809   IN UINT64                       MessageSize,
810   IN OUT EFI_HASH_OUTPUT          *Hash);
811 
812 typedef struct _EFI_HASH_PROTOCOL {
813   EFI_HASH_GET_HASH_SIZE                  GetHashSize;
814   EFI_HASH_HASH                           Hash;
815 } EFI_HASH_PROTOCOL;
816 
817 typedef struct _EFI_HASH_PROTOCOL _EFI_HASH;
818 typedef EFI_HASH_PROTOCOL EFI_HASH;
819 
820 
821 typedef struct _EFI_UNICODE_COLLATION_PROTOCOL {
822 
823     // general
824     EFI_UNICODE_STRICOLL                StriColl;
825     EFI_UNICODE_METAIMATCH              MetaiMatch;
826     EFI_UNICODE_STRLWR                  StrLwr;
827     EFI_UNICODE_STRUPR                  StrUpr;
828 
829     // for supporting fat volumes
830     EFI_UNICODE_FATTOSTR                FatToStr;
831     EFI_UNICODE_STRTOFAT                StrToFat;
832 
833     CHAR8                               *SupportedLanguages;
834 } EFI_UNICODE_COLLATION_PROTOCOL;
835 
836 typedef EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_INTERFACE;
837 
838 /* Graphics output protocol */
839 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
840    { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } }
841 typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
842 
843 typedef struct {
844   UINT32            RedMask;
845   UINT32            GreenMask;
846   UINT32            BlueMask;
847   UINT32            ReservedMask;
848 } EFI_PIXEL_BITMASK;
849 
850 typedef enum {
851   PixelRedGreenBlueReserved8BitPerColor,
852   PixelBlueGreenRedReserved8BitPerColor,
853   PixelBitMask,
854   PixelBltOnly,
855   PixelFormatMax
856 } EFI_GRAPHICS_PIXEL_FORMAT;
857 
858 typedef struct {
859   UINT32                     Version;
860   UINT32                     HorizontalResolution;
861   UINT32                     VerticalResolution;
862   EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
863   EFI_PIXEL_BITMASK          PixelInformation;
864   UINT32                     PixelsPerScanLine;
865 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
866 
867 /**
868   Return the current video mode information.
869 
870   @param  This       Protocol instance pointer.
871   @param  ModeNumber The mode number to return information on.
872   @param  SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
873   @param  Info       A pointer to callee allocated buffer that returns information about ModeNumber.
874 
875   @retval EFI_SUCCESS           Mode information returned.
876   @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.
877   @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.
878   @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()
879   @retval EFI_INVALID_PARAMETER One of the input args was NULL.
880 
881 **/
882 typedef
883 EFI_STATUS
884 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
885   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
886   IN  UINT32                                ModeNumber,
887   OUT UINTN                                 *SizeOfInfo,
888   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
889   )
890 ;
891 
892 /**
893   Return the current video mode information.
894 
895   @param  This              Protocol instance pointer.
896   @param  ModeNumber        The mode number to be set.
897 
898   @retval EFI_SUCCESS       Graphics mode was changed.
899   @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.
900   @retval EFI_UNSUPPORTED   ModeNumber is not supported by this device.
901 
902 **/
903 typedef
904 EFI_STATUS
905 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
906   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
907   IN  UINT32                       ModeNumber
908   );
909 
910 typedef struct {
911   UINT8 Blue;
912   UINT8 Green;
913   UINT8 Red;
914   UINT8 Reserved;
915 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
916 
917 typedef union {
918   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
919   UINT32                        Raw;
920 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
921 
922 typedef enum {
923   EfiBltVideoFill,
924   EfiBltVideoToBltBuffer,
925   EfiBltBufferToVideo,
926   EfiBltVideoToVideo,
927   EfiGraphicsOutputBltOperationMax
928 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
929 
930 /**
931   The following table defines actions for BltOperations:
932 
933   <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY)
934   directly to every pixel of the video display rectangle
935   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
936   Only one pixel will be used from the BltBuffer. Delta is NOT used.
937 
938   <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
939   (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
940   the BltBuffer rectangle (DestinationX, DestinationY )
941   (DestinationX + Width, DestinationY + Height). If DestinationX or
942   DestinationY is not zero then Delta must be set to the length in bytes
943   of a row in the BltBuffer.
944 
945   <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle
946   (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
947   video display rectangle (DestinationX, DestinationY)
948   (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
949   not zero then Delta must be set to the length in bytes of a row in the
950   BltBuffer.
951 
952   <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
953   (SourceX + Width, SourceY + Height) .to the video display rectangle
954   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
955   The BltBuffer and Delta  are not used in this mode.
956 
957   @param  This         Protocol instance pointer.
958   @param  BltBuffer    Buffer containing data to blit into video buffer. This
959                        buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
960   @param  BltOperation Operation to perform on BlitBuffer and video memory
961   @param  SourceX      X coordinate of source for the BltBuffer.
962   @param  SourceY      Y coordinate of source for the BltBuffer.
963   @param  DestinationX X coordinate of destination for the BltBuffer.
964   @param  DestinationY Y coordinate of destination for the BltBuffer.
965   @param  Width        Width of rectangle in BltBuffer in pixels.
966   @param  Height       Hight of rectangle in BltBuffer in pixels.
967   @param  Delta        OPTIONAL
968 
969   @retval EFI_SUCCESS           The Blt operation completed.
970   @retval EFI_INVALID_PARAMETER BltOperation is not valid.
971   @retval EFI_DEVICE_ERROR      A hardware error occured writting to the video buffer.
972 
973 **/
974 typedef
975 EFI_STATUS
976 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
977   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,
978   IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           *BltBuffer,   OPTIONAL
979   IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,
980   IN  UINTN                                   SourceX,
981   IN  UINTN                                   SourceY,
982   IN  UINTN                                   DestinationX,
983   IN  UINTN                                   DestinationY,
984   IN  UINTN                                   Width,
985   IN  UINTN                                   Height,
986   IN  UINTN                                   Delta         OPTIONAL
987   );
988 
989 typedef struct {
990   UINT32                                 MaxMode;
991   UINT32                                 Mode;
992   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;
993   UINTN                                  SizeOfInfo;
994   EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
995   UINTN                                  FrameBufferSize;
996 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
997 
998 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
999   EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;
1000   EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;
1001   EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;
1002   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;
1003 };
1004 
1005 
1006 
1007 /*
1008  * EFI EDID Discovered Protocol
1009  * UEFI Specification Version 2.5 Section 11.9
1010  */
1011 #define EFI_EDID_DISCOVERED_PROTOCOL_GUID \
1012     { 0x1C0C34F6, 0xD380, 0x41FA, { 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA} }
1013 
1014 typedef struct _EFI_EDID_DISCOVERED_PROTOCOL {
1015     UINT32   SizeOfEdid;
1016     UINT8   *Edid;
1017 } EFI_EDID_DISCOVERED_PROTOCOL;
1018 
1019 
1020 
1021 /*
1022  * EFI EDID Active Protocol
1023  * UEFI Specification Version 2.5 Section 11.9
1024  */
1025 #define EFI_EDID_ACTIVE_PROTOCOL_GUID \
1026     { 0xBD8C1056, 0x9F36, 0x44EC, { 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86} }
1027 
1028 typedef struct _EFI_EDID_ACTIVE_PROTOCOL {
1029     UINT32   SizeOfEdid;
1030     UINT8   *Edid;
1031 } EFI_EDID_ACTIVE_PROTOCOL;
1032 
1033 
1034 
1035 /*
1036  * EFI EDID Override Protocol
1037  * UEFI Specification Version 2.5 Section 11.9
1038  */
1039 #define EFI_EDID_OVERRIDE_PROTOCOL_GUID \
1040     { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5} }
1041 
1042 INTERFACE_DECL(_EFI_EDID_OVERRIDE_PROTOCOL);
1043 
1044 typedef
1045 EFI_STATUS
1046 (EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) (
1047   IN      struct _EFI_EDID_OVERRIDE_PROTOCOL   *This,
1048   IN      EFI_HANDLE                           *ChildHandle,
1049   OUT     UINT32                               *Attributes,
1050   IN OUT  UINTN                                *EdidSize,
1051   IN OUT  UINT8                               **Edid);
1052 
1053 typedef struct _EFI_EDID_OVERRIDE_PROTOCOL {
1054     EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID  GetEdid;
1055 } EFI_EDID_OVERRIDE_PROTOCOL;
1056 
1057 
1058 
1059 INTERFACE_DECL(_EFI_SERVICE_BINDING);
1060 
1061 typedef
1062 EFI_STATUS
1063 (EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) (
1064     IN struct _EFI_SERVICE_BINDING *This,
1065     IN EFI_HANDLE                  *ChildHandle
1066     );
1067 
1068 typedef
1069 EFI_STATUS
1070 (EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) (
1071     IN struct _EFI_SERVICE_BINDING *This,
1072     IN EFI_HANDLE                  ChildHandle
1073     );
1074 
1075 typedef struct _EFI_SERVICE_BINDING {
1076     EFI_SERVICE_BINDING_CREATE_CHILD  CreateChild;
1077     EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild;
1078 } EFI_SERVICE_BINDING;
1079 
1080 
1081 
1082 /*
1083  * EFI Driver Binding Protocol
1084  * UEFI Specification Version 2.5 Section 10.1
1085  */
1086 #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
1087     { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71} }
1088 #define DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL_GUID
1089 
1090 INTERFACE_DECL(_EFI_DRIVER_BINDING_PROTOCOL);
1091 
1092 typedef
1093 EFI_STATUS
1094 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED) (
1095   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1096   IN      EFI_HANDLE                          ControllerHandle,
1097   IN      EFI_DEVICE_PATH                     *RemainingDevicePath OPTIONAL);
1098 
1099 typedef
1100 EFI_STATUS
1101 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_START) (
1102   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1103   IN      EFI_HANDLE                          ControllerHandle,
1104   IN      EFI_DEVICE_PATH                     *RemainingDevicePath OPTIONAL);
1105 
1106 typedef
1107 EFI_STATUS
1108 (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_STOP) (
1109   IN      struct _EFI_DRIVER_BINDING_PROTOCOL *This,
1110   IN      EFI_HANDLE                          ControllerHandle,
1111   IN      UINTN                               NumberOfChildren,
1112   IN      EFI_HANDLE                          *ChildHandleBuffer OPTIONAL);
1113 
1114 typedef struct _EFI_DRIVER_BINDING_PROTOCOL {
1115   EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED       Supported;
1116   EFI_DRIVER_BINDING_PROTOCOL_START           Start;
1117   EFI_DRIVER_BINDING_PROTOCOL_STOP            Stop;
1118   UINT32                                      Version;
1119   EFI_HANDLE                                  ImageHandle;
1120   EFI_HANDLE                                  DriverBindingHandle;
1121 } EFI_DRIVER_BINDING_PROTOCOL;
1122 
1123 typedef struct _EFI_DRIVER_BINDING_PROTOCOL _EFI_DRIVER_BINDING;
1124 typedef EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING;
1125 
1126 
1127 /*
1128  * Backwards compatibility with older GNU-EFI versions. Deprecated.
1129  */
1130 #define EFI_DRIVER_SUPPORTED         EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED
1131 #define EFI_DRIVER_START             EFI_DRIVER_BINDING_PROTOCOL_START
1132 #define EFI_DRIVER_STOP              EFI_DRIVER_BINDING_PROTOCOL_STOP
1133 
1134 
1135 
1136 /*
1137  * EFI Component Name Protocol
1138  * Deprecated - use EFI Component Name 2 Protocol instead
1139  */
1140 #define EFI_COMPONENT_NAME_PROTOCOL_GUID \
1141     {0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
1142 #define COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL_GUID
1143 
1144 INTERFACE_DECL(_EFI_COMPONENT_NAME_PROTOCOL);
1145 
1146 typedef
1147 EFI_STATUS
1148 (EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) (
1149   IN      struct _EFI_COMPONENT_NAME_PROTOCOL   *This,
1150   IN      CHAR8                                 *Language,
1151   OUT     CHAR16                                **DriverName);
1152 
1153 typedef
1154 EFI_STATUS
1155 (EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) (
1156   IN      struct _EFI_COMPONENT_NAME_PROTOCOL   *This,
1157   IN      EFI_HANDLE                            ControllerHandle,
1158   IN      EFI_HANDLE                            ChildHandle OPTIONAL,
1159   IN      CHAR8                                 *Language,
1160   OUT     CHAR16                                **ControllerName);
1161 
1162 typedef struct _EFI_COMPONENT_NAME_PROTOCOL {
1163   EFI_COMPONENT_NAME_GET_DRIVER_NAME      GetDriverName;
1164   EFI_COMPONENT_NAME_GET_CONTROLLER_NAME  GetControllerName;
1165   CHAR8                                   *SupportedLanguages;
1166 } EFI_COMPONENT_NAME_PROTOCOL;
1167 
1168 typedef struct _EFI_COMPONENT_NAME_PROTOCOL _EFI_COMPONENT_NAME;
1169 typedef EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME;
1170 
1171 
1172 /*
1173  * EFI Component Name 2 Protocol
1174  * UEFI Specification Version 2.5 Section 10.5
1175  */
1176 #define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
1177     {0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14} }
1178 #define COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL_GUID
1179 
1180 INTERFACE_DECL(_EFI_COMPONENT_NAME2_PROTOCOL);
1181 
1182 typedef
1183 EFI_STATUS
1184 (EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) (
1185   IN      struct _EFI_COMPONENT_NAME2_PROTOCOL   *This,
1186   IN      CHAR8                                  *Language,
1187   OUT     CHAR16                                 **DriverName);
1188 
1189 typedef
1190 EFI_STATUS
1191 (EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) (
1192   IN      struct _EFI_COMPONENT_NAME2_PROTOCOL   *This,
1193   IN      EFI_HANDLE                             ControllerHandle,
1194   IN      EFI_HANDLE                             ChildHandle OPTIONAL,
1195   IN      CHAR8                                  *Language,
1196   OUT     CHAR16                                 **ControllerName);
1197 
1198 typedef struct _EFI_COMPONENT_NAME2_PROTOCOL {
1199   EFI_COMPONENT_NAME2_GET_DRIVER_NAME       GetDriverName;
1200   EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME   GetControllerName;
1201   CHAR8                                     *SupportedLanguages;
1202 } EFI_COMPONENT_NAME2_PROTOCOL;
1203 
1204 typedef struct _EFI_COMPONENT_NAME2_PROTOCOL _EFI_COMPONENT_NAME2;
1205 typedef EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2;
1206 
1207 
1208 
1209 /*
1210  * EFI Loaded Image Protocol
1211  * UEFI Specification Version 2.5 Section 8.1
1212  */
1213 #define EFI_LOADED_IMAGE_PROTOCOL_GUID \
1214     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
1215 #define LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE_PROTOCOL_GUID
1216 
1217 #define EFI_LOADED_IMAGE_PROTOCOL_REVISION  0x1000
1218 #define EFI_IMAGE_INFORMATION_REVISION  EFI_LOADED_IMAGE_PROTOCOL_REVISION
1219 
1220 typedef
1221 EFI_STATUS
1222 (EFIAPI *EFI_IMAGE_UNLOAD) (
1223     IN EFI_HANDLE                   ImageHandle
1224     );
1225 
1226 typedef struct {
1227     UINT32                          Revision;
1228     EFI_HANDLE                      ParentHandle;
1229     struct _EFI_SYSTEM_TABLE        *SystemTable;
1230 
1231     // Source location of image
1232     EFI_HANDLE                      DeviceHandle;
1233     EFI_DEVICE_PATH                 *FilePath;
1234     VOID                            *Reserved;
1235 
1236     // Images load options
1237     UINT32                          LoadOptionsSize;
1238     VOID                            *LoadOptions;
1239 
1240     // Location of where image was loaded
1241     VOID                            *ImageBase;
1242     UINT64                          ImageSize;
1243     EFI_MEMORY_TYPE                 ImageCodeType;
1244     EFI_MEMORY_TYPE                 ImageDataType;
1245 
1246     // If the driver image supports a dynamic unload request
1247     EFI_IMAGE_UNLOAD                Unload;
1248 } EFI_LOADED_IMAGE_PROTOCOL;
1249 
1250 typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE;
1251 
1252 #define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
1253     {0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf} }
1254 
1255 /*
1256  * Random Number Generator Protocol
1257  * UEFI Specification Version 2.5 Section 35.5
1258  */
1259 #define EFI_RNG_PROTOCOL_GUID                          \
1260           { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} }
1261 
1262 typedef EFI_GUID EFI_RNG_ALGORITHM;
1263 
1264 #define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID       \
1265      {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} }
1266 
1267 #define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID       \
1268      {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} }
1269 
1270 #define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID        \
1271      {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} }
1272 
1273 #define EFI_RNG_ALGORITHM_X9_31_3DES_GUID              \
1274      {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} }
1275 
1276 #define EFI_RNG_ALGORITHM_X9_31_AES_GUID               \
1277      {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} }
1278 
1279 #define EFI_RNG_ALGORITHM_RAW                          \
1280      {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} }
1281 
1282 INTERFACE_DECL(_EFI_RNG_PROTOCOL);
1283 
1284 typedef
1285 EFI_STATUS
1286 (EFIAPI *EFI_RNG_GET_INFO) (
1287   IN      struct _EFI_RNG_PROTOCOL   *This,
1288   IN OUT  UINTN                      *RNGAlgorithmListSize,
1289   OUT     EFI_RNG_ALGORITHM          *RNGAlgorithmList
1290 );
1291 
1292 typedef
1293 EFI_STATUS
1294 (EFIAPI *EFI_RNG_GET_RNG) (
1295   IN      struct _EFI_RNG_PROTOCOL   *This,
1296   IN      EFI_RNG_ALGORITHM          *RNGAlgorithm,           OPTIONAL
1297   IN      UINTN                      RNGValueLength,
1298   OUT     UINT8                      *RNGValue
1299 );
1300 
1301 typedef struct _EFI_RNG_PROTOCOL {
1302           EFI_RNG_GET_INFO           GetInfo;
1303           EFI_RNG_GET_RNG            GetRNG;
1304 } EFI_RNG_PROTOCOL;
1305 
1306 
1307 //
1308 // EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL
1309 //
1310 
1311 #define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID          \
1312           { 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
1313 
1314 INTERFACE_DECL(_EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL);
1315 
1316 typedef
1317 EFI_STATUS
1318 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) (
1319 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1320 IN      EFI_HANDLE                                      ControllerHandle,
1321 IN OUT  EFI_HANDLE                                     *DriverImageHandle);
1322 
1323 typedef
1324 EFI_STATUS
1325 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) (
1326 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1327 IN      EFI_HANDLE                                      ControllerHandle,
1328 IN OUT  EFI_DEVICE_PATH                               **DriverImagePath);
1329 
1330 typedef
1331 EFI_STATUS
1332 (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) (
1333 IN      struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  *This,
1334 IN      EFI_HANDLE                                      ControllerHandle,
1335 IN      EFI_DEVICE_PATH                                *DriverImagePath,
1336 IN      EFI_HANDLE                                      DriverImageHandle);
1337 
1338 typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL {
1339   EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;
1340   EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH  GetDriverPath;
1341   EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED    DriverLoaded;
1342 } EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL;
1343 
1344 //
1345 // EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL
1346 //
1347 
1348 #define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID          \
1349           { 0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65} }
1350 
1351 INTERFACE_DECL(_EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL);
1352 
1353 typedef
1354 EFI_STATUS
1355 (EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) (
1356 IN      struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  *This,
1357 IN OUT  EFI_HANDLE                                         *DriverImageHandle);
1358 
1359 typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {
1360   EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;
1361 } EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;
1362 
1363 //
1364 // EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL
1365 //
1366 
1367 #define EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID          \
1368           { 0xb1ee129e, 0xda36, 0x4181, {0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7} }
1369 
1370 INTERFACE_DECL(_EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL);
1371 
1372 typedef
1373 UINT32
1374 (EFIAPI *EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION) (
1375 IN      struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL  *This);
1376 
1377 typedef struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL {
1378   EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION       GetVersion;
1379 } EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL;
1380 
1381 //
1382 // EFI_EBC_PROTOCOL
1383 //
1384 
1385 #define EFI_EBC_INTERPRETER_PROTOCOL_GUID              \
1386      {0x13ac6dd1, 0x73d0, 0x11d4, {0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7} }
1387 
1388 #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
1389 
1390 INTERFACE_DECL(_EFI_EBC_PROTOCOL);
1391 
1392 typedef
1393 EFI_STATUS
1394 (EFIAPI *EFI_EBC_CREATE_THUNK)(
1395   IN struct _EFI_EBC_PROTOCOL   *This,
1396   IN EFI_HANDLE                 ImageHandle,
1397   IN VOID                       *EbcEntryPoint,
1398   OUT VOID                      **Thunk);
1399 
1400 typedef
1401 EFI_STATUS
1402 (EFIAPI *EFI_EBC_UNLOAD_IMAGE)(
1403   IN struct _EFI_EBC_PROTOCOL   *This,
1404   IN EFI_HANDLE                 ImageHandle);
1405 
1406 typedef
1407 EFI_STATUS
1408 (EFIAPI *EBC_ICACHE_FLUSH)(
1409   IN EFI_PHYSICAL_ADDRESS       Start,
1410   IN UINT64                     Length);
1411 
1412 typedef
1413 EFI_STATUS
1414 (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(
1415   IN struct _EFI_EBC_PROTOCOL   *This,
1416   IN EBC_ICACHE_FLUSH           Flush);
1417 
1418 typedef
1419 EFI_STATUS
1420 (EFIAPI *EFI_EBC_GET_VERSION)(
1421   IN struct _EFI_EBC_PROTOCOL   *This,
1422   IN OUT UINT64                 *Version);
1423 
1424 typedef struct _EFI_EBC_PROTOCOL {
1425   EFI_EBC_CREATE_THUNK          CreateThunk;
1426   EFI_EBC_UNLOAD_IMAGE          UnloadImage;
1427   EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;
1428   EFI_EBC_GET_VERSION           GetVersion;
1429 } EFI_EBC_PROTOCOL;
1430 
1431 INTERFACE_DECL(_EFI_MEMORY_ATTRIBUTE_PROTOCOL);
1432 
1433 typedef
1434 EFI_STATUS
1435 (EFIAPI *EFI_GET_MEMORY_ATTRIBUTES)(
1436   IN struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL      *This,
1437   IN EFI_PHYSICAL_ADDRESS                       BaseAddress,
1438   IN UINT64                                     Length,
1439   OUT UINT64                                    *Attributes
1440   );
1441 
1442 typedef
1443 EFI_STATUS
1444 (EFIAPI *EFI_SET_MEMORY_ATTRIBUTES)(
1445   IN struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL      *This,
1446   IN EFI_PHYSICAL_ADDRESS                       BaseAddress,
1447   IN UINT64                                     Length,
1448   IN UINT64                                     Attributes
1449   );
1450 
1451 typedef
1452 EFI_STATUS
1453 (EFIAPI *EFI_CLEAR_MEMORY_ATTRIBUTES)(
1454   IN struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL      *This,
1455   IN EFI_PHYSICAL_ADDRESS                       BaseAddress,
1456   IN UINT64                                     Length,
1457   IN UINT64                                     Attributes
1458   );
1459 
1460 typedef struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL {
1461   EFI_GET_MEMORY_ATTRIBUTES     GetMemoryAttributes;
1462   EFI_SET_MEMORY_ATTRIBUTES     SetMemoryAttributes;
1463   EFI_CLEAR_MEMORY_ATTRIBUTES   ClearMemoryAttributes;
1464 } EFI_MEMORY_ATTRIBUTE_PROTOCOL;
1465 
1466 #endif
1467