TianoCore EDK2 master
Loading...
Searching...
No Matches
PciCapLib.h
Go to the documentation of this file.
1
12#ifndef __PCI_CAP_LIB_H__
13#define __PCI_CAP_LIB_H__
14
15#include <Uefi/UefiBaseType.h>
16
17//
18// Base structure for representing a PCI device -- down to the PCI function
19// level -- for the purposes of this library class. This is a forward
20// declaration that is completed below. Concrete implementations are supposed
21// to inherit and extend this type.
22//
23typedef struct PCI_CAP_DEV PCI_CAP_DEV;
24
51typedef
52RETURN_STATUS
54 IN PCI_CAP_DEV *PciDevice,
55 IN UINT16 SourceOffset,
56 OUT VOID *DestinationBuffer,
57 IN UINT16 Size
58 );
59
86typedef
87RETURN_STATUS
89 IN PCI_CAP_DEV *PciDevice,
90 IN UINT16 DestinationOffset,
91 IN VOID *SourceBuffer,
92 IN UINT16 Size
93 );
94
95//
96// Complete the PCI_CAP_DEV type here. The base abstraction only requires
97// config space accessors.
98//
100 PCI_CAP_DEV_READ_CONFIG ReadConfig;
101 PCI_CAP_DEV_WRITE_CONFIG WriteConfig;
102};
103
104//
105// Opaque data structure representing parsed PCI Capabilities Lists.
106//
107typedef struct PCI_CAP_LIST PCI_CAP_LIST;
108
109//
110// Opaque data structure representing a PCI Capability in a parsed Capability
111// List.
112//
113typedef struct PCI_CAP PCI_CAP;
114
115//
116// Distinguishes whether a Capability ID is 8-bit wide and interpreted in
117// normal config space, or 16-bit wide and interpreted in extended config
118// space. Capability ID definitions are relative to domain.
119//
120typedef enum {
121 PciCapNormal,
122 PciCapExtended
123} PCI_CAP_DOMAIN;
124
125//
126// Public data structure that PciCapGetInfo() fills in about a PCI_CAP object.
127//
128typedef struct {
129 PCI_CAP_DOMAIN Domain;
130 UINT16 CapId;
131 //
132 // The capability identified by Domain and CapId may have multiple instances
133 // in config space. NumInstances provides the total count of occurrences of
134 // the capability. It is always positive.
135 //
136 UINT16 NumInstances;
137 //
138 // Instance is the serial number, in capabilities list traversal order (not
139 // necessarily config space offset order), of the one capability instance
140 // that PciCapGetInfo() is reporting about. Instance is always smaller than
141 // NumInstances.
142 //
143 UINT16 Instance;
144 //
145 // The offset in config space at which the capability header of the
146 // capability instance starts.
147 //
148 UINT16 Offset;
149 //
150 // The deduced maximum size of the capability instance, including the
151 // capability header. This hint is an upper bound, calculated -- without
152 // regard to the internal structure of the capability -- from (a) the next
153 // lowest offset in configuration space that is known to be used by another
154 // capability, and (b) from the end of the config space identified by Domain,
155 // whichever is lower.
156 //
157 UINT16 MaxSizeHint;
158 //
159 // The version number of the capability instance. Always zero when Domain is
160 // PciCapNormal.
161 //
162 UINT8 Version;
164
197RETURN_STATUS
198EFIAPI
200 IN PCI_CAP_DEV *PciDevice,
201 OUT PCI_CAP_LIST **CapList
202 );
203
210VOID
211EFIAPI
213 IN PCI_CAP_LIST *CapList
214 );
215
249RETURN_STATUS
250EFIAPI
252 IN PCI_CAP_LIST *CapList,
253 IN PCI_CAP_DOMAIN Domain,
254 IN UINT16 CapId,
255 IN UINT16 Instance,
256 OUT PCI_CAP **Cap OPTIONAL
257 );
258
292RETURN_STATUS
293EFIAPI
295 IN PCI_CAP_LIST *CapList,
296 IN PCI_CAP_DOMAIN Domain,
297 IN UINT16 CapId,
298 IN UINT8 MinVersion,
299 OUT PCI_CAP **Cap OPTIONAL
300 );
301
316RETURN_STATUS
317EFIAPI
319 IN PCI_CAP *Cap,
320 OUT PCI_CAP_INFO *Info
321 );
322
359RETURN_STATUS
360EFIAPI
362 IN PCI_CAP_DEV *PciDevice,
363 IN PCI_CAP *Cap,
364 IN UINT16 SourceOffsetInCap,
365 OUT VOID *DestinationBuffer,
366 IN UINT16 Size
367 );
368
406RETURN_STATUS
407EFIAPI
409 IN PCI_CAP_DEV *PciDevice,
410 IN PCI_CAP *Cap,
411 IN UINT16 DestinationOffsetInCap,
412 IN VOID *SourceBuffer,
413 IN UINT16 Size
414 );
415
416#endif // __PCI_CAP_LIB_H__
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID EFIAPI PciCapListUninit(IN PCI_CAP_LIST *CapList)
RETURN_STATUS EFIAPI PciCapWrite(IN PCI_CAP_DEV *PciDevice, IN PCI_CAP *Cap, IN UINT16 DestinationOffsetInCap, IN VOID *SourceBuffer, IN UINT16 Size)
RETURN_STATUS EFIAPI PciCapListFindCapVersion(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT8 MinVersion, OUT PCI_CAP **Cap OPTIONAL)
RETURN_STATUS(EFIAPI * PCI_CAP_DEV_READ_CONFIG)(IN PCI_CAP_DEV *PciDevice, IN UINT16 SourceOffset, OUT VOID *DestinationBuffer, IN UINT16 Size)
Definition: PciCapLib.h:53
RETURN_STATUS(EFIAPI * PCI_CAP_DEV_WRITE_CONFIG)(IN PCI_CAP_DEV *PciDevice, IN UINT16 DestinationOffset, IN VOID *SourceBuffer, IN UINT16 Size)
Definition: PciCapLib.h:88
RETURN_STATUS EFIAPI PciCapListInit(IN PCI_CAP_DEV *PciDevice, OUT PCI_CAP_LIST **CapList)
RETURN_STATUS EFIAPI PciCapGetInfo(IN PCI_CAP *Cap, OUT PCI_CAP_INFO *Info)
RETURN_STATUS EFIAPI PciCapRead(IN PCI_CAP_DEV *PciDevice, IN PCI_CAP *Cap, IN UINT16 SourceOffsetInCap, OUT VOID *DestinationBuffer, IN UINT16 Size)
RETURN_STATUS EFIAPI PciCapListFindCap(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT16 Instance, OUT PCI_CAP **Cap OPTIONAL)