diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 46 |
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 | ||
68 | static 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 */ |
68 | enum pci_mmap_state { | 74 | enum 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 { | |||
347 | struct pci_dynids { | 354 | struct 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, | |||
509 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 515 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
510 | int busnr); | 516 | int busnr); |
511 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 517 | struct 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); | ||
513 | void pci_destroy_slot(struct pci_slot *slot); | 520 | void pci_destroy_slot(struct pci_slot *slot); |
514 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr); | 521 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr); |
515 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 522 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
516 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 523 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
517 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 524 | void 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 | ||
549 | enum 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 | }; | ||
555 | enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | ||
542 | int pci_find_capability(struct pci_dev *dev, int cap); | 556 | int pci_find_capability(struct pci_dev *dev, int cap); |
543 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 557 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
544 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 558 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
@@ -626,11 +640,15 @@ int pcix_get_mmrbc(struct pci_dev *dev); | |||
626 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); | 640 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); |
627 | int pcie_get_readrq(struct pci_dev *dev); | 641 | int pcie_get_readrq(struct pci_dev *dev); |
628 | int pcie_set_readrq(struct pci_dev *dev, int rq); | 642 | int pcie_set_readrq(struct pci_dev *dev, int rq); |
643 | int pci_reset_function(struct pci_dev *dev); | ||
644 | int pci_execute_reset_function(struct pci_dev *dev); | ||
629 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 645 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
630 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 646 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
631 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 647 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
632 | 648 | ||
633 | /* ROM control related routines */ | 649 | /* ROM control related routines */ |
650 | int pci_enable_rom(struct pci_dev *pdev); | ||
651 | void pci_disable_rom(struct pci_dev *pdev); | ||
634 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 652 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
635 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 653 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
636 | size_t pci_get_rom_size(void __iomem *rom, size_t size); | 654 | size_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); | |||
643 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 661 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
644 | void pci_pme_active(struct pci_dev *dev, bool enable); | 662 | void pci_pme_active(struct pci_dev *dev, bool enable); |
645 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 663 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
664 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | ||
646 | pci_power_t pci_target_state(struct pci_dev *dev); | 665 | pci_power_t pci_target_state(struct pci_dev *dev); |
647 | int pci_prepare_to_sleep(struct pci_dev *dev); | 666 | int pci_prepare_to_sleep(struct pci_dev *dev); |
648 | int pci_back_from_sleep(struct pci_dev *dev); | 667 | int pci_back_from_sleep(struct pci_dev *dev); |
@@ -723,7 +742,7 @@ enum pci_dma_burst_strategy { | |||
723 | }; | 742 | }; |
724 | 743 | ||
725 | struct msix_entry { | 744 | struct 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) { } | |||
1116 | static inline void pci_mmcfg_late_init(void) { } | 1135 | static inline void pci_mmcfg_late_init(void) { } |
1117 | #endif | 1136 | #endif |
1118 | 1137 | ||
1138 | #ifdef CONFIG_HAS_IOMEM | ||
1139 | static 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 */ |