3 Copyright (C) 2016, Linaro Ltd. All rights reserved.<BR>
\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent
\r
9 #ifndef __NON_DISCOVERABLE_PCI_DEVICE_IO_H__
\r
10 #define __NON_DISCOVERABLE_PCI_DEVICE_IO_H__
\r
14 #include <Library/BaseMemoryLib.h>
\r
15 #include <Library/DebugLib.h>
\r
16 #include <Library/MemoryAllocationLib.h>
\r
17 #include <Library/UefiBootServicesTableLib.h>
\r
18 #include <Library/UefiLib.h>
\r
20 #include <IndustryStandard/Pci.h>
\r
22 #include <Protocol/ComponentName.h>
\r
23 #include <Protocol/NonDiscoverableDevice.h>
\r
24 #include <Protocol/Cpu.h>
\r
25 #include <Protocol/PciIo.h>
\r
27 #define NON_DISCOVERABLE_PCI_DEVICE_SIG SIGNATURE_32 ('P', 'P', 'I', 'D')
\r
29 #define NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(PciIoPointer) \
\r
30 CR (PciIoPointer, NON_DISCOVERABLE_PCI_DEVICE, PciIo, \
\r
31 NON_DISCOVERABLE_PCI_DEVICE_SIG)
\r
33 #define DEV_SUPPORTED_ATTRIBUTES \
\r
34 (EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
\r
36 #define PCI_ID_VENDOR_UNKNOWN 0xffff
\r
37 #define PCI_ID_DEVICE_DONTCARE 0x0000
\r
39 #define PCI_MAX_BARS 6
\r
41 extern EFI_CPU_ARCH_PROTOCOL *mCpu;
\r
45 // The linked-list next pointer
\r
49 // The address of the uncached allocation
\r
53 // The number of pages in the allocation
\r
57 // The attributes of the allocation
\r
60 } NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION;
\r
65 // The bound non-discoverable device protocol instance
\r
67 NON_DISCOVERABLE_DEVICE *Device;
\r
69 // The exposed PCI I/O protocol instance.
\r
71 EFI_PCI_IO_PROTOCOL PciIo;
\r
73 // The emulated PCI config space of the device. Only the minimally required
\r
74 // items are assigned.
\r
76 PCI_TYPE00 ConfigSpace;
\r
78 // The first virtual BAR to assign based on the resources described
\r
79 // by the non-discoverable device.
\r
83 // The number of virtual BARs we expose based on the number of
\r
88 // The PCI I/O attributes for this device
\r
92 // Whether this device has been enabled
\r
96 // Linked list to keep track of uncached allocations performed
\r
97 // on behalf of this device
\r
99 LIST_ENTRY UncachedAllocationList;
\r
101 // Unique ID for this device instance: needed so that we can report unique
\r
102 // segment/bus/device number for each device instance. Note that this number
\r
103 // may change when disconnecting/reconnecting the driver.
\r
106 } NON_DISCOVERABLE_PCI_DEVICE;
\r
109 Initialize PciIo Protocol.
\r
111 @param Device Point to NON_DISCOVERABLE_PCI_DEVICE instance.
\r
115 InitializePciIoProtocol (
\r
116 NON_DISCOVERABLE_PCI_DEVICE *Device
\r
119 extern EFI_COMPONENT_NAME_PROTOCOL gComponentName;
\r
120 extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2;
\r