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.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 98dc6243a706..c75b82bda327 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -51,6 +51,7 @@
51#include <linux/kobject.h> 51#include <linux/kobject.h>
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h>
54 55
55/* Include the ID list */ 56/* Include the ID list */
56#include <linux/pci_ids.h> 57#include <linux/pci_ids.h>
@@ -64,6 +65,11 @@ struct pci_slot {
64 struct kobject kobj; 65 struct kobject kobj;
65}; 66};
66 67
68static inline const char *pci_slot_name(const struct pci_slot *slot)
69{
70 return kobject_name(&slot->kobj);
71}
72
67/* File state for mmap()s on /proc/bus/pci/X/Y */ 73/* File state for mmap()s on /proc/bus/pci/X/Y */
68enum pci_mmap_state { 74enum pci_mmap_state {
69 pci_mmap_io, 75 pci_mmap_io,
@@ -214,6 +220,7 @@ struct pci_dev {
214 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 220 unsigned int broken_parity_status:1; /* Device generates false positive parity */
215 unsigned int msi_enabled:1; 221 unsigned int msi_enabled:1;
216 unsigned int msix_enabled:1; 222 unsigned int msix_enabled:1;
223 unsigned int ari_enabled:1; /* ARI forwarding */
217 unsigned int is_managed:1; 224 unsigned int is_managed:1;
218 unsigned int is_pcie:1; 225 unsigned int is_pcie:1;
219 pci_dev_flags_t dev_flags; 226 pci_dev_flags_t dev_flags;
@@ -347,7 +354,6 @@ struct pci_bus_region {
347struct pci_dynids { 354struct pci_dynids {
348 spinlock_t lock; /* protects list, index */ 355 spinlock_t lock; /* protects list, index */
349 struct list_head list; /* for IDs added at runtime */ 356 struct list_head list; /* for IDs added at runtime */
350 unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */
351}; 357};
352 358
353/* ---------------------------------------------------------------- */ 359/* ---------------------------------------------------------------- */
@@ -456,8 +462,8 @@ struct pci_driver {
456 462
457/** 463/**
458 * PCI_VDEVICE - macro used to describe a specific pci device in short form 464 * PCI_VDEVICE - macro used to describe a specific pci device in short form
459 * @vend: the vendor name 465 * @vendor: the vendor name
460 * @dev: the 16 bit PCI Device ID 466 * @device: the 16 bit PCI Device ID
461 * 467 *
462 * This macro is used to create a struct pci_device_id that matches a 468 * This macro is used to create a struct pci_device_id that matches a
463 * specific PCI device. The subvendor, and subdevice fields will be set 469 * specific PCI device. The subvendor, and subdevice fields will be set
@@ -509,9 +515,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
509struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 515struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
510 int busnr); 516 int busnr);
511struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 517struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
512 const char *name); 518 const char *name,
519 struct hotplug_slot *hotplug);
513void pci_destroy_slot(struct pci_slot *slot); 520void pci_destroy_slot(struct pci_slot *slot);
514void pci_update_slot_number(struct pci_slot *slot, int slot_nr); 521void pci_renumber_slot(struct pci_slot *slot, int slot_nr);
515int pci_scan_slot(struct pci_bus *bus, int devfn); 522int pci_scan_slot(struct pci_bus *bus, int devfn);
516struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 523struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
517void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 524void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
@@ -539,6 +546,13 @@ struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
539 unsigned int devfn); 546 unsigned int devfn);
540#endif /* CONFIG_PCI_LEGACY */ 547#endif /* CONFIG_PCI_LEGACY */
541 548
549enum pci_lost_interrupt_reason {
550 PCI_LOST_IRQ_NO_INFORMATION = 0,
551 PCI_LOST_IRQ_DISABLE_MSI,
552 PCI_LOST_IRQ_DISABLE_MSIX,
553 PCI_LOST_IRQ_DISABLE_ACPI,
554};
555enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
542int pci_find_capability(struct pci_dev *dev, int cap); 556int pci_find_capability(struct pci_dev *dev, int cap);
543int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 557int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
544int pci_find_ext_capability(struct pci_dev *dev, int cap); 558int pci_find_ext_capability(struct pci_dev *dev, int cap);
@@ -626,11 +640,15 @@ int pcix_get_mmrbc(struct pci_dev *dev);
626int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 640int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
627int pcie_get_readrq(struct pci_dev *dev); 641int pcie_get_readrq(struct pci_dev *dev);
628int pcie_set_readrq(struct pci_dev *dev, int rq); 642int pcie_set_readrq(struct pci_dev *dev, int rq);
643int pci_reset_function(struct pci_dev *dev);
644int pci_execute_reset_function(struct pci_dev *dev);
629void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 645void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
630int __must_check pci_assign_resource(struct pci_dev *dev, int i); 646int __must_check pci_assign_resource(struct pci_dev *dev, int i);
631int pci_select_bars(struct pci_dev *dev, unsigned long flags); 647int pci_select_bars(struct pci_dev *dev, unsigned long flags);
632 648
633/* ROM control related routines */ 649/* ROM control related routines */
650int pci_enable_rom(struct pci_dev *pdev);
651void pci_disable_rom(struct pci_dev *pdev);
634void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 652void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
635void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 653void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
636size_t pci_get_rom_size(void __iomem *rom, size_t size); 654size_t pci_get_rom_size(void __iomem *rom, size_t size);
@@ -643,6 +661,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
643bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 661bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
644void pci_pme_active(struct pci_dev *dev, bool enable); 662void pci_pme_active(struct pci_dev *dev, bool enable);
645int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 663int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
664int pci_wake_from_d3(struct pci_dev *dev, bool enable);
646pci_power_t pci_target_state(struct pci_dev *dev); 665pci_power_t pci_target_state(struct pci_dev *dev);
647int pci_prepare_to_sleep(struct pci_dev *dev); 666int pci_prepare_to_sleep(struct pci_dev *dev);
648int pci_back_from_sleep(struct pci_dev *dev); 667int pci_back_from_sleep(struct pci_dev *dev);
@@ -723,7 +742,7 @@ enum pci_dma_burst_strategy {
723}; 742};
724 743
725struct msix_entry { 744struct msix_entry {
726 u16 vector; /* kernel uses to write allocated vector */ 745 u32 vector; /* kernel uses to write allocated vector */
727 u16 entry; /* driver uses to specify entry, OS writes */ 746 u16 entry; /* driver uses to specify entry, OS writes */
728}; 747};
729 748
@@ -1116,5 +1135,20 @@ static inline void pci_mmcfg_early_init(void) { }
1116static inline void pci_mmcfg_late_init(void) { } 1135static inline void pci_mmcfg_late_init(void) { }
1117#endif 1136#endif
1118 1137
1138#ifdef CONFIG_HAS_IOMEM
1139static inline void * pci_ioremap_bar(struct pci_dev *pdev, int bar)
1140{
1141 /*
1142 * Make sure the BAR is actually a memory resource, not an IO resource
1143 */
1144 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1145 WARN_ON(1);
1146 return NULL;
1147 }
1148 return ioremap_nocache(pci_resource_start(pdev, bar),
1149 pci_resource_len(pdev, bar));
1150}
1151#endif
1152
1119#endif /* __KERNEL__ */ 1153#endif /* __KERNEL__ */
1120#endif /* LINUX_PCI_H */ 1154#endif /* LINUX_PCI_H */