3 Copyright (C) 2016, Linaro Ltd. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
11 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __NON_DISCOVERABLE_PCI_DEVICE_IO_H__
16 #define __NON_DISCOVERABLE_PCI_DEVICE_IO_H__
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/MemoryAllocationLib.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/UefiLib.h>
26 #include <IndustryStandard/Pci.h>
28 #include <Protocol/ComponentName.h>
29 #include <Protocol/NonDiscoverableDevice.h>
30 #include <Protocol/Cpu.h>
31 #include <Protocol/PciIo.h>
33 #define NON_DISCOVERABLE_PCI_DEVICE_SIG SIGNATURE_32 ('P', 'P', 'I', 'D')
35 #define NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(PciIoPointer) \
36 CR (PciIoPointer, NON_DISCOVERABLE_PCI_DEVICE, PciIo, \
37 NON_DISCOVERABLE_PCI_DEVICE_SIG)
39 #define PCI_ID_VENDOR_UNKNOWN 0xffff
40 #define PCI_ID_DEVICE_DONTCARE 0x0000
42 #define PCI_MAX_BARS 6
44 extern EFI_CPU_ARCH_PROTOCOL
*mCpu
;
48 // The linked-list next pointer
52 // The address of the uncached allocation
56 // The number of pages in the allocation
60 // The attributes of the allocation
63 } NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION
;
68 // The bound non-discoverable device protocol instance
70 NON_DISCOVERABLE_DEVICE
*Device
;
72 // The exposed PCI I/O protocol instance.
74 EFI_PCI_IO_PROTOCOL PciIo
;
76 // The emulated PCI config space of the device. Only the minimally required
77 // items are assigned.
79 PCI_TYPE00 ConfigSpace
;
81 // The first virtual BAR to assign based on the resources described
82 // by the non-discoverable device.
86 // The number of virtual BARs we expose based on the number of
91 // The PCI I/O attributes for this device
95 // Whether this device has been enabled
99 // Linked list to keep track of uncached allocations performed
100 // on behalf of this device
102 LIST_ENTRY UncachedAllocationList
;
103 } NON_DISCOVERABLE_PCI_DEVICE
;
106 Initialize PciIo Protocol.
108 @param Device Point to NON_DISCOVERABLE_PCI_DEVICE instance.
112 InitializePciIoProtocol (
113 NON_DISCOVERABLE_PCI_DEVICE
*Device
116 extern EFI_COMPONENT_NAME_PROTOCOL gComponentName
;
117 extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2
;