]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/PciCapPciIoLib.h
OvmfPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / OvmfPkg / Include / Library / PciCapPciIoLib.h
1 /** @file
2 Library class layered on top of PciCapLib that allows clients to plug an
3 EFI_PCI_IO_PROTOCOL 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_IO_LIB_H__
11 #define __PCI_CAP_PCI_IO_LIB_H__
12
13 #include <Protocol/PciIo.h>
14
15 #include <Library/PciCapLib.h>
16
17
18 /**
19 Create a PCI_CAP_DEV object from an EFI_PCI_IO_PROTOCOL instance. The config
20 space accessors are based upon EFI_PCI_IO_PROTOCOL.Pci.Read() and
21 EFI_PCI_IO_PROTOCOL.Pci.Write().
22
23 @param[in] PciIo EFI_PCI_IO_PROTOCOL representation of the PCI device.
24
25 @param[out] PciDevice The PCI_CAP_DEV object constructed as described above.
26 PciDevice can be passed to the PciCapLib APIs.
27
28 @retval EFI_SUCCESS PciDevice has been constructed and output.
29
30 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
31 **/
32 EFI_STATUS
33 EFIAPI
34 PciCapPciIoDeviceInit (
35 IN EFI_PCI_IO_PROTOCOL *PciIo,
36 OUT PCI_CAP_DEV **PciDevice
37 );
38
39
40 /**
41 Free the resources used by PciDevice.
42
43 @param[in] PciDevice The PCI_CAP_DEV object to free, originally produced by
44 PciCapPciIoDeviceInit().
45 **/
46 VOID
47 EFIAPI
48 PciCapPciIoDeviceUninit (
49 IN PCI_CAP_DEV *PciDevice
50 );
51
52 #endif // __PCI_CAP_PCI_IO_LIB_H__