diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index cfc2297c3e28..9194adf82e20 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, |
@@ -124,6 +130,8 @@ enum pci_dev_flags { | |||
124 | * generation too. | 130 | * generation too. |
125 | */ | 131 | */ |
126 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, | 132 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, |
133 | /* Device configuration is irrevocably lost if disabled into D3 */ | ||
134 | PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, | ||
127 | }; | 135 | }; |
128 | 136 | ||
129 | enum pci_irq_reroute_variant { | 137 | enum pci_irq_reroute_variant { |
@@ -218,6 +226,7 @@ struct pci_dev { | |||
218 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ | 226 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ |
219 | unsigned int msi_enabled:1; | 227 | unsigned int msi_enabled:1; |
220 | unsigned int msix_enabled:1; | 228 | unsigned int msix_enabled:1; |
229 | unsigned int ari_enabled:1; /* ARI forwarding */ | ||
221 | unsigned int is_managed:1; | 230 | unsigned int is_managed:1; |
222 | unsigned int is_pcie:1; | 231 | unsigned int is_pcie:1; |
223 | pci_dev_flags_t dev_flags; | 232 | pci_dev_flags_t dev_flags; |
@@ -351,7 +360,6 @@ struct pci_bus_region { | |||
351 | struct pci_dynids { | 360 | struct pci_dynids { |
352 | spinlock_t lock; /* protects list, index */ | 361 | spinlock_t lock; /* protects list, index */ |
353 | struct list_head list; /* for IDs added at runtime */ | 362 | struct list_head list; /* for IDs added at runtime */ |
354 | unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */ | ||
355 | }; | 363 | }; |
356 | 364 | ||
357 | /* ---------------------------------------------------------------- */ | 365 | /* ---------------------------------------------------------------- */ |
@@ -460,8 +468,8 @@ struct pci_driver { | |||
460 | 468 | ||
461 | /** | 469 | /** |
462 | * PCI_VDEVICE - macro used to describe a specific pci device in short form | 470 | * PCI_VDEVICE - macro used to describe a specific pci device in short form |
463 | * @vend: the vendor name | 471 | * @vendor: the vendor name |
464 | * @dev: the 16 bit PCI Device ID | 472 | * @device: the 16 bit PCI Device ID |
465 | * | 473 | * |
466 | * This macro is used to create a struct pci_device_id that matches a | 474 | * This macro is used to create a struct pci_device_id that matches a |
467 | * specific PCI device. The subvendor, and subdevice fields will be set | 475 | * specific PCI device. The subvendor, and subdevice fields will be set |
@@ -513,9 +521,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus, | |||
513 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 521 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
514 | int busnr); | 522 | int busnr); |
515 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 523 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, |
516 | const char *name); | 524 | const char *name, |
525 | struct hotplug_slot *hotplug); | ||
517 | void pci_destroy_slot(struct pci_slot *slot); | 526 | void pci_destroy_slot(struct pci_slot *slot); |
518 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr); | 527 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr); |
519 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 528 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
520 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 529 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
521 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 530 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
@@ -538,11 +547,18 @@ extern void pci_sort_breadthfirst(void); | |||
538 | #ifdef CONFIG_PCI_LEGACY | 547 | #ifdef CONFIG_PCI_LEGACY |
539 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, | 548 | struct pci_dev __deprecated *pci_find_device(unsigned int vendor, |
540 | unsigned int device, | 549 | unsigned int device, |
541 | const struct pci_dev *from); | 550 | struct pci_dev *from); |
542 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, | 551 | struct pci_dev __deprecated *pci_find_slot(unsigned int bus, |
543 | unsigned int devfn); | 552 | unsigned int devfn); |
544 | #endif /* CONFIG_PCI_LEGACY */ | 553 | #endif /* CONFIG_PCI_LEGACY */ |
545 | 554 | ||
555 | enum pci_lost_interrupt_reason { | ||
556 | PCI_LOST_IRQ_NO_INFORMATION = 0, | ||
557 | PCI_LOST_IRQ_DISABLE_MSI, | ||
558 | PCI_LOST_IRQ_DISABLE_MSIX, | ||
559 | PCI_LOST_IRQ_DISABLE_ACPI, | ||
560 | }; | ||
561 | enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | ||
546 | int pci_find_capability(struct pci_dev *dev, int cap); | 562 | int pci_find_capability(struct pci_dev *dev, int cap); |
547 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 563 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
548 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 564 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
@@ -554,7 +570,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | |||
554 | struct pci_dev *from); | 570 | struct pci_dev *from); |
555 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | 571 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
556 | unsigned int ss_vendor, unsigned int ss_device, | 572 | unsigned int ss_vendor, unsigned int ss_device, |
557 | const struct pci_dev *from); | 573 | struct pci_dev *from); |
558 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 574 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
559 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); | 575 | struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); |
560 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); | 576 | struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); |
@@ -630,11 +646,15 @@ int pcix_get_mmrbc(struct pci_dev *dev); | |||
630 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); | 646 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); |
631 | int pcie_get_readrq(struct pci_dev *dev); | 647 | int pcie_get_readrq(struct pci_dev *dev); |
632 | int pcie_set_readrq(struct pci_dev *dev, int rq); | 648 | int pcie_set_readrq(struct pci_dev *dev, int rq); |
649 | int pci_reset_function(struct pci_dev *dev); | ||
650 | int pci_execute_reset_function(struct pci_dev *dev); | ||
633 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 651 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
634 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 652 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
635 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 653 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
636 | 654 | ||
637 | /* ROM control related routines */ | 655 | /* ROM control related routines */ |
656 | int pci_enable_rom(struct pci_dev *pdev); | ||
657 | void pci_disable_rom(struct pci_dev *pdev); | ||
638 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 658 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
639 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 659 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
640 | size_t pci_get_rom_size(void __iomem *rom, size_t size); | 660 | size_t pci_get_rom_size(void __iomem *rom, size_t size); |
@@ -644,7 +664,11 @@ int pci_save_state(struct pci_dev *dev); | |||
644 | int pci_restore_state(struct pci_dev *dev); | 664 | int pci_restore_state(struct pci_dev *dev); |
645 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 665 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
646 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 666 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
667 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | ||
668 | void pci_pme_active(struct pci_dev *dev, bool enable); | ||
647 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 669 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
670 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | ||
671 | pci_power_t pci_target_state(struct pci_dev *dev); | ||
648 | int pci_prepare_to_sleep(struct pci_dev *dev); | 672 | int pci_prepare_to_sleep(struct pci_dev *dev); |
649 | int pci_back_from_sleep(struct pci_dev *dev); | 673 | int pci_back_from_sleep(struct pci_dev *dev); |
650 | 674 | ||
@@ -682,10 +706,12 @@ void pci_enable_bridges(struct pci_bus *bus); | |||
682 | /* Proper probing supporting hot-pluggable devices */ | 706 | /* Proper probing supporting hot-pluggable devices */ |
683 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, | 707 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
684 | const char *mod_name); | 708 | const char *mod_name); |
685 | static inline int __must_check pci_register_driver(struct pci_driver *driver) | 709 | |
686 | { | 710 | /* |
687 | return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | 711 | * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded |
688 | } | 712 | */ |
713 | #define pci_register_driver(driver) \ | ||
714 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | ||
689 | 715 | ||
690 | void pci_unregister_driver(struct pci_driver *dev); | 716 | void pci_unregister_driver(struct pci_driver *dev); |
691 | void pci_remove_behind_bridge(struct pci_dev *dev); | 717 | void pci_remove_behind_bridge(struct pci_dev *dev); |
@@ -722,7 +748,7 @@ enum pci_dma_burst_strategy { | |||
722 | }; | 748 | }; |
723 | 749 | ||
724 | struct msix_entry { | 750 | struct msix_entry { |
725 | u16 vector; /* kernel uses to write allocated vector */ | 751 | u32 vector; /* kernel uses to write allocated vector */ |
726 | u16 entry; /* driver uses to specify entry, OS writes */ | 752 | u16 entry; /* driver uses to specify entry, OS writes */ |
727 | }; | 753 | }; |
728 | 754 | ||
@@ -815,7 +841,7 @@ _PCI_NOP_ALL(write,) | |||
815 | 841 | ||
816 | static inline struct pci_dev *pci_find_device(unsigned int vendor, | 842 | static inline struct pci_dev *pci_find_device(unsigned int vendor, |
817 | unsigned int device, | 843 | unsigned int device, |
818 | const struct pci_dev *from) | 844 | struct pci_dev *from) |
819 | { | 845 | { |
820 | return NULL; | 846 | return NULL; |
821 | } | 847 | } |
@@ -837,7 +863,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor, | |||
837 | unsigned int device, | 863 | unsigned int device, |
838 | unsigned int ss_vendor, | 864 | unsigned int ss_vendor, |
839 | unsigned int ss_device, | 865 | unsigned int ss_device, |
840 | const struct pci_dev *from) | 866 | struct pci_dev *from) |
841 | { | 867 | { |
842 | return NULL; | 868 | return NULL; |
843 | } | 869 | } |
@@ -1115,5 +1141,20 @@ static inline void pci_mmcfg_early_init(void) { } | |||
1115 | static inline void pci_mmcfg_late_init(void) { } | 1141 | static inline void pci_mmcfg_late_init(void) { } |
1116 | #endif | 1142 | #endif |
1117 | 1143 | ||
1144 | #ifdef CONFIG_HAS_IOMEM | ||
1145 | static inline void * pci_ioremap_bar(struct pci_dev *pdev, int bar) | ||
1146 | { | ||
1147 | /* | ||
1148 | * Make sure the BAR is actually a memory resource, not an IO resource | ||
1149 | */ | ||
1150 | if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { | ||
1151 | WARN_ON(1); | ||
1152 | return NULL; | ||
1153 | } | ||
1154 | return ioremap_nocache(pci_resource_start(pdev, bar), | ||
1155 | pci_resource_len(pdev, bar)); | ||
1156 | } | ||
1157 | #endif | ||
1158 | |||
1118 | #endif /* __KERNEL__ */ | 1159 | #endif /* __KERNEL__ */ |
1119 | #endif /* LINUX_PCI_H */ | 1160 | #endif /* LINUX_PCI_H */ |