]>
Commit | Line | Data |
---|---|---|
6a744d40 LE |
1 | /** @file\r |
2 | Library class layered on top of PciCapLib that allows clients to plug a\r | |
3 | PciSegmentLib backend into PciCapLib, for config space access.\r | |
4 | \r | |
5 | Copyright (C) 2018, Red Hat, Inc.\r | |
6 | \r | |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
6a744d40 LE |
8 | **/\r |
9 | \r | |
10 | #ifndef __PCI_CAP_PCI_SEGMENT_LIB_H__\r | |
11 | #define __PCI_CAP_PCI_SEGMENT_LIB_H__\r | |
12 | \r | |
13 | #include <Library/PciCapLib.h>\r | |
14 | \r | |
15 | \r | |
16 | /**\r | |
17 | Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function\r | |
18 | quadruplet. The config space accessors are based upon PciSegmentLib.\r | |
19 | \r | |
20 | @param[in] MaxDomain If MaxDomain is PciCapExtended, then\r | |
21 | PciDevice->ReadConfig() and PciDevice->WriteConfig()\r | |
22 | will delegate extended config space accesses too to\r | |
23 | PciSegmentReadBuffer() and PciSegmentWriteBuffer(),\r | |
24 | respectively. Otherwise, PciDevice->ReadConfig() and\r | |
25 | PciDevice->WriteConfig() will reject accesses to\r | |
26 | extended config space with RETURN_UNSUPPORTED, without\r | |
27 | calling PciSegmentReadBuffer() or\r | |
28 | PciSegmentWriteBuffer(). By setting MaxDomain to\r | |
29 | PciCapNormal, the platform can prevent undefined\r | |
30 | PciSegmentLib behavior when the PCI root bridge under\r | |
31 | the PCI device at Segment:Bus:Device.Function doesn't\r | |
32 | support extended config space.\r | |
33 | \r | |
34 | @param[in] Segment 16-bit wide segment number.\r | |
35 | \r | |
36 | @param[in] Bus 8-bit wide bus number.\r | |
37 | \r | |
38 | @param[in] Device 5-bit wide device number.\r | |
39 | \r | |
40 | @param[in] Function 3-bit wide function number.\r | |
41 | \r | |
42 | @param[out] PciDevice The PCI_CAP_DEV object constructed as described above.\r | |
43 | PciDevice can be passed to the PciCapLib APIs.\r | |
44 | \r | |
45 | @retval RETURN_SUCCESS PciDevice has been constructed and output.\r | |
46 | \r | |
47 | @retval RETURN_INVALID_PARAMETER Device or Function does not fit in the\r | |
48 | permitted number of bits.\r | |
49 | \r | |
50 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r | |
51 | **/\r | |
52 | RETURN_STATUS\r | |
53 | EFIAPI\r | |
54 | PciCapPciSegmentDeviceInit (\r | |
55 | IN PCI_CAP_DOMAIN MaxDomain,\r | |
56 | IN UINT16 Segment,\r | |
57 | IN UINT8 Bus,\r | |
58 | IN UINT8 Device,\r | |
59 | IN UINT8 Function,\r | |
60 | OUT PCI_CAP_DEV **PciDevice\r | |
61 | );\r | |
62 | \r | |
63 | \r | |
64 | /**\r | |
65 | Free the resources used by PciDevice.\r | |
66 | \r | |
67 | @param[in] PciDevice The PCI_CAP_DEV object to free, originally produced by\r | |
68 | PciCapPciSegmentDeviceInit().\r | |
69 | **/\r | |
70 | VOID\r | |
71 | EFIAPI\r | |
72 | PciCapPciSegmentDeviceUninit (\r | |
73 | IN PCI_CAP_DEV *PciDevice\r | |
74 | );\r | |
75 | \r | |
76 | #endif // __PCI_CAP_PCI_SEGMENT_LIB_H__\r |