1 /* SPDX-License-Identifier: GPL-2.0 */
4 * Purpose: PCI Express Port Bus Driver's Internal Data Structures
6 * Copyright (C) 2004 Intel
7 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
13 #include <linux/compiler.h>
15 #define PCIE_PORT_DEVICE_MAXSERVICES 5
17 * The PCIe Capability Interrupt Message Number (PCIe r3.1, sec 7.8.2) must
18 * be one of the first 32 MSI-X entries. Per PCI r3.0, sec 6.8.3.1, MSI
19 * supports a maximum of 32 vectors per function.
21 #define PCIE_PORT_MAX_MSI_ENTRIES 32
23 #define get_descriptor_id(type, service) (((type - 4) << 8) | service)
25 extern struct bus_type pcie_port_bus_type
;
26 int pcie_port_device_register(struct pci_dev
*dev
);
28 int pcie_port_device_suspend(struct device
*dev
);
29 int pcie_port_device_resume(struct device
*dev
);
31 void pcie_port_device_remove(struct pci_dev
*dev
);
32 int __must_check
pcie_port_bus_register(void);
33 void pcie_port_bus_unregister(void);
37 void pcie_clear_root_pme_status(struct pci_dev
*dev
);
39 #ifdef CONFIG_HOTPLUG_PCI_PCIE
40 extern bool pciehp_msi_disabled
;
42 static inline bool pciehp_no_msi(void)
44 return pciehp_msi_disabled
;
47 #else /* !CONFIG_HOTPLUG_PCI_PCIE */
48 static inline bool pciehp_no_msi(void) { return false; }
49 #endif /* !CONFIG_HOTPLUG_PCI_PCIE */
51 #ifdef CONFIG_PCIE_PME
52 extern bool pcie_pme_msi_disabled
;
54 static inline void pcie_pme_disable_msi(void)
56 pcie_pme_msi_disabled
= true;
59 static inline bool pcie_pme_no_msi(void)
61 return pcie_pme_msi_disabled
;
64 void pcie_pme_interrupt_enable(struct pci_dev
*dev
, bool enable
);
65 #else /* !CONFIG_PCIE_PME */
66 static inline void pcie_pme_disable_msi(void) {}
67 static inline bool pcie_pme_no_msi(void) { return false; }
68 static inline void pcie_pme_interrupt_enable(struct pci_dev
*dev
, bool en
) {}
69 #endif /* !CONFIG_PCIE_PME */
72 void pcie_port_acpi_setup(struct pci_dev
*port
, int *mask
);
74 static inline void pcie_port_platform_notify(struct pci_dev
*port
, int *mask
)
76 pcie_port_acpi_setup(port
, mask
);
78 #else /* !CONFIG_ACPI */
79 static inline void pcie_port_platform_notify(struct pci_dev
*port
, int *mask
){}
80 #endif /* !CONFIG_ACPI */
82 #endif /* _PORTDRV_H_ */