]>
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 | |
7 | This program and the accompanying materials are licensed and made available\r | |
8 | under the terms and conditions of the BSD License which accompanies this\r | |
9 | distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r | |
13 | WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __PCI_CAP_PCI_SEGMENT_LIB_H__\r | |
17 | #define __PCI_CAP_PCI_SEGMENT_LIB_H__\r | |
18 | \r | |
19 | #include <Library/PciCapLib.h>\r | |
20 | \r | |
21 | \r | |
22 | /**\r | |
23 | Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function\r | |
24 | quadruplet. The config space accessors are based upon PciSegmentLib.\r | |
25 | \r | |
26 | @param[in] MaxDomain If MaxDomain is PciCapExtended, then\r | |
27 | PciDevice->ReadConfig() and PciDevice->WriteConfig()\r | |
28 | will delegate extended config space accesses too to\r | |
29 | PciSegmentReadBuffer() and PciSegmentWriteBuffer(),\r | |
30 | respectively. Otherwise, PciDevice->ReadConfig() and\r | |
31 | PciDevice->WriteConfig() will reject accesses to\r | |
32 | extended config space with RETURN_UNSUPPORTED, without\r | |
33 | calling PciSegmentReadBuffer() or\r | |
34 | PciSegmentWriteBuffer(). By setting MaxDomain to\r | |
35 | PciCapNormal, the platform can prevent undefined\r | |
36 | PciSegmentLib behavior when the PCI root bridge under\r | |
37 | the PCI device at Segment:Bus:Device.Function doesn't\r | |
38 | support extended config space.\r | |
39 | \r | |
40 | @param[in] Segment 16-bit wide segment number.\r | |
41 | \r | |
42 | @param[in] Bus 8-bit wide bus number.\r | |
43 | \r | |
44 | @param[in] Device 5-bit wide device number.\r | |
45 | \r | |
46 | @param[in] Function 3-bit wide function number.\r | |
47 | \r | |
48 | @param[out] PciDevice The PCI_CAP_DEV object constructed as described above.\r | |
49 | PciDevice can be passed to the PciCapLib APIs.\r | |
50 | \r | |
51 | @retval RETURN_SUCCESS PciDevice has been constructed and output.\r | |
52 | \r | |
53 | @retval RETURN_INVALID_PARAMETER Device or Function does not fit in the\r | |
54 | permitted number of bits.\r | |
55 | \r | |
56 | @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r | |
57 | **/\r | |
58 | RETURN_STATUS\r | |
59 | EFIAPI\r | |
60 | PciCapPciSegmentDeviceInit (\r | |
61 | IN PCI_CAP_DOMAIN MaxDomain,\r | |
62 | IN UINT16 Segment,\r | |
63 | IN UINT8 Bus,\r | |
64 | IN UINT8 Device,\r | |
65 | IN UINT8 Function,\r | |
66 | OUT PCI_CAP_DEV **PciDevice\r | |
67 | );\r | |
68 | \r | |
69 | \r | |
70 | /**\r | |
71 | Free the resources used by PciDevice.\r | |
72 | \r | |
73 | @param[in] PciDevice The PCI_CAP_DEV object to free, originally produced by\r | |
74 | PciCapPciSegmentDeviceInit().\r | |
75 | **/\r | |
76 | VOID\r | |
77 | EFIAPI\r | |
78 | PciCapPciSegmentDeviceUninit (\r | |
79 | IN PCI_CAP_DEV *PciDevice\r | |
80 | );\r | |
81 | \r | |
82 | #endif // __PCI_CAP_PCI_SEGMENT_LIB_H__\r |