Merge branch 'for-4.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
[linux-2.6-block.git] / drivers / pci / pcie / portdrv.h
1 /*
2  * File:        portdrv.h
3  * Purpose:     PCI Express Port Bus Driver's Internal Data Structures
4  *
5  * Copyright (C) 2004 Intel
6  * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
7  */
8
9 #ifndef _PORTDRV_H_
10 #define _PORTDRV_H_
11
12 #include <linux/compiler.h>
13
14 #define PCIE_PORT_DEVICE_MAXSERVICES   5
15 /*
16  * The PCIe Capability Interrupt Message Number (PCIe r3.1, sec 7.8.2) must
17  * be one of the first 32 MSI-X entries.  Per PCI r3.0, sec 6.8.3.1, MSI
18  * supports a maximum of 32 vectors per function.
19  */
20 #define PCIE_PORT_MAX_MSI_ENTRIES       32
21
22 #define get_descriptor_id(type, service) (((type - 4) << 8) | service)
23
24 extern struct bus_type pcie_port_bus_type;
25 int pcie_port_device_register(struct pci_dev *dev);
26 #ifdef CONFIG_PM
27 int pcie_port_device_suspend(struct device *dev);
28 int pcie_port_device_resume(struct device *dev);
29 #endif
30 void pcie_port_device_remove(struct pci_dev *dev);
31 int __must_check pcie_port_bus_register(void);
32 void pcie_port_bus_unregister(void);
33
34 struct pci_dev;
35
36 void pcie_clear_root_pme_status(struct pci_dev *dev);
37
38 #ifdef CONFIG_HOTPLUG_PCI_PCIE
39 extern bool pciehp_msi_disabled;
40
41 static inline bool pciehp_no_msi(void)
42 {
43         return pciehp_msi_disabled;
44 }
45
46 #else  /* !CONFIG_HOTPLUG_PCI_PCIE */
47 static inline bool pciehp_no_msi(void) { return false; }
48 #endif /* !CONFIG_HOTPLUG_PCI_PCIE */
49
50 #ifdef CONFIG_PCIE_PME
51 extern bool pcie_pme_msi_disabled;
52
53 static inline void pcie_pme_disable_msi(void)
54 {
55         pcie_pme_msi_disabled = true;
56 }
57
58 static inline bool pcie_pme_no_msi(void)
59 {
60         return pcie_pme_msi_disabled;
61 }
62
63 void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable);
64 #else /* !CONFIG_PCIE_PME */
65 static inline void pcie_pme_disable_msi(void) {}
66 static inline bool pcie_pme_no_msi(void) { return false; }
67 static inline void pcie_pme_interrupt_enable(struct pci_dev *dev, bool en) {}
68 #endif /* !CONFIG_PCIE_PME */
69
70 #ifdef CONFIG_ACPI
71 void pcie_port_acpi_setup(struct pci_dev *port, int *mask);
72
73 static inline void pcie_port_platform_notify(struct pci_dev *port, int *mask)
74 {
75         pcie_port_acpi_setup(port, mask);
76 }
77 #else /* !CONFIG_ACPI */
78 static inline void pcie_port_platform_notify(struct pci_dev *port, int *mask){}
79 #endif /* !CONFIG_ACPI */
80
81 #endif /* _PORTDRV_H_ */