1 #ifndef _EFI_PCI_IO_H 2 #define _EFI_PCI_IO_H 3 4 #define EFI_PCI_IO_PROTOCOL_GUID \ 5 { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a} } 6 7 INTERFACE_DECL(_EFI_PCI_IO_PROTOCOL); 8 9 typedef enum { 10 EfiPciIoWidthUint8, 11 EfiPciIoWidthUint16, 12 EfiPciIoWidthUint32, 13 EfiPciIoWidthUint64, 14 EfiPciIoWidthFifoUint8, 15 EfiPciIoWidthFifoUint16, 16 EfiPciIoWidthFifoUint32, 17 EfiPciIoWidthFifoUint64, 18 EfiPciIoWidthFillUint8, 19 EfiPciIoWidthFillUint16, 20 EfiPciIoWidthFillUint32, 21 EfiPciIoWidthFillUint64, 22 EfiPciIoWidthMaximum 23 } EFI_PCI_IO_PROTOCOL_WIDTH; 24 25 #define EFI_PCI_IO_PASS_THROUGH_BAR 0xff 26 27 typedef 28 EFI_STATUS 29 (EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) ( 30 IN struct _EFI_PCI_IO_PROTOCOL *This, 31 IN EFI_PCI_IO_PROTOCOL_WIDTH Width, 32 IN UINT8 BarIndex, 33 IN UINT64 Offset, 34 IN UINT64 Mask, 35 IN UINT64 Value, 36 IN UINT64 Delay, 37 OUT UINT64 *Result 38 ); 39 40 typedef 41 EFI_STATUS 42 (EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) ( 43 IN struct _EFI_PCI_IO_PROTOCOL *This, 44 IN EFI_PCI_IO_PROTOCOL_WIDTH Width, 45 IN UINT8 BarIndex, 46 IN UINT64 Offset, 47 IN UINTN Count, 48 IN OUT VOID *Buffer 49 ); 50 51 typedef struct { 52 EFI_PCI_IO_PROTOCOL_IO_MEM Read; 53 EFI_PCI_IO_PROTOCOL_IO_MEM Write; 54 } EFI_PCI_IO_PROTOCOL_ACCESS; 55 56 typedef 57 EFI_STATUS 58 (EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) ( 59 IN struct _EFI_PCI_IO_PROTOCOL *This, 60 IN EFI_PCI_IO_PROTOCOL_WIDTH Width, 61 IN UINT32 Offset, 62 IN UINTN Count, 63 IN OUT VOID *Buffer 64 ); 65 66 typedef struct { 67 EFI_PCI_IO_PROTOCOL_CONFIG Read; 68 EFI_PCI_IO_PROTOCOL_CONFIG Write; 69 } EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS; 70 71 typedef 72 EFI_STATUS 73 (EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) ( 74 IN struct _EFI_PCI_IO_PROTOCOL *This, 75 IN EFI_PCI_IO_PROTOCOL_WIDTH Width, 76 IN UINT8 DestBarIndex, 77 IN UINT64 DestOffset, 78 IN UINT8 SrcBarIndex, 79 IN UINT64 SrcOffset, 80 IN UINTN Count 81 ); 82 83 typedef enum { 84 EfiPciIoOperationBusMasterRead, 85 EfiPciIoOperationBusMasterWrite, 86 EfiPciIoOperationBusMasterCommonBuffer, 87 EfiPciIoOperationMaximum 88 } EFI_PCI_IO_PROTOCOL_OPERATION; 89 90 typedef 91 EFI_STATUS 92 (EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) ( 93 IN struct _EFI_PCI_IO_PROTOCOL *This, 94 IN EFI_PCI_IO_PROTOCOL_OPERATION Operation, 95 IN VOID *HostAddress, 96 IN OUT UINTN *NumberOfBytes, 97 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, 98 OUT VOID **Mapping 99 ); 100 101 typedef 102 EFI_STATUS 103 (EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) ( 104 IN struct _EFI_PCI_IO_PROTOCOL *This, 105 IN VOID *Mapping 106 ); 107 108 typedef 109 EFI_STATUS 110 (EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) ( 111 IN struct _EFI_PCI_IO_PROTOCOL *This, 112 IN EFI_ALLOCATE_TYPE Type, 113 IN EFI_MEMORY_TYPE MemoryType, 114 IN UINTN Pages, 115 OUT VOID **HostAddress, 116 IN UINT64 Attributes 117 ); 118 119 typedef 120 EFI_STATUS 121 (EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) ( 122 IN struct _EFI_PCI_IO_PROTOCOL *This, 123 IN UINTN Pages, 124 IN VOID *HostAddress 125 ); 126 127 typedef 128 EFI_STATUS 129 (EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) ( 130 IN struct _EFI_PCI_IO_PROTOCOL *This 131 ); 132 133 typedef 134 EFI_STATUS 135 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) ( 136 IN struct _EFI_PCI_IO_PROTOCOL *This, 137 OUT UINTN *SegmentNumber, 138 OUT UINTN *BusNumber, 139 OUT UINTN *DeviceNumber, 140 OUT UINTN *FunctionNumber 141 ); 142 143 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 144 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 145 #define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 146 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 147 #define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 148 #define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 149 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 150 #define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 151 #define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 152 #define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 153 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 154 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 155 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 156 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 157 #define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 158 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 159 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 160 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 161 162 typedef enum { 163 EfiPciIoAttributeOperationGet, 164 EfiPciIoAttributeOperationSet, 165 EfiPciIoAttributeOperationEnable, 166 EfiPciIoAttributeOperationDisable, 167 EfiPciIoAttributeOperationSupported, 168 EfiPciIoAttributeOperationMaximum 169 } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; 170 171 typedef 172 EFI_STATUS 173 (EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) ( 174 IN struct _EFI_PCI_IO_PROTOCOL *This, 175 IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation, 176 IN UINT64 Attributes, 177 OUT UINT64 *Result OPTIONAL 178 ); 179 180 typedef 181 EFI_STATUS 182 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) ( 183 IN struct _EFI_PCI_IO_PROTOCOL *This, 184 IN UINT8 BarIndex, 185 OUT UINT64 *Supports OPTIONAL, 186 OUT VOID **Resources OPTIONAL 187 ); 188 189 typedef 190 EFI_STATUS 191 (EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) ( 192 IN struct _EFI_PCI_IO_PROTOCOL *This, 193 IN UINT64 Attributes, 194 IN UINT8 BarIndex, 195 IN OUT UINT64 *Offset, 196 IN OUT UINT64 *Length 197 ); 198 199 typedef struct _EFI_PCI_IO_PROTOCOL { 200 EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem; 201 EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo; 202 EFI_PCI_IO_PROTOCOL_ACCESS Mem; 203 EFI_PCI_IO_PROTOCOL_ACCESS Io; 204 EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci; 205 EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem; 206 EFI_PCI_IO_PROTOCOL_MAP Map; 207 EFI_PCI_IO_PROTOCOL_UNMAP Unmap; 208 EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer; 209 EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer; 210 EFI_PCI_IO_PROTOCOL_FLUSH Flush; 211 EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation; 212 EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes; 213 EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes; 214 EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes; 215 UINT64 RomSize; 216 VOID *RomImage; 217 } EFI_PCI_IO_PROTOCOL; 218 219 // Note: Because it conflicted with the EDK2 struct name, the 220 // 'EFI_PCI_IO_PROTOCOL' GUID definition, from older versions 221 // of gnu-efi, is now obsoleted. 222 // Use 'EFI_PCI_IO_PROTOCOL_GUID' instead. 223 224 typedef struct _EFI_PCI_IO_PROTOCOL _EFI_PCI_IO; 225 typedef EFI_PCI_IO_PROTOCOL EFI_PCI_IO; 226 227 #endif /* _EFI_PCI_IO_H */ 228