]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/PciRootBridgeIo.h
Add EFI_NETWORK_INTERFACE_TYPE definition
[mirror_edk2.git] / MdePkg / Include / Protocol / PciRootBridgeIo.h
CommitLineData
d1f95000 1/** @file\r
8a7d75b0 2 PCI Root Bridge I/O protocol as defined in the UEFI 2.0 specification.\r
d1f95000 3\r
4 PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform PCI Memory, PCI I/O, \r
5 and PCI Configuration cycles on a PCI Root Bridge. It also provides services to perform \r
6 defferent types of bus mastering DMA\r
7\r
4ca9b6c4 8 Copyright (c) 2006 - 2008, Intel Corporation \r
d1f95000 9 All rights reserved. This program and the accompanying materials \r
10 are licensed and made available under the terms and conditions of the BSD License \r
11 which accompanies this distribution. The full text of the license may be found at \r
12 http://opensource.org/licenses/bsd-license.php \r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
16\r
d1f95000 17**/\r
18\r
19#ifndef __PCI_ROOT_BRIDGE_IO_H__\r
20#define __PCI_ROOT_BRIDGE_IO_H__\r
21\r
22#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \\r
23 { \\r
24 0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
25 }\r
26\r
27typedef struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL;\r
28\r
9319d2c2
LG
29///\r
30/// *******************************************************\r
31/// EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH\r
32/// *******************************************************\r
33///\r
d1f95000 34typedef enum {\r
35 EfiPciWidthUint8,\r
36 EfiPciWidthUint16,\r
37 EfiPciWidthUint32,\r
38 EfiPciWidthUint64,\r
39 EfiPciWidthFifoUint8,\r
40 EfiPciWidthFifoUint16,\r
41 EfiPciWidthFifoUint32,\r
42 EfiPciWidthFifoUint64,\r
43 EfiPciWidthFillUint8,\r
44 EfiPciWidthFillUint16,\r
45 EfiPciWidthFillUint32,\r
46 EfiPciWidthFillUint64,\r
47 EfiPciWidthMaximum\r
48} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH;\r
49\r
9319d2c2
LG
50///\r
51/// *******************************************************\r
52/// EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION\r
53/// *******************************************************\r
54///\r
d1f95000 55typedef enum {\r
9319d2c2
LG
56 ///\r
57 /// A read operation from system memory by a bus master that is not capable of producing\r
58 /// PCI dual address cycles.\r
59 ///\r
d1f95000 60 EfiPciOperationBusMasterRead,\r
9319d2c2
LG
61 ///\r
62 /// A write operation from system memory by a bus master that is not capable of producing\r
63 /// PCI dual address cycles.\r
64 ///\r
d1f95000 65 EfiPciOperationBusMasterWrite,\r
9319d2c2
LG
66 ///\r
67 /// Provides both read and write access to system memory by both the processor and a bus\r
68 /// master that is not capable of producing PCI dual address cycles.\r
69 ///\r
d1f95000 70 EfiPciOperationBusMasterCommonBuffer,\r
9319d2c2
LG
71 ///\r
72 /// A read operation from system memory by a bus master that is capable of producing PCI\r
73 /// dual address cycles.\r
74 ///\r
d1f95000 75 EfiPciOperationBusMasterRead64,\r
9319d2c2
LG
76 ///\r
77 /// A write operation to system memory by a bus master that is capable of producing PCI\r
78 /// dual address cycles.\r
79 ///\r
d1f95000 80 EfiPciOperationBusMasterWrite64,\r
9319d2c2
LG
81 ///\r
82 /// Provides both read and write access to system memory by both the processor and a bus\r
83 /// master that is capable of producing PCI dual address cycles.\r
84 ///\r
d1f95000 85 EfiPciOperationBusMasterCommonBuffer64,\r
86 EfiPciOperationMaximum\r
87} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION;\r
88\r
89#define EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001\r
90#define EFI_PCI_ATTRIBUTE_ISA_IO 0x0002\r
91#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO 0x0004\r
92#define EFI_PCI_ATTRIBUTE_VGA_MEMORY 0x0008\r
93#define EFI_PCI_ATTRIBUTE_VGA_IO 0x0010\r
94#define EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO 0x0020\r
95#define EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO 0x0040\r
96#define EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080\r
97#define EFI_PCI_ATTRIBUTE_MEMORY_CACHED 0x0800\r
98#define EFI_PCI_ATTRIBUTE_MEMORY_DISABLE 0x1000\r
99#define EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000\r
100\r
101#define EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER (EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE | EFI_PCI_ATTRIBUTE_MEMORY_CACHED | EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE)\r
102\r
103#define EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER (~EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER)\r
104\r
105#define EFI_PCI_ADDRESS(bus, dev, func, reg) \\r
106 ((UINT64) ((((UINTN) bus) << 24) + (((UINTN) dev) << 16) + (((UINTN) func) << 8) + ((UINTN) reg)))\r
107\r
108typedef struct {\r
109 UINT8 Register;\r
110 UINT8 Function;\r
111 UINT8 Device;\r
112 UINT8 Bus;\r
113 UINT32 ExtendedRegister;\r
114} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS;\r
115\r
116/** \r
117 Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is\r
118 satisfied or after a defined duration.\r
119 \r
120 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
121 @param Width Signifies the width of the memory or I/O operations.\r
122 @param Address The base address of the memory or I/O operations. \r
123 @param Mask Mask used for the polling criteria.\r
124 @param Value The comparison value used for the polling exit criteria.\r
125 @param Delay The number of 100 ns units to poll.\r
126 @param Result Pointer to the last value read from the memory location.\r
127 \r
128 @retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.\r
129 @retval EFI_TIMEOUT Delay expired before a match occurred.\r
130 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
131 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
132 \r
133**/\r
134typedef\r
135EFI_STATUS\r
8b13229b 136(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM)(\r
d1f95000 137 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
138 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
139 IN UINT64 Address,\r
140 IN UINT64 Mask,\r
141 IN UINT64 Value,\r
142 IN UINT64 Delay,\r
143 OUT UINT64 *Result\r
144 );\r
145\r
146/** \r
147 Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.\r
148 \r
149 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
150 @param Width Signifies the width of the memory operations.\r
151 @param Address The base address of the memory operations. \r
152 @param Count The number of memory operations to perform.\r
153 @param Buffer For read operations, the destination buffer to store the results. For write\r
154 operations, the source buffer to write data from. \r
155 \r
156 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge. \r
157 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
158 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
159 \r
160**/\r
161typedef\r
162EFI_STATUS\r
8b13229b 163(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM)(\r
d1f95000 164 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
165 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
166 IN UINT64 Address,\r
167 IN UINTN Count,\r
168 IN OUT VOID *Buffer\r
169 );\r
170\r
171typedef struct {\r
172 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Read;\r
173 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Write;\r
174} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS;\r
175\r
176/** \r
177 Enables a PCI driver to copy one region of PCI root bridge memory space to another region of PCI\r
178 root bridge memory space. \r
179 \r
180 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.\r
181 @param Width Signifies the width of the memory operations.\r
182 @param DestAddress The destination address of the memory operation. \r
183 @param SrcAddress The source address of the memory operation. \r
184 @param Count The number of memory operations to perform. \r
185 \r
186 @retval EFI_SUCCESS The data was copied from one memory region to another memory region. \r
187 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.\r
188 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
189 \r
190**/\r
191typedef\r
192EFI_STATUS\r
8b13229b 193(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM)(\r
d1f95000 194 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
195 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
196 IN UINT64 DestAddress,\r
197 IN UINT64 SrcAddress,\r
198 IN UINTN Count\r
199 );\r
200\r
201/** \r
202 Provides the PCI controller-Cspecific addresses required to access system memory from a\r
203 DMA bus master. \r
204 \r
205 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
206 @param Operation Indicates if the bus master is going to read or write to system memory.\r
207 @param HostAddress The system memory address to map to the PCI controller.\r
208 @param NumberOfBytes On input the number of bytes to map. On output the number of bytes\r
209 that were mapped. \r
210 @param DeviceAddress The resulting map address for the bus master PCI controller to use to\r
211 access the hosts HostAddress. \r
212 @param Mapping A resulting value to pass to Unmap().\r
213 \r
214 @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r
215 @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. \r
216 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
217 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
218 @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.\r
219 \r
220**/\r
221typedef\r
222EFI_STATUS\r
8b13229b 223(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP)(\r
d1f95000 224 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
225 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,\r
226 IN VOID *HostAddress,\r
227 IN OUT UINTN *NumberOfBytes,\r
228 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
229 OUT VOID **Mapping\r
230 );\r
231\r
232/** \r
233 Completes the Map() operation and releases any corresponding resources.\r
234 \r
235 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
236 @param Mapping The mapping value returned from Map().\r
237 \r
238 @retval EFI_SUCCESS The range was unmapped.\r
239 @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().\r
240 @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.\r
241 \r
242**/\r
243typedef\r
244EFI_STATUS\r
8b13229b 245(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP)(\r
d1f95000 246 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
247 IN VOID *Mapping\r
248 );\r
249\r
250/** \r
251 Allocates pages that are suitable for an EfiPciOperationBusMasterCommonBuffer or\r
252 EfiPciOperationBusMasterCommonBuffer64 mapping. \r
253 \r
254 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
255 @param Type This parameter is not used and must be ignored.\r
256 @param MemoryType The type of memory to allocate, EfiBootServicesData or\r
257 EfiRuntimeServicesData. \r
258 @param Pages The number of pages to allocate. \r
259 @param HostAddress A pointer to store the base system memory address of the\r
260 allocated range. \r
261 @param Attributes The requested bit mask of attributes for the allocated range.\r
262 \r
263 @retval EFI_SUCCESS The requested memory pages were allocated.\r
264 @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are\r
265 MEMORY_WRITE_COMBINE and MEMORY_CACHED. \r
266 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
267 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. \r
268 \r
269**/\r
270typedef\r
271EFI_STATUS\r
8b13229b 272(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER)(\r
d1f95000 273 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
274 IN EFI_ALLOCATE_TYPE Type,\r
275 IN EFI_MEMORY_TYPE MemoryType,\r
276 IN UINTN Pages,\r
277 IN OUT VOID **HostAddress,\r
278 IN UINT64 Attributes\r
279 );\r
280\r
281/** \r
282 Frees memory that was allocated with AllocateBuffer().\r
283 \r
284 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
285 @param Pages The number of pages to free. \r
286 @param HostAddress The base system memory address of the allocated range. \r
287 \r
288 @retval EFI_SUCCESS The requested memory pages were freed.\r
289 @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r
290 was not allocated with AllocateBuffer().\r
291 \r
292**/\r
293typedef\r
294EFI_STATUS\r
8b13229b 295(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER)(\r
d1f95000 296 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
297 IN UINTN Pages,\r
298 IN VOID *HostAddress\r
299 );\r
300\r
301/** \r
302 Flushes all PCI posted write transactions from a PCI host bridge to system memory.\r
303 \r
304 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
305 \r
306 @retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host\r
307 bridge to system memory. \r
308 @retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI\r
309 host bridge due to a hardware error. \r
310 \r
311**/\r
312typedef\r
313EFI_STATUS\r
8b13229b 314(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH)(\r
d1f95000 315 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This\r
316 );\r
317\r
318/** \r
319 Gets the attributes that a PCI root bridge supports setting with SetAttributes(), and the\r
320 attributes that a PCI root bridge is currently using. \r
321 \r
322 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
323 @param Supports A pointer to the mask of attributes that this PCI root bridge supports\r
324 setting with SetAttributes(). \r
325 @param Attributes A pointer to the mask of attributes that this PCI root bridge is currently\r
326 using. \r
327 \r
328 @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI root \r
329 bridge supports is returned in Supports. If Attributes is \r
330 not NULL, then the attributes that the PCI root bridge is currently\r
331 using is returned in Attributes. \r
332 @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.\r
333 \r
334 \r
335**/\r
336typedef\r
337EFI_STATUS\r
8b13229b 338(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES)(\r
d1f95000 339 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
340 OUT UINT64 *Supports,\r
341 OUT UINT64 *Attributes\r
342 );\r
343\r
344/** \r
345 Sets attributes for a resource range on a PCI root bridge.\r
346 \r
347 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
348 @param Attributes The mask of attributes to set.\r
349 @param ResourceBase A pointer to the base address of the resource range to be modified by the\r
350 attributes specified by Attributes.\r
351 @param ResourceLength A pointer to the length of the resource range to be modified by the\r
352 attributes specified by Attributes. \r
353 \r
354 @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource \r
355 range specified by ResourceBase and ResourceLength \r
356 were set on the PCI root bridge, and the actual resource range is\r
357 returned in ResuourceBase and ResourceLength. \r
358 @retval EFI_UNSUPPORTED A bit is set in Attributes that is not supported by the PCI Root\r
359 Bridge. \r
360 @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the \r
361 resource range specified by BaseAddress and Length. \r
362 @retval EFI_INVALID_PARAMETER One or more parameters are invalid. \r
363 \r
364**/\r
365typedef\r
366EFI_STATUS\r
8b13229b 367(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES)(\r
d1f95000 368 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
369 IN UINT64 Attributes,\r
370 IN OUT UINT64 *ResourceBase,\r
371 IN OUT UINT64 *ResourceLength\r
372 );\r
373\r
374/** \r
375 Retrieves the current resource settings of this PCI root bridge in the form of a set of ACPI 2.0\r
376 resource descriptors. \r
377 \r
378 @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
379 @param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current\r
380 configuration of this PCI root bridge. \r
381 \r
382 @retval EFI_SUCCESS The current configuration of this PCI root bridge was returned in\r
383 Resources. \r
384 @retval EFI_UNSUPPORTED The current configuration of this PCI root bridge could not be\r
385 retrieved. \r
386 \r
387**/\r
388typedef\r
389EFI_STATUS\r
8b13229b 390(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION)(\r
d1f95000 391 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,\r
392 OUT VOID **Resources\r
393 );\r
394\r
44717a39 395///\r
396/// Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are \r
397/// used to abstract accesses to PCI controllers behind a PCI Root Bridge Controller. \r
398///\r
d1f95000 399struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL {\r
cce6f7aa 400 ///\r
401 /// The EFI_HANDLE of the PCI Host Bridge of which this PCI Root Bridge is a member.\r
402 ///\r
d1f95000 403 EFI_HANDLE ParentHandle;\r
404 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollMem;\r
405 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollIo;\r
406 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Mem;\r
407 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Io;\r
408 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Pci;\r
409 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM CopyMem;\r
410 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP Map;\r
411 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP Unmap;\r
412 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;\r
413 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER FreeBuffer;\r
414 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH Flush;\r
415 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES GetAttributes;\r
416 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES SetAttributes;\r
417 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION Configuration;\r
cce6f7aa 418 \r
419 ///\r
420 /// The segment number that this PCI root bridge resides.\r
421 ///\r
d1f95000 422 UINT32 SegmentNumber;\r
423};\r
424\r
425extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid;\r
426\r
427#endif\r