]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Efi/Protocol/PciIo/PciIo.h
Removed extra typedefs on structures to remove error with gcc compiler.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / PciIo / PciIo.h
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 PciIo.h
15
16 Abstract:
17
18 EFI PCI I/O Protocol
19
20 Revision History
21
22 --*/
23
24 #ifndef _EFI_PCI_IO_H
25 #define _EFI_PCI_IO_H
26
27 //
28 // Global ID for the PCI I/O Protocol
29 //
30 #define EFI_PCI_IO_PROTOCOL_GUID \
31 { \
32 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a \
33 }
34
35 EFI_FORWARD_DECLARATION (EFI_PCI_IO_PROTOCOL);
36
37 //
38 // Prototypes for the PCI I/O Protocol
39 //
40 typedef enum {
41 EfiPciIoWidthUint8 = 0,
42 EfiPciIoWidthUint16,
43 EfiPciIoWidthUint32,
44 EfiPciIoWidthUint64,
45 EfiPciIoWidthFifoUint8,
46 EfiPciIoWidthFifoUint16,
47 EfiPciIoWidthFifoUint32,
48 EfiPciIoWidthFifoUint64,
49 EfiPciIoWidthFillUint8,
50 EfiPciIoWidthFillUint16,
51 EfiPciIoWidthFillUint32,
52 EfiPciIoWidthFillUint64,
53 EfiPciIoWidthMaximum
54 } EFI_PCI_IO_PROTOCOL_WIDTH;
55
56 //
57 // Complete PCI address generater
58 //
59 #define EFI_PCI_IO_PASS_THROUGH_BAR 0xff // Special BAR that passes a memory or I/O cycle through unchanged
60 #define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f // All the following I/O and Memory cycles
61 #define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 // I/O cycles 0x0000-0x00FF (10 bit decode)
62 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 // I/O cycles 0x0000-0x03FF (10 bit decode)
63 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 // I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
64 #define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 // MEM cycles 0xA0000-0xBFFFF (24 bit decode)
65 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
66 #define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 // I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
67 #define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 // I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
68 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 // Map a memory range so write are combined
69 #define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 // Enable the I/O decode bit in the PCI Config Header
70 #define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 // Enable the Memory decode bit in the PCI Config Header
71 #define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 // Enable the DMA bit in the PCI Config Header
72 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 // Map a memory range so all r/w accesses are cached
73 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 // Disable a memory range
74 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 // Clear for an add-in PCI Device
75 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 // Clear for a physical PCI Option ROM accessed through ROM BAR
76 #define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 // Clear for PCI controllers that can not genrate a DAC
77 //
78 // The following definition is added in EFI1.1 spec update and UEFI2.0 spec.
79 //
80 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 // I/O cycles 0x0100-0x03FF (16 bit decode)
81 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 // I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
82 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
83
84 #define EFI_PCI_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)
85 #define EFI_VGA_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO)
86
87 //
88 // *******************************************************
89 // EFI_PCI_IO_PROTOCOL_OPERATION
90 // *******************************************************
91 //
92 typedef enum {
93 EfiPciIoOperationBusMasterRead,
94 EfiPciIoOperationBusMasterWrite,
95 EfiPciIoOperationBusMasterCommonBuffer,
96 EfiPciIoOperationMaximum
97 } EFI_PCI_IO_PROTOCOL_OPERATION;
98
99 //
100 // *******************************************************
101 // EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION
102 // *******************************************************
103 //
104 typedef enum {
105 EfiPciIoAttributeOperationGet,
106 EfiPciIoAttributeOperationSet,
107 EfiPciIoAttributeOperationEnable,
108 EfiPciIoAttributeOperationDisable,
109 EfiPciIoAttributeOperationSupported,
110 EfiPciIoAttributeOperationMaximum
111 } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
112
113 typedef
114 EFI_STATUS
115 (EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) (
116 IN EFI_PCI_IO_PROTOCOL * This,
117 IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
118 IN UINT8 BarIndex,
119 IN UINT64 Offset,
120 IN UINT64 Mask,
121 IN UINT64 Value,
122 IN UINT64 Delay,
123 OUT UINT64 *Result
124 );
125
126 typedef
127 EFI_STATUS
128 (EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) (
129 IN EFI_PCI_IO_PROTOCOL * This,
130 IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
131 IN UINT8 BarIndex,
132 IN UINT64 Offset,
133 IN UINTN Count,
134 IN OUT VOID *Buffer
135 );
136
137 typedef struct {
138 EFI_PCI_IO_PROTOCOL_IO_MEM Read;
139 EFI_PCI_IO_PROTOCOL_IO_MEM Write;
140 } EFI_PCI_IO_PROTOCOL_ACCESS;
141
142 typedef
143 EFI_STATUS
144 (EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) (
145 IN EFI_PCI_IO_PROTOCOL * This,
146 IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
147 IN UINT32 Offset,
148 IN UINTN Count,
149 IN OUT VOID *Buffer
150 );
151
152 typedef struct {
153 EFI_PCI_IO_PROTOCOL_CONFIG Read;
154 EFI_PCI_IO_PROTOCOL_CONFIG Write;
155 } EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
156
157 typedef
158 EFI_STATUS
159 (EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) (
160 IN EFI_PCI_IO_PROTOCOL * This,
161 IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
162 IN UINT8 DestBarIndex,
163 IN UINT64 DestOffset,
164 IN UINT8 SrcBarIndex,
165 IN UINT64 SrcOffset,
166 IN UINTN Count
167 );
168
169 typedef
170 EFI_STATUS
171 (EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) (
172 IN EFI_PCI_IO_PROTOCOL * This,
173 IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
174 IN VOID *HostAddress,
175 IN OUT UINTN *NumberOfBytes,
176 OUT EFI_PHYSICAL_ADDRESS * DeviceAddress,
177 OUT VOID **Mapping
178 );
179
180 typedef
181 EFI_STATUS
182 (EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) (
183 IN EFI_PCI_IO_PROTOCOL * This,
184 IN VOID *Mapping
185 );
186
187 typedef
188 EFI_STATUS
189 (EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) (
190 IN EFI_PCI_IO_PROTOCOL * This,
191 IN EFI_ALLOCATE_TYPE Type,
192 IN EFI_MEMORY_TYPE MemoryType,
193 IN UINTN Pages,
194 OUT VOID **HostAddress,
195 IN UINT64 Attributes
196 );
197
198 typedef
199 EFI_STATUS
200 (EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) (
201 IN EFI_PCI_IO_PROTOCOL * This,
202 IN UINTN Pages,
203 IN VOID *HostAddress
204 );
205
206 typedef
207 EFI_STATUS
208 (EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) (
209 IN EFI_PCI_IO_PROTOCOL * This
210 );
211
212 typedef
213 EFI_STATUS
214 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) (
215 IN EFI_PCI_IO_PROTOCOL * This,
216 OUT UINTN *SegmentNumber,
217 OUT UINTN *BusNumber,
218 OUT UINTN *DeviceNumber,
219 OUT UINTN *FunctionNumber
220 );
221
222 typedef
223 EFI_STATUS
224 (EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) (
225 IN EFI_PCI_IO_PROTOCOL * This,
226 IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
227 IN UINT64 Attributes,
228 OUT UINT64 *Result OPTIONAL
229 );
230
231 typedef
232 EFI_STATUS
233 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) (
234 IN EFI_PCI_IO_PROTOCOL * This,
235 IN UINT8 BarIndex,
236 OUT UINT64 *Supports, OPTIONAL
237 OUT VOID **Resources OPTIONAL
238 );
239
240 typedef
241 EFI_STATUS
242 (EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) (
243 IN EFI_PCI_IO_PROTOCOL * This,
244 IN UINT64 Attributes,
245 IN UINT8 BarIndex,
246 IN OUT UINT64 *Offset,
247 IN OUT UINT64 *Length
248 );
249
250 //
251 // Interface structure for the PCI I/O Protocol
252 //
253 struct _EFI_PCI_IO_PROTOCOL {
254 EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem;
255 EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo;
256 EFI_PCI_IO_PROTOCOL_ACCESS Mem;
257 EFI_PCI_IO_PROTOCOL_ACCESS Io;
258 EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
259 EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem;
260 EFI_PCI_IO_PROTOCOL_MAP Map;
261 EFI_PCI_IO_PROTOCOL_UNMAP Unmap;
262 EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
263 EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
264 EFI_PCI_IO_PROTOCOL_FLUSH Flush;
265 EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
266 EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes;
267 EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes;
268 EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes;
269 UINT64 RomSize;
270 VOID *RomImage;
271 };
272
273 extern EFI_GUID gEfiPciIoProtocolGuid;
274
275 #endif