]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/PciCapPciSegmentLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / Library / PciCapPciSegmentLib.h
CommitLineData
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
6a744d40
LE
15/**\r
16 Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function\r
17 quadruplet. The config space accessors are based upon PciSegmentLib.\r
18\r
19 @param[in] MaxDomain If MaxDomain is PciCapExtended, then\r
20 PciDevice->ReadConfig() and PciDevice->WriteConfig()\r
21 will delegate extended config space accesses too to\r
22 PciSegmentReadBuffer() and PciSegmentWriteBuffer(),\r
23 respectively. Otherwise, PciDevice->ReadConfig() and\r
24 PciDevice->WriteConfig() will reject accesses to\r
25 extended config space with RETURN_UNSUPPORTED, without\r
26 calling PciSegmentReadBuffer() or\r
27 PciSegmentWriteBuffer(). By setting MaxDomain to\r
28 PciCapNormal, the platform can prevent undefined\r
29 PciSegmentLib behavior when the PCI root bridge under\r
30 the PCI device at Segment:Bus:Device.Function doesn't\r
31 support extended config space.\r
32\r
33 @param[in] Segment 16-bit wide segment number.\r
34\r
35 @param[in] Bus 8-bit wide bus number.\r
36\r
37 @param[in] Device 5-bit wide device number.\r
38\r
39 @param[in] Function 3-bit wide function number.\r
40\r
41 @param[out] PciDevice The PCI_CAP_DEV object constructed as described above.\r
42 PciDevice can be passed to the PciCapLib APIs.\r
43\r
44 @retval RETURN_SUCCESS PciDevice has been constructed and output.\r
45\r
46 @retval RETURN_INVALID_PARAMETER Device or Function does not fit in the\r
47 permitted number of bits.\r
48\r
49 @retval RETURN_OUT_OF_RESOURCES Memory allocation failed.\r
50**/\r
51RETURN_STATUS\r
52EFIAPI\r
53PciCapPciSegmentDeviceInit (\r
ac0a286f
MK
54 IN PCI_CAP_DOMAIN MaxDomain,\r
55 IN UINT16 Segment,\r
56 IN UINT8 Bus,\r
57 IN UINT8 Device,\r
58 IN UINT8 Function,\r
59 OUT PCI_CAP_DEV **PciDevice\r
6a744d40
LE
60 );\r
61\r
6a744d40
LE
62/**\r
63 Free the resources used by PciDevice.\r
64\r
65 @param[in] PciDevice The PCI_CAP_DEV object to free, originally produced by\r
66 PciCapPciSegmentDeviceInit().\r
67**/\r
68VOID\r
69EFIAPI\r
70PciCapPciSegmentDeviceUninit (\r
ac0a286f 71 IN PCI_CAP_DEV *PciDevice\r
6a744d40
LE
72 );\r
73\r
74#endif // __PCI_CAP_PCI_SEGMENT_LIB_H__\r