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__
18 #include <Library/BaseMemoryLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/MemoryAllocationLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/UefiLib.h>
24 #include <IndustryStandard/Pci.h>
26 #include <Protocol/ComponentName.h>
27 #include <Protocol/NonDiscoverableDevice.h>
28 #include <Protocol/PciIo.h>
30 #define NON_DISCOVERABLE_PCI_DEVICE_SIG SIGNATURE_32 ('P', 'P', 'I', 'D')
32 #define NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(PciIoPointer) \
33 CR (PciIoPointer, NON_DISCOVERABLE_PCI_DEVICE, PciIo, \
34 NON_DISCOVERABLE_PCI_DEVICE_SIG)
36 #define PCI_ID_VENDOR_UNKNOWN 0xffff
37 #define PCI_ID_DEVICE_DONTCARE 0x0000
39 #define PCI_MAX_BARS 6
44 // The bound non-discoverable device protocol instance
46 NON_DISCOVERABLE_DEVICE
*Device
;
48 // The exposed PCI I/O protocol instance.
50 EFI_PCI_IO_PROTOCOL PciIo
;
52 // The emulated PCI config space of the device. Only the minimally required
53 // items are assigned.
55 PCI_TYPE00 ConfigSpace
;
57 // The first virtual BAR to assign based on the resources described
58 // by the non-discoverable device.
62 // The number of virtual BARs we expose based on the number of
67 // The PCI I/O attributes for this device
71 // Whether this device has been enabled
74 } NON_DISCOVERABLE_PCI_DEVICE
;
77 InitializePciIoProtocol (
78 NON_DISCOVERABLE_PCI_DEVICE
*Device
81 extern EFI_COMPONENT_NAME_PROTOCOL gComponentName
;
82 extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2
;