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 FPSWA_PROTOCOL          \
26     { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
27 
28 //
29 // Device Path protocol
30 //
31 
32 #define DEVICE_PATH_PROTOCOL    \
33     { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
34 
35 
36 //
37 // Block IO protocol
38 //
39 
40 #define BLOCK_IO_PROTOCOL \
41     { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
42 #define EFI_BLOCK_IO_INTERFACE_REVISION   0x00010000
43 
44 INTERFACE_DECL(_EFI_BLOCK_IO);
45 
46 typedef
47 EFI_STATUS
48 (EFIAPI *EFI_BLOCK_RESET) (
49     IN struct _EFI_BLOCK_IO     *This,
50     IN BOOLEAN                  ExtendedVerification
51     );
52 
53 typedef
54 EFI_STATUS
55 (EFIAPI *EFI_BLOCK_READ) (
56     IN struct _EFI_BLOCK_IO     *This,
57     IN UINT32                   MediaId,
58     IN EFI_LBA                  LBA,
59     IN UINTN                    BufferSize,
60     OUT VOID                    *Buffer
61     );
62 
63 
64 typedef
65 EFI_STATUS
66 (EFIAPI *EFI_BLOCK_WRITE) (
67     IN struct _EFI_BLOCK_IO     *This,
68     IN UINT32                   MediaId,
69     IN EFI_LBA                  LBA,
70     IN UINTN                    BufferSize,
71     IN VOID                     *Buffer
72     );
73 
74 
75 typedef
76 EFI_STATUS
77 (EFIAPI *EFI_BLOCK_FLUSH) (
78     IN struct _EFI_BLOCK_IO     *This
79     );
80 
81 
82 
83 typedef struct {
84     UINT32              MediaId;
85     BOOLEAN             RemovableMedia;
86     BOOLEAN             MediaPresent;
87 
88     BOOLEAN             LogicalPartition;
89     BOOLEAN             ReadOnly;
90     BOOLEAN             WriteCaching;
91 
92     UINT32              BlockSize;
93     UINT32              IoAlign;
94 
95     EFI_LBA             LastBlock;
96 } EFI_BLOCK_IO_MEDIA;
97 
98 typedef struct _EFI_BLOCK_IO {
99     UINT64                  Revision;
100 
101     EFI_BLOCK_IO_MEDIA      *Media;
102 
103     EFI_BLOCK_RESET         Reset;
104     EFI_BLOCK_READ          ReadBlocks;
105     EFI_BLOCK_WRITE         WriteBlocks;
106     EFI_BLOCK_FLUSH         FlushBlocks;
107 
108 } EFI_BLOCK_IO;
109 
110 
111 
112 //
113 // Disk Block IO protocol
114 //
115 
116 #define DISK_IO_PROTOCOL \
117     { 0xce345171, 0xba0b, 0x11d2,  {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
118 #define EFI_DISK_IO_INTERFACE_REVISION   0x00010000
119 
120 INTERFACE_DECL(_EFI_DISK_IO);
121 
122 typedef
123 EFI_STATUS
124 (EFIAPI *EFI_DISK_READ) (
125     IN struct _EFI_DISK_IO      *This,
126     IN UINT32                   MediaId,
127     IN UINT64                   Offset,
128     IN UINTN                    BufferSize,
129     OUT VOID                    *Buffer
130     );
131 
132 
133 typedef
134 EFI_STATUS
135 (EFIAPI *EFI_DISK_WRITE) (
136     IN struct _EFI_DISK_IO      *This,
137     IN UINT32                   MediaId,
138     IN UINT64                   Offset,
139     IN UINTN                    BufferSize,
140     IN VOID                     *Buffer
141     );
142 
143 
144 typedef struct _EFI_DISK_IO {
145     UINT64              Revision;
146     EFI_DISK_READ       ReadDisk;
147     EFI_DISK_WRITE      WriteDisk;
148 } EFI_DISK_IO;
149 
150 
151 //
152 // Simple file system protocol
153 //
154 
155 #define SIMPLE_FILE_SYSTEM_PROTOCOL \
156     { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
157 
158 INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
159 INTERFACE_DECL(_EFI_FILE_HANDLE);
160 
161 typedef
162 EFI_STATUS
163 (EFIAPI *EFI_VOLUME_OPEN) (
164     IN struct _EFI_FILE_IO_INTERFACE    *This,
165     OUT struct _EFI_FILE_HANDLE         **Root
166     );
167 
168 #define EFI_FILE_IO_INTERFACE_REVISION   0x00010000
169 
170 typedef struct _EFI_FILE_IO_INTERFACE {
171     UINT64                  Revision;
172     EFI_VOLUME_OPEN         OpenVolume;
173 } EFI_FILE_IO_INTERFACE;
174 
175 //
176 //
177 //
178 
179 typedef
180 EFI_STATUS
181 (EFIAPI *EFI_FILE_OPEN) (
182     IN struct _EFI_FILE_HANDLE  *File,
183     OUT struct _EFI_FILE_HANDLE **NewHandle,
184     IN CHAR16                   *FileName,
185     IN UINT64                   OpenMode,
186     IN UINT64                   Attributes
187     );
188 
189 // Open modes
190 #define EFI_FILE_MODE_READ      0x0000000000000001
191 #define EFI_FILE_MODE_WRITE     0x0000000000000002
192 #define EFI_FILE_MODE_CREATE    0x8000000000000000
193 
194 // File attributes
195 #define EFI_FILE_READ_ONLY      0x0000000000000001
196 #define EFI_FILE_HIDDEN         0x0000000000000002
197 #define EFI_FILE_SYSTEM         0x0000000000000004
198 #define EFI_FILE_RESERVIED      0x0000000000000008
199 #define EFI_FILE_DIRECTORY      0x0000000000000010
200 #define EFI_FILE_ARCHIVE        0x0000000000000020
201 #define EFI_FILE_VALID_ATTR     0x0000000000000037
202 
203 typedef
204 EFI_STATUS
205 (EFIAPI *EFI_FILE_CLOSE) (
206     IN struct _EFI_FILE_HANDLE  *File
207     );
208 
209 typedef
210 EFI_STATUS
211 (EFIAPI *EFI_FILE_DELETE) (
212     IN struct _EFI_FILE_HANDLE  *File
213     );
214 
215 typedef
216 EFI_STATUS
217 (EFIAPI *EFI_FILE_READ) (
218     IN struct _EFI_FILE_HANDLE  *File,
219     IN OUT UINTN                *BufferSize,
220     OUT VOID                    *Buffer
221     );
222 
223 typedef
224 EFI_STATUS
225 (EFIAPI *EFI_FILE_WRITE) (
226     IN struct _EFI_FILE_HANDLE  *File,
227     IN OUT UINTN                *BufferSize,
228     IN VOID                     *Buffer
229     );
230 
231 typedef
232 EFI_STATUS
233 (EFIAPI *EFI_FILE_SET_POSITION) (
234     IN struct _EFI_FILE_HANDLE  *File,
235     IN UINT64                   Position
236     );
237 
238 typedef
239 EFI_STATUS
240 (EFIAPI *EFI_FILE_GET_POSITION) (
241     IN struct _EFI_FILE_HANDLE  *File,
242     OUT UINT64                  *Position
243     );
244 
245 typedef
246 EFI_STATUS
247 (EFIAPI *EFI_FILE_GET_INFO) (
248     IN struct _EFI_FILE_HANDLE  *File,
249     IN EFI_GUID                 *InformationType,
250     IN OUT UINTN                *BufferSize,
251     OUT VOID                    *Buffer
252     );
253 
254 typedef
255 EFI_STATUS
256 (EFIAPI *EFI_FILE_SET_INFO) (
257     IN struct _EFI_FILE_HANDLE  *File,
258     IN EFI_GUID                 *InformationType,
259     IN UINTN                    BufferSize,
260     IN VOID                     *Buffer
261     );
262 
263 typedef
264 EFI_STATUS
265 (EFIAPI *EFI_FILE_FLUSH) (
266     IN struct _EFI_FILE_HANDLE  *File
267     );
268 
269 
270 
271 #define EFI_FILE_HANDLE_REVISION         0x00010000
272 typedef struct _EFI_FILE_HANDLE {
273     UINT64                  Revision;
274     EFI_FILE_OPEN           Open;
275     EFI_FILE_CLOSE          Close;
276     EFI_FILE_DELETE         Delete;
277     EFI_FILE_READ           Read;
278     EFI_FILE_WRITE          Write;
279     EFI_FILE_GET_POSITION   GetPosition;
280     EFI_FILE_SET_POSITION   SetPosition;
281     EFI_FILE_GET_INFO       GetInfo;
282     EFI_FILE_SET_INFO       SetInfo;
283     EFI_FILE_FLUSH          Flush;
284 } EFI_FILE, *EFI_FILE_HANDLE;
285 
286 
287 //
288 // File information types
289 //
290 
291 #define EFI_FILE_INFO_ID   \
292     { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
293 
294 typedef struct {
295     UINT64                  Size;
296     UINT64                  FileSize;
297     UINT64                  PhysicalSize;
298     EFI_TIME                CreateTime;
299     EFI_TIME                LastAccessTime;
300     EFI_TIME                ModificationTime;
301     UINT64                  Attribute;
302     CHAR16                  FileName[1];
303 } EFI_FILE_INFO;
304 
305 //
306 // The FileName field of the EFI_FILE_INFO data structure is variable length.
307 // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
308 // be the size of the data structure without the FileName field.  The following macro
309 // computes this size correctly no matter how big the FileName array is declared.
310 // This is required to make the EFI_FILE_INFO data structure ANSI compilant.
311 //
312 
313 #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
314 
315 #define EFI_FILE_SYSTEM_INFO_ID    \
316     { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
317 
318 typedef struct {
319     UINT64                  Size;
320     BOOLEAN                 ReadOnly;
321     UINT64                  VolumeSize;
322     UINT64                  FreeSpace;
323     UINT32                  BlockSize;
324     CHAR16                  VolumeLabel[1];
325 } EFI_FILE_SYSTEM_INFO;
326 
327 //
328 // The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
329 // Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
330 // to be the size of the data structure without the VolumeLable field.  The following macro
331 // computes this size correctly no matter how big the VolumeLable array is declared.
332 // This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
333 //
334 
335 #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
336 
337 #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID    \
338     { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
339 
340 typedef struct {
341     CHAR16                  VolumeLabel[1];
342 } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
343 
344 #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
345 
346 //
347 // Load file protocol
348 //
349 
350 
351 #define LOAD_FILE_PROTOCOL \
352     { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
353 
354 INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
355 
356 typedef
357 EFI_STATUS
358 (EFIAPI *EFI_LOAD_FILE) (
359     IN struct _EFI_LOAD_FILE_INTERFACE  *This,
360     IN EFI_DEVICE_PATH                  *FilePath,
361     IN BOOLEAN                          BootPolicy,
362     IN OUT UINTN                        *BufferSize,
363     IN VOID                             *Buffer OPTIONAL
364     );
365 
366 typedef struct _EFI_LOAD_FILE_INTERFACE {
367     EFI_LOAD_FILE                       LoadFile;
368 } EFI_LOAD_FILE_INTERFACE;
369 
370 
371 //
372 // Device IO protocol
373 //
374 
375 #define DEVICE_IO_PROTOCOL \
376     { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
377 
378 INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
379 
380 typedef enum {
381     IO_UINT8,
382     IO_UINT16,
383     IO_UINT32,
384     IO_UINT64,
385 //
386 // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
387 //
388     MMIO_COPY_UINT8,
389     MMIO_COPY_UINT16,
390     MMIO_COPY_UINT32,
391     MMIO_COPY_UINT64
392 } EFI_IO_WIDTH;
393 
394 #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
395     ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
396 
397 
398 typedef
399 EFI_STATUS
400 (EFIAPI *EFI_DEVICE_IO) (
401     IN struct _EFI_DEVICE_IO_INTERFACE *This,
402     IN EFI_IO_WIDTH                 Width,
403     IN UINT64                       Address,
404     IN UINTN                        Count,
405     IN OUT VOID                     *Buffer
406     );
407 
408 typedef struct {
409     EFI_DEVICE_IO                   Read;
410     EFI_DEVICE_IO                   Write;
411 } EFI_IO_ACCESS;
412 
413 typedef
414 EFI_STATUS
415 (EFIAPI *EFI_PCI_DEVICE_PATH) (
416     IN struct _EFI_DEVICE_IO_INTERFACE  *This,
417     IN UINT64                           Address,
418     IN OUT EFI_DEVICE_PATH              **PciDevicePath
419     );
420 
421 typedef enum {
422     EfiBusMasterRead,
423     EfiBusMasterWrite,
424     EfiBusMasterCommonBuffer
425 } EFI_IO_OPERATION_TYPE;
426 
427 typedef
428 EFI_STATUS
429 (EFIAPI *EFI_IO_MAP) (
430     IN struct _EFI_DEVICE_IO_INTERFACE  *This,
431     IN EFI_IO_OPERATION_TYPE            Operation,
432     IN EFI_PHYSICAL_ADDRESS             *HostAddress,
433     IN OUT UINTN                        *NumberOfBytes,
434     OUT EFI_PHYSICAL_ADDRESS            *DeviceAddress,
435     OUT VOID                            **Mapping
436     );
437 
438 typedef
439 EFI_STATUS
440 (EFIAPI *EFI_IO_UNMAP) (
441     IN struct _EFI_DEVICE_IO_INTERFACE  *This,
442     IN VOID                             *Mapping
443     );
444 
445 typedef
446 EFI_STATUS
447 (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
448     IN struct _EFI_DEVICE_IO_INTERFACE  *This,
449     IN EFI_ALLOCATE_TYPE                Type,
450     IN EFI_MEMORY_TYPE                  MemoryType,
451     IN UINTN                            Pages,
452     IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress
453     );
454 
455 typedef
456 EFI_STATUS
457 (EFIAPI *EFI_IO_FLUSH) (
458     IN struct _EFI_DEVICE_IO_INTERFACE  *This
459     );
460 
461 typedef
462 EFI_STATUS
463 (EFIAPI *EFI_IO_FREE_BUFFER) (
464     IN struct _EFI_DEVICE_IO_INTERFACE  *This,
465     IN UINTN                            Pages,
466     IN EFI_PHYSICAL_ADDRESS             HostAddress
467     );
468 
469 typedef struct _EFI_DEVICE_IO_INTERFACE {
470     EFI_IO_ACCESS                       Mem;
471     EFI_IO_ACCESS                       Io;
472     EFI_IO_ACCESS                       Pci;
473     EFI_IO_MAP                          Map;
474     EFI_PCI_DEVICE_PATH                 PciDevicePath;
475     EFI_IO_UNMAP                        Unmap;
476     EFI_IO_ALLOCATE_BUFFER              AllocateBuffer;
477     EFI_IO_FLUSH                        Flush;
478     EFI_IO_FREE_BUFFER                  FreeBuffer;
479 } EFI_DEVICE_IO_INTERFACE;
480 
481 
482 //
483 // Unicode Collation protocol
484 //
485 
486 #define UNICODE_COLLATION_PROTOCOL \
487     { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc,  0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
488 
489 #define UNICODE_BYTE_ORDER_MARK       (CHAR16)(0xfeff)
490 
491 INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
492 
493 typedef
494 INTN
495 (EFIAPI *EFI_UNICODE_STRICOLL) (
496     IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
497     IN CHAR16                         *s1,
498     IN CHAR16                         *s2
499     );
500 
501 typedef
502 BOOLEAN
503 (EFIAPI *EFI_UNICODE_METAIMATCH) (
504     IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
505     IN CHAR16                         *String,
506     IN CHAR16                         *Pattern
507     );
508 
509 typedef
510 VOID
511 (EFIAPI *EFI_UNICODE_STRLWR) (
512     IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
513     IN OUT CHAR16                       *Str
514     );
515 
516 typedef
517 VOID
518 (EFIAPI *EFI_UNICODE_STRUPR) (
519     IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
520     IN OUT CHAR16                       *Str
521     );
522 
523 typedef
524 VOID
525 (EFIAPI *EFI_UNICODE_FATTOSTR) (
526     IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
527     IN UINTN                            FatSize,
528     IN CHAR8                            *Fat,
529     OUT CHAR16                          *String
530     );
531 
532 typedef
533 BOOLEAN
534 (EFIAPI *EFI_UNICODE_STRTOFAT) (
535     IN struct _EFI_UNICODE_COLLATION_INTERFACE  *This,
536     IN CHAR16                           *String,
537     IN UINTN                            FatSize,
538     OUT CHAR8                           *Fat
539     );
540 
541 
542 typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
543 
544     // general
545     EFI_UNICODE_STRICOLL                StriColl;
546     EFI_UNICODE_METAIMATCH              MetaiMatch;
547     EFI_UNICODE_STRLWR                  StrLwr;
548     EFI_UNICODE_STRUPR                  StrUpr;
549 
550     // for supporting fat volumes
551     EFI_UNICODE_FATTOSTR                FatToStr;
552     EFI_UNICODE_STRTOFAT                StrToFat;
553 
554     CHAR8                               *SupportedLanguages;
555 } EFI_UNICODE_COLLATION_INTERFACE;
556 
557 /* Graphics output protocol */
558 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
559   { \
560     0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
561   }
562 
563 typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
564 
565 typedef struct {
566   UINT32            RedMask;
567   UINT32            GreenMask;
568   UINT32            BlueMask;
569   UINT32            ReservedMask;
570 } EFI_PIXEL_BITMASK;
571 
572 typedef enum {
573   PixelRedGreenBlueReserved8BitPerColor,
574   PixelBlueGreenRedReserved8BitPerColor,
575   PixelBitMask,
576   PixelBltOnly,
577   PixelFormatMax
578 } EFI_GRAPHICS_PIXEL_FORMAT;
579 
580 typedef struct {
581   UINT32                     Version;
582   UINT32                     HorizontalResolution;
583   UINT32                     VerticalResolution;
584   EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
585   EFI_PIXEL_BITMASK          PixelInformation;
586   UINT32                     PixelsPerScanLine;
587 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
588 
589 /**
590   Return the current video mode information.
591 
592   @param  This       Protocol instance pointer.
593   @param  ModeNumber The mode number to return information on.
594   @param  SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
595   @param  Info       A pointer to callee allocated buffer that returns information about ModeNumber.
596 
597   @retval EFI_SUCCESS           Mode information returned.
598   @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.
599   @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.
600   @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()
601   @retval EFI_INVALID_PARAMETER One of the input args was NULL.
602 
603 **/
604 typedef
605 EFI_STATUS
606 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
607   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
608   IN  UINT32                                ModeNumber,
609   OUT UINTN                                 *SizeOfInfo,
610   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
611   )
612 ;
613 
614 /**
615   Return the current video mode information.
616 
617   @param  This              Protocol instance pointer.
618   @param  ModeNumber        The mode number to be set.
619 
620   @retval EFI_SUCCESS       Graphics mode was changed.
621   @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.
622   @retval EFI_UNSUPPORTED   ModeNumber is not supported by this device.
623 
624 **/
625 typedef
626 EFI_STATUS
627 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
628   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
629   IN  UINT32                       ModeNumber
630   )
631 ;
632 
633 typedef struct {
634   UINT8 Blue;
635   UINT8 Green;
636   UINT8 Red;
637   UINT8 Reserved;
638 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
639 
640 typedef union {
641   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
642   UINT32                        Raw;
643 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
644 
645 typedef enum {
646   EfiBltVideoFill,
647   EfiBltVideoToBltBuffer,
648   EfiBltBufferToVideo,
649   EfiBltVideoToVideo,
650   EfiGraphicsOutputBltOperationMax
651 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
652 
653 /**
654   The following table defines actions for BltOperations:
655 
656   <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY)
657   directly to every pixel of the video display rectangle
658   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
659   Only one pixel will be used from the BltBuffer. Delta is NOT used.
660 
661   <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
662   (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
663   the BltBuffer rectangle (DestinationX, DestinationY )
664   (DestinationX + Width, DestinationY + Height). If DestinationX or
665   DestinationY is not zero then Delta must be set to the length in bytes
666   of a row in the BltBuffer.
667 
668   <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle
669   (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
670   video display rectangle (DestinationX, DestinationY)
671   (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
672   not zero then Delta must be set to the length in bytes of a row in the
673   BltBuffer.
674 
675   <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
676   (SourceX + Width, SourceY + Height) .to the video display rectangle
677   (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
678   The BltBuffer and Delta  are not used in this mode.
679 
680   @param  This         Protocol instance pointer.
681   @param  BltBuffer    Buffer containing data to blit into video buffer. This
682                        buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
683   @param  BltOperation Operation to perform on BlitBuffer and video memory
684   @param  SourceX      X coordinate of source for the BltBuffer.
685   @param  SourceY      Y coordinate of source for the BltBuffer.
686   @param  DestinationX X coordinate of destination for the BltBuffer.
687   @param  DestinationY Y coordinate of destination for the BltBuffer.
688   @param  Width        Width of rectangle in BltBuffer in pixels.
689   @param  Height       Hight of rectangle in BltBuffer in pixels.
690   @param  Delta        OPTIONAL
691 
692   @retval EFI_SUCCESS           The Blt operation completed.
693   @retval EFI_INVALID_PARAMETER BltOperation is not valid.
694   @retval EFI_DEVICE_ERROR      A hardware error occured writting to the video buffer.
695 
696 **/
697 typedef
698 EFI_STATUS
699 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
700   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,
701   IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           *BltBuffer,   OPTIONAL
702   IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,
703   IN  UINTN                                   SourceX,
704   IN  UINTN                                   SourceY,
705   IN  UINTN                                   DestinationX,
706   IN  UINTN                                   DestinationY,
707   IN  UINTN                                   Width,
708   IN  UINTN                                   Height,
709   IN  UINTN                                   Delta         OPTIONAL
710   );
711 
712 typedef struct {
713   UINT32                                 MaxMode;
714   UINT32                                 Mode;
715   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;
716   UINTN                                  SizeOfInfo;
717   EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
718   UINTN                                  FrameBufferSize;
719 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
720 
721 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
722   EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;
723   EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;
724   EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;
725   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;
726 };
727 #endif
728 
729