6 Copyright (c) 1998 Intel Corporation
23 // FPSWA library protocol
25 #define FPSWA_PROTOCOL \
26 { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
29 // Device Path protocol
32 #define DEVICE_PATH_PROTOCOL \
33 { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
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 #define EFI_BLOCK_IO_INTERFACE_REVISION2 0x00020001
44 #define EFI_BLOCK_IO_INTERFACE_REVISION3 ((2<<16) | 31)
46 INTERFACE_DECL(_EFI_BLOCK_IO);
50 (EFIAPI *EFI_BLOCK_RESET) (
51 IN struct _EFI_BLOCK_IO *This,
52 IN BOOLEAN ExtendedVerification
57 (EFIAPI *EFI_BLOCK_READ) (
58 IN struct _EFI_BLOCK_IO *This,
68 (EFIAPI *EFI_BLOCK_WRITE) (
69 IN struct _EFI_BLOCK_IO *This,
79 (EFIAPI *EFI_BLOCK_FLUSH) (
80 IN struct _EFI_BLOCK_IO *This
87 BOOLEAN RemovableMedia;
90 BOOLEAN LogicalPartition;
100 EFI_LBA LowestAlignedLba;
101 UINT32 LogicalBlocksPerPhysicalBlock;
103 UINT32 OptimalTransferLengthGranularity;
104 } EFI_BLOCK_IO_MEDIA;
106 typedef struct _EFI_BLOCK_IO {
109 EFI_BLOCK_IO_MEDIA *Media;
111 EFI_BLOCK_RESET Reset;
112 EFI_BLOCK_READ ReadBlocks;
113 EFI_BLOCK_WRITE WriteBlocks;
114 EFI_BLOCK_FLUSH FlushBlocks;
121 // Disk Block IO protocol
124 #define DISK_IO_PROTOCOL \
125 { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
126 #define EFI_DISK_IO_INTERFACE_REVISION 0x00010000
128 INTERFACE_DECL(_EFI_DISK_IO);
132 (EFIAPI *EFI_DISK_READ) (
133 IN struct _EFI_DISK_IO *This,
143 (EFIAPI *EFI_DISK_WRITE) (
144 IN struct _EFI_DISK_IO *This,
152 typedef struct _EFI_DISK_IO {
154 EFI_DISK_READ ReadDisk;
155 EFI_DISK_WRITE WriteDisk;
160 // Simple file system protocol
163 #define SIMPLE_FILE_SYSTEM_PROTOCOL \
164 { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
166 INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
167 INTERFACE_DECL(_EFI_FILE_HANDLE);
171 (EFIAPI *EFI_VOLUME_OPEN) (
172 IN struct _EFI_FILE_IO_INTERFACE *This,
173 OUT struct _EFI_FILE_HANDLE **Root
176 #define EFI_FILE_IO_INTERFACE_REVISION 0x00010000
178 typedef struct _EFI_FILE_IO_INTERFACE {
180 EFI_VOLUME_OPEN OpenVolume;
181 } EFI_FILE_IO_INTERFACE;
189 (EFIAPI *EFI_FILE_OPEN) (
190 IN struct _EFI_FILE_HANDLE *File,
191 OUT struct _EFI_FILE_HANDLE **NewHandle,
198 #define EFI_FILE_MODE_READ 0x0000000000000001
199 #define EFI_FILE_MODE_WRITE 0x0000000000000002
200 #define EFI_FILE_MODE_CREATE 0x8000000000000000
203 #define EFI_FILE_READ_ONLY 0x0000000000000001
204 #define EFI_FILE_HIDDEN 0x0000000000000002
205 #define EFI_FILE_SYSTEM 0x0000000000000004
206 #define EFI_FILE_RESERVIED 0x0000000000000008
207 #define EFI_FILE_DIRECTORY 0x0000000000000010
208 #define EFI_FILE_ARCHIVE 0x0000000000000020
209 #define EFI_FILE_VALID_ATTR 0x0000000000000037
213 (EFIAPI *EFI_FILE_CLOSE) (
214 IN struct _EFI_FILE_HANDLE *File
219 (EFIAPI *EFI_FILE_DELETE) (
220 IN struct _EFI_FILE_HANDLE *File
225 (EFIAPI *EFI_FILE_READ) (
226 IN struct _EFI_FILE_HANDLE *File,
227 IN OUT UINTN *BufferSize,
233 (EFIAPI *EFI_FILE_WRITE) (
234 IN struct _EFI_FILE_HANDLE *File,
235 IN OUT UINTN *BufferSize,
241 (EFIAPI *EFI_FILE_SET_POSITION) (
242 IN struct _EFI_FILE_HANDLE *File,
248 (EFIAPI *EFI_FILE_GET_POSITION) (
249 IN struct _EFI_FILE_HANDLE *File,
255 (EFIAPI *EFI_FILE_GET_INFO) (
256 IN struct _EFI_FILE_HANDLE *File,
257 IN EFI_GUID *InformationType,
258 IN OUT UINTN *BufferSize,
264 (EFIAPI *EFI_FILE_SET_INFO) (
265 IN struct _EFI_FILE_HANDLE *File,
266 IN EFI_GUID *InformationType,
273 (EFIAPI *EFI_FILE_FLUSH) (
274 IN struct _EFI_FILE_HANDLE *File
279 #define EFI_FILE_HANDLE_REVISION 0x00010000
280 typedef struct _EFI_FILE_HANDLE {
283 EFI_FILE_CLOSE Close;
284 EFI_FILE_DELETE Delete;
286 EFI_FILE_WRITE Write;
287 EFI_FILE_GET_POSITION GetPosition;
288 EFI_FILE_SET_POSITION SetPosition;
289 EFI_FILE_GET_INFO GetInfo;
290 EFI_FILE_SET_INFO SetInfo;
291 EFI_FILE_FLUSH Flush;
292 } EFI_FILE, *EFI_FILE_HANDLE;
296 // File information types
299 #define EFI_FILE_INFO_ID \
300 { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
307 EFI_TIME LastAccessTime;
308 EFI_TIME ModificationTime;
314 // The FileName field of the EFI_FILE_INFO data structure is variable length.
315 // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
316 // be the size of the data structure without the FileName field. The following macro
317 // computes this size correctly no matter how big the FileName array is declared.
318 // This is required to make the EFI_FILE_INFO data structure ANSI compilant.
321 #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
323 #define EFI_FILE_SYSTEM_INFO_ID \
324 { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
332 CHAR16 VolumeLabel[1];
333 } EFI_FILE_SYSTEM_INFO;
336 // The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
337 // Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
338 // to be the size of the data structure without the VolumeLable field. The following macro
339 // computes this size correctly no matter how big the VolumeLable array is declared.
340 // This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
343 #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
345 #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
346 { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
349 CHAR16 VolumeLabel[1];
350 } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
352 #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
355 // Load file protocol
359 #define LOAD_FILE_PROTOCOL \
360 { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
362 INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
366 (EFIAPI *EFI_LOAD_FILE) (
367 IN struct _EFI_LOAD_FILE_INTERFACE *This,
368 IN EFI_DEVICE_PATH *FilePath,
369 IN BOOLEAN BootPolicy,
370 IN OUT UINTN *BufferSize,
371 IN VOID *Buffer OPTIONAL
374 typedef struct _EFI_LOAD_FILE_INTERFACE {
375 EFI_LOAD_FILE LoadFile;
376 } EFI_LOAD_FILE_INTERFACE;
380 // Device IO protocol
383 #define DEVICE_IO_PROTOCOL \
384 { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
386 INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
394 // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
402 #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
403 ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
408 (EFIAPI *EFI_DEVICE_IO) (
409 IN struct _EFI_DEVICE_IO_INTERFACE *This,
410 IN EFI_IO_WIDTH Width,
423 (EFIAPI *EFI_PCI_DEVICE_PATH) (
424 IN struct _EFI_DEVICE_IO_INTERFACE *This,
426 IN OUT EFI_DEVICE_PATH **PciDevicePath
432 EfiBusMasterCommonBuffer
433 } EFI_IO_OPERATION_TYPE;
437 (EFIAPI *EFI_IO_MAP) (
438 IN struct _EFI_DEVICE_IO_INTERFACE *This,
439 IN EFI_IO_OPERATION_TYPE Operation,
440 IN EFI_PHYSICAL_ADDRESS *HostAddress,
441 IN OUT UINTN *NumberOfBytes,
442 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
448 (EFIAPI *EFI_IO_UNMAP) (
449 IN struct _EFI_DEVICE_IO_INTERFACE *This,
455 (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
456 IN struct _EFI_DEVICE_IO_INTERFACE *This,
457 IN EFI_ALLOCATE_TYPE Type,
458 IN EFI_MEMORY_TYPE MemoryType,
460 IN OUT EFI_PHYSICAL_ADDRESS *HostAddress
465 (EFIAPI *EFI_IO_FLUSH) (
466 IN struct _EFI_DEVICE_IO_INTERFACE *This
471 (EFIAPI *EFI_IO_FREE_BUFFER) (
472 IN struct _EFI_DEVICE_IO_INTERFACE *This,
474 IN EFI_PHYSICAL_ADDRESS HostAddress
477 typedef struct _EFI_DEVICE_IO_INTERFACE {
482 EFI_PCI_DEVICE_PATH PciDevicePath;
484 EFI_IO_ALLOCATE_BUFFER AllocateBuffer;
486 EFI_IO_FREE_BUFFER FreeBuffer;
487 } EFI_DEVICE_IO_INTERFACE;
491 // Unicode Collation protocol
494 #define UNICODE_COLLATION_PROTOCOL \
495 { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
497 #define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)
499 INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
503 (EFIAPI *EFI_UNICODE_STRICOLL) (
504 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
511 (EFIAPI *EFI_UNICODE_METAIMATCH) (
512 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
519 (EFIAPI *EFI_UNICODE_STRLWR) (
520 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
526 (EFIAPI *EFI_UNICODE_STRUPR) (
527 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
533 (EFIAPI *EFI_UNICODE_FATTOSTR) (
534 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
542 (EFIAPI *EFI_UNICODE_STRTOFAT) (
543 IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
550 typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
553 EFI_UNICODE_STRICOLL StriColl;
554 EFI_UNICODE_METAIMATCH MetaiMatch;
555 EFI_UNICODE_STRLWR StrLwr;
556 EFI_UNICODE_STRUPR StrUpr;
558 // for supporting fat volumes
559 EFI_UNICODE_FATTOSTR FatToStr;
560 EFI_UNICODE_STRTOFAT StrToFat;
562 CHAR8 *SupportedLanguages;
563 } EFI_UNICODE_COLLATION_INTERFACE;
565 /* Graphics output protocol */
566 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
568 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
571 typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
581 PixelRedGreenBlueReserved8BitPerColor,
582 PixelBlueGreenRedReserved8BitPerColor,
586 } EFI_GRAPHICS_PIXEL_FORMAT;
590 UINT32 HorizontalResolution;
591 UINT32 VerticalResolution;
592 EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
593 EFI_PIXEL_BITMASK PixelInformation;
594 UINT32 PixelsPerScanLine;
595 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
598 Return the current video mode information.
600 @param This Protocol instance pointer.
601 @param ModeNumber The mode number to return information on.
602 @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
603 @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
605 @retval EFI_SUCCESS Mode information returned.
606 @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
607 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
608 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
609 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
614 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
615 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
616 IN UINT32 ModeNumber,
617 OUT UINTN *SizeOfInfo,
618 OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
623 Return the current video mode information.
625 @param This Protocol instance pointer.
626 @param ModeNumber The mode number to be set.
628 @retval EFI_SUCCESS Graphics mode was changed.
629 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
630 @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
635 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
636 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
646 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
649 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
651 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
655 EfiBltVideoToBltBuffer,
658 EfiGraphicsOutputBltOperationMax
659 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
662 The following table defines actions for BltOperations:
664 <B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
665 directly to every pixel of the video display rectangle
666 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
667 Only one pixel will be used from the BltBuffer. Delta is NOT used.
669 <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
670 (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
671 the BltBuffer rectangle (DestinationX, DestinationY )
672 (DestinationX + Width, DestinationY + Height). If DestinationX or
673 DestinationY is not zero then Delta must be set to the length in bytes
674 of a row in the BltBuffer.
676 <B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
677 (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
678 video display rectangle (DestinationX, DestinationY)
679 (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
680 not zero then Delta must be set to the length in bytes of a row in the
683 <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
684 (SourceX + Width, SourceY + Height) .to the video display rectangle
685 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
686 The BltBuffer and Delta are not used in this mode.
688 @param This Protocol instance pointer.
689 @param BltBuffer Buffer containing data to blit into video buffer. This
690 buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
691 @param BltOperation Operation to perform on BlitBuffer and video memory
692 @param SourceX X coordinate of source for the BltBuffer.
693 @param SourceY Y coordinate of source for the BltBuffer.
694 @param DestinationX X coordinate of destination for the BltBuffer.
695 @param DestinationY Y coordinate of destination for the BltBuffer.
696 @param Width Width of rectangle in BltBuffer in pixels.
697 @param Height Hight of rectangle in BltBuffer in pixels.
698 @param Delta OPTIONAL
700 @retval EFI_SUCCESS The Blt operation completed.
701 @retval EFI_INVALID_PARAMETER BltOperation is not valid.
702 @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.
707 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
708 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
709 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
710 IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
713 IN UINTN DestinationX,
714 IN UINTN DestinationY,
717 IN UINTN Delta OPTIONAL
723 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
725 EFI_PHYSICAL_ADDRESS FrameBufferBase;
726 UINTN FrameBufferSize;
727 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
729 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
730 EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
731 EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
732 EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
733 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;