aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h62
1 files changed, 57 insertions, 5 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da05e5db06ac..f68c58a93dd0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -102,6 +102,28 @@ enum {
102 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, 102 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES,
103}; 103};
104 104
105/**
106 * enum pci_interrupt_pin - PCI INTx interrupt values
107 * @PCI_INTERRUPT_UNKNOWN: Unknown or unassigned interrupt
108 * @PCI_INTERRUPT_INTA: PCI INTA pin
109 * @PCI_INTERRUPT_INTB: PCI INTB pin
110 * @PCI_INTERRUPT_INTC: PCI INTC pin
111 * @PCI_INTERRUPT_INTD: PCI INTD pin
112 *
113 * Corresponds to values for legacy PCI INTx interrupts, as can be found in the
114 * PCI_INTERRUPT_PIN register.
115 */
116enum pci_interrupt_pin {
117 PCI_INTERRUPT_UNKNOWN,
118 PCI_INTERRUPT_INTA,
119 PCI_INTERRUPT_INTB,
120 PCI_INTERRUPT_INTC,
121 PCI_INTERRUPT_INTD,
122};
123
124/* The number of legacy PCI INTx interrupts */
125#define PCI_NUM_INTX 4
126
105/* 127/*
106 * pci_power_t values must match the bits in the Capabilities PME_Support 128 * pci_power_t values must match the bits in the Capabilities PME_Support
107 * and Control/Status PowerState fields in the Power Management capability. 129 * and Control/Status PowerState fields in the Power Management capability.
@@ -453,6 +475,7 @@ struct pci_host_bridge {
453 void *release_data; 475 void *release_data;
454 struct msi_controller *msi; 476 struct msi_controller *msi;
455 unsigned int ignore_reset_delay:1; /* for entire hierarchy */ 477 unsigned int ignore_reset_delay:1; /* for entire hierarchy */
478 unsigned int no_ext_tags:1; /* no Extended Tags */
456 /* Resource alignment requirements */ 479 /* Resource alignment requirements */
457 resource_size_t (*align_resource)(struct pci_dev *dev, 480 resource_size_t (*align_resource)(struct pci_dev *dev,
458 const struct resource *res, 481 const struct resource *res,
@@ -847,7 +870,6 @@ char *pcibios_setup(char *str);
847resource_size_t pcibios_align_resource(void *, const struct resource *, 870resource_size_t pcibios_align_resource(void *, const struct resource *,
848 resource_size_t, 871 resource_size_t,
849 resource_size_t); 872 resource_size_t);
850void pcibios_update_irq(struct pci_dev *, int irq);
851 873
852/* Weak but can be overriden by arch */ 874/* Weak but can be overriden by arch */
853void pci_fixup_cardbus(struct pci_bus *); 875void pci_fixup_cardbus(struct pci_bus *);
@@ -1165,8 +1187,6 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
1165void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus); 1187void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus);
1166void pdev_enable_device(struct pci_dev *); 1188void pdev_enable_device(struct pci_dev *);
1167int pci_enable_resources(struct pci_dev *, int mask); 1189int pci_enable_resources(struct pci_dev *, int mask);
1168void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
1169 int (*)(const struct pci_dev *, u8, u8));
1170void pci_assign_irq(struct pci_dev *dev); 1190void pci_assign_irq(struct pci_dev *dev);
1171struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res); 1191struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res);
1172#define HAVE_PCI_REQ_REGIONS 2 1192#define HAVE_PCI_REQ_REGIONS 2
@@ -1399,6 +1419,38 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
1399 NULL); 1419 NULL);
1400} 1420}
1401 1421
1422/**
1423 * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
1424 * @d: the INTx IRQ domain
1425 * @node: the DT node for the device whose interrupt we're translating
1426 * @intspec: the interrupt specifier data from the DT
1427 * @intsize: the number of entries in @intspec
1428 * @out_hwirq: pointer at which to write the hwirq number
1429 * @out_type: pointer at which to write the interrupt type
1430 *
1431 * Translate a PCI INTx interrupt number from device tree in the range 1-4, as
1432 * stored in the standard PCI_INTERRUPT_PIN register, to a value in the range
1433 * 0-3 suitable for use in a 4 entry IRQ domain. That is, subtract one from the
1434 * INTx value to obtain the hwirq number.
1435 *
1436 * Returns 0 on success, or -EINVAL if the interrupt specifier is out of range.
1437 */
1438static inline int pci_irqd_intx_xlate(struct irq_domain *d,
1439 struct device_node *node,
1440 const u32 *intspec,
1441 unsigned int intsize,
1442 unsigned long *out_hwirq,
1443 unsigned int *out_type)
1444{
1445 const u32 intx = intspec[0];
1446
1447 if (intx < PCI_INTERRUPT_INTA || intx > PCI_INTERRUPT_INTD)
1448 return -EINVAL;
1449
1450 *out_hwirq = intx - PCI_INTERRUPT_INTA;
1451 return 0;
1452}
1453
1402#ifdef CONFIG_PCIEPORTBUS 1454#ifdef CONFIG_PCIEPORTBUS
1403extern bool pcie_ports_disabled; 1455extern bool pcie_ports_disabled;
1404extern bool pcie_ports_auto; 1456extern bool pcie_ports_auto;
@@ -2064,7 +2116,7 @@ static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt)
2064 2116
2065/** 2117/**
2066 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length 2118 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
2067 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag 2119 * @srdt: Pointer to the beginning of the Small Resource Data Type tag
2068 * 2120 *
2069 * Returns the extracted Small Resource Data Type length. 2121 * Returns the extracted Small Resource Data Type length.
2070 */ 2122 */
@@ -2075,7 +2127,7 @@ static inline u8 pci_vpd_srdt_size(const u8 *srdt)
2075 2127
2076/** 2128/**
2077 * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item 2129 * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
2078 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag 2130 * @srdt: Pointer to the beginning of the Small Resource Data Type tag
2079 * 2131 *
2080 * Returns the extracted Small Resource Data Type Tag Item. 2132 * Returns the extracted Small Resource Data Type Tag Item.
2081 */ 2133 */