aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-28 11:26:12 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-28 11:26:12 -0400
commit7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch)
treee730a4565e0318140d2fbd2f0415d18a339d7336 /include/linux/pci.h
parent41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff)
parent0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff)
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h69
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
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,
@@ -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
129enum pci_irq_reroute_variant { 137enum 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 {
351struct pci_dynids { 360struct 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,
513struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 521struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
514 int busnr); 522 int busnr);
515struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 523struct 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);
517void pci_destroy_slot(struct pci_slot *slot); 526void pci_destroy_slot(struct pci_slot *slot);
518void pci_update_slot_number(struct pci_slot *slot, int slot_nr); 527void pci_renumber_slot(struct pci_slot *slot, int slot_nr);
519int pci_scan_slot(struct pci_bus *bus, int devfn); 528int pci_scan_slot(struct pci_bus *bus, int devfn);
520struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 529struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
521void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 530void 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
539struct pci_dev __deprecated *pci_find_device(unsigned int vendor, 548struct 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);
542struct pci_dev __deprecated *pci_find_slot(unsigned int bus, 551struct 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
555enum 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};
561enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
546int pci_find_capability(struct pci_dev *dev, int cap); 562int pci_find_capability(struct pci_dev *dev, int cap);
547int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 563int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
548int pci_find_ext_capability(struct pci_dev *dev, int cap); 564int 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);
555struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 571struct 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);
558struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 574struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
559struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 575struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
560struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 576struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
@@ -630,11 +646,15 @@ int pcix_get_mmrbc(struct pci_dev *dev);
630int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 646int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
631int pcie_get_readrq(struct pci_dev *dev); 647int pcie_get_readrq(struct pci_dev *dev);
632int pcie_set_readrq(struct pci_dev *dev, int rq); 648int pcie_set_readrq(struct pci_dev *dev, int rq);
649int pci_reset_function(struct pci_dev *dev);
650int pci_execute_reset_function(struct pci_dev *dev);
633void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 651void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
634int __must_check pci_assign_resource(struct pci_dev *dev, int i); 652int __must_check pci_assign_resource(struct pci_dev *dev, int i);
635int pci_select_bars(struct pci_dev *dev, unsigned long flags); 653int pci_select_bars(struct pci_dev *dev, unsigned long flags);
636 654
637/* ROM control related routines */ 655/* ROM control related routines */
656int pci_enable_rom(struct pci_dev *pdev);
657void pci_disable_rom(struct pci_dev *pdev);
638void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 658void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
639void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 659void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
640size_t pci_get_rom_size(void __iomem *rom, size_t size); 660size_t pci_get_rom_size(void __iomem *rom, size_t size);
@@ -644,7 +664,11 @@ int pci_save_state(struct pci_dev *dev);
644int pci_restore_state(struct pci_dev *dev); 664int pci_restore_state(struct pci_dev *dev);
645int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 665int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
646pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 666pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
667bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
668void pci_pme_active(struct pci_dev *dev, bool enable);
647int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 669int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
670int pci_wake_from_d3(struct pci_dev *dev, bool enable);
671pci_power_t pci_target_state(struct pci_dev *dev);
648int pci_prepare_to_sleep(struct pci_dev *dev); 672int pci_prepare_to_sleep(struct pci_dev *dev);
649int pci_back_from_sleep(struct pci_dev *dev); 673int 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 */
683int __must_check __pci_register_driver(struct pci_driver *, struct module *, 707int __must_check __pci_register_driver(struct pci_driver *, struct module *,
684 const char *mod_name); 708 const char *mod_name);
685static 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
690void pci_unregister_driver(struct pci_driver *dev); 716void pci_unregister_driver(struct pci_driver *dev);
691void pci_remove_behind_bridge(struct pci_dev *dev); 717void pci_remove_behind_bridge(struct pci_dev *dev);
@@ -722,7 +748,7 @@ enum pci_dma_burst_strategy {
722}; 748};
723 749
724struct msix_entry { 750struct 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
816static inline struct pci_dev *pci_find_device(unsigned int vendor, 842static 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) { }
1115static inline void pci_mmcfg_late_init(void) { } 1141static inline void pci_mmcfg_late_init(void) { }
1116#endif 1142#endif
1117 1143
1144#ifdef CONFIG_HAS_IOMEM
1145static 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 */