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