1 // Copyright 2018 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ZIRCON_HW_PCI_H_ 6 #define ZIRCON_HW_PCI_H_ 7 8 #include <stdint.h> 9 #include <zircon/compiler.h> 10 11 __BEGIN_CDECLS; 12 13 // Structure for passing around PCI address information 14 typedef struct pci_bdf { 15 uint8_t bus_id; 16 uint8_t device_id; 17 uint8_t function_id; 18 } pci_bdf_t; 19 20 // TODO(cja): This header is used for the transition of these defines from 21 // kernel to userspace, but due to pci_bdf_t some of the kernel includes it. 22 // Make sure defines here don't clash with those in pci_common.h by having this 23 // guard, but remove it after the transition. 24 #ifndef WITH_KERNEL_PCIE 25 26 #define PCI_MAX_BUSES (256u) 27 #define PCI_MAX_DEVICES_PER_BUS (32u) 28 #define PCI_MAX_FUNCTIONS_PER_DEVICE (8u) 29 #define PCI_MAX_FUNCTIONS_PER_BUS (PCI_MAX_DEVICES_PER_BUS * PCI_MAX_FUNCTIONS_PER_DEVICE) 30 31 #define PCI_STANDARD_CONFIG_HDR_SIZE (64u) 32 #define PCI_BASE_CONFIG_SIZE (256u) 33 #define PCIE_EXTENDED_CONFIG_SIZE (4096u) 34 #define PCIE_ECAM_BYTES_PER_BUS (PCIE_EXTENDED_CONFIG_SIZE * PCI_MAX_FUNCTIONS_PER_BUS) 35 36 #define PCI_BAR_REGS_PER_BRIDGE (2u) 37 #define PCI_BAR_REGS_PER_DEVICE (6u) 38 #define PCI_MAX_BAR_REGS (6u) 39 40 #define PCI_MAX_LEGACY_IRQ_PINS (4u) 41 #define PCI_MAX_MSI_IRQS (32u) 42 #define PCIE_MAX_MSIX_IRQS (2048u) 43 44 #define PCI_INVALID_VENDOR_ID (0xFFFF) 45 46 #endif // WITH_KERNEL_PCIE 47 48 __END_CDECLS; 49 50 #endif // ZIRCON_HW_PCI_H_ 51