]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/PciCapPciIoLib.h
OvmfPkg: introduce PciCapPciIoLib
[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 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License which accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 **/
15
16 #ifndef __PCI_CAP_PCI_IO_LIB_H__
17 #define __PCI_CAP_PCI_IO_LIB_H__
18
19 #include <Protocol/PciIo.h>
20
21 #include <Library/PciCapLib.h>
22
23
24 /**
25 Create a PCI_CAP_DEV object from an EFI_PCI_IO_PROTOCOL instance. The config
26 space accessors are based upon EFI_PCI_IO_PROTOCOL.Pci.Read() and
27 EFI_PCI_IO_PROTOCOL.Pci.Write().
28
29 @param[in] PciIo EFI_PCI_IO_PROTOCOL representation of the PCI device.
30
31 @param[out] PciDevice The PCI_CAP_DEV object constructed as described above.
32 PciDevice can be passed to the PciCapLib APIs.
33
34 @retval EFI_SUCCESS PciDevice has been constructed and output.
35
36 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
37 **/
38 EFI_STATUS
39 EFIAPI
40 PciCapPciIoDeviceInit (
41 IN EFI_PCI_IO_PROTOCOL *PciIo,
42 OUT PCI_CAP_DEV **PciDevice
43 );
44
45
46 /**
47 Free the resources used by PciDevice.
48
49 @param[in] PciDevice The PCI_CAP_DEV object to free, originally produced by
50 PciCapPciIoDeviceInit().
51 **/
52 VOID
53 EFIAPI
54 PciCapPciIoDeviceUninit (
55 IN PCI_CAP_DEV *PciDevice
56 );
57
58 #endif // __PCI_CAP_PCI_IO_LIB_H__