diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 01c707261f9c..9e3042e7e1cc 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -20,9 +20,6 @@ | |||
20 | /* Include the pci register defines */ | 20 | /* Include the pci register defines */ |
21 | #include <linux/pci_regs.h> | 21 | #include <linux/pci_regs.h> |
22 | 22 | ||
23 | /* Include the ID list */ | ||
24 | #include <linux/pci_ids.h> | ||
25 | |||
26 | /* | 23 | /* |
27 | * The PCI interface treats multi-function devices as independent | 24 | * The PCI interface treats multi-function devices as independent |
28 | * devices. The slot/function address of each device is encoded | 25 | * devices. The slot/function address of each device is encoded |
@@ -54,6 +51,9 @@ | |||
54 | #include <asm/atomic.h> | 51 | #include <asm/atomic.h> |
55 | #include <linux/device.h> | 52 | #include <linux/device.h> |
56 | 53 | ||
54 | /* Include the ID list */ | ||
55 | #include <linux/pci_ids.h> | ||
56 | |||
57 | /* File state for mmap()s on /proc/bus/pci/X/Y */ | 57 | /* File state for mmap()s on /proc/bus/pci/X/Y */ |
58 | enum pci_mmap_state { | 58 | enum pci_mmap_state { |
59 | pci_mmap_io, | 59 | pci_mmap_io, |
@@ -167,6 +167,7 @@ struct pci_dev { | |||
167 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | 167 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ |
168 | unsigned int msi_enabled:1; | 168 | unsigned int msi_enabled:1; |
169 | unsigned int msix_enabled:1; | 169 | unsigned int msix_enabled:1; |
170 | unsigned int is_managed:1; | ||
170 | atomic_t enable_cnt; /* pci_enable_device has been called */ | 171 | atomic_t enable_cnt; /* pci_enable_device has been called */ |
171 | 172 | ||
172 | u32 saved_config_space[16]; /* config space saved at suspend time */ | 173 | u32 saved_config_space[16]; /* config space saved at suspend time */ |
@@ -174,6 +175,9 @@ struct pci_dev { | |||
174 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ | 175 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ |
175 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ | 176 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ |
176 | struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ | 177 | struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ |
178 | #ifdef CONFIG_PCI_MSI | ||
179 | unsigned int first_msi_irq; | ||
180 | #endif | ||
177 | }; | 181 | }; |
178 | 182 | ||
179 | #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) | 183 | #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) |
@@ -181,6 +185,11 @@ struct pci_dev { | |||
181 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) | 185 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
182 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) | 186 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) |
183 | 187 | ||
188 | static inline int pci_channel_offline(struct pci_dev *pdev) | ||
189 | { | ||
190 | return (pdev->error_state != pci_channel_io_normal); | ||
191 | } | ||
192 | |||
184 | static inline struct pci_cap_saved_state *pci_find_saved_cap( | 193 | static inline struct pci_cap_saved_state *pci_find_saved_cap( |
185 | struct pci_dev *pci_dev,char cap) | 194 | struct pci_dev *pci_dev,char cap) |
186 | { | 195 | { |
@@ -396,6 +405,21 @@ struct pci_driver { | |||
396 | */ | 405 | */ |
397 | #define pci_module_init pci_register_driver | 406 | #define pci_module_init pci_register_driver |
398 | 407 | ||
408 | /** | ||
409 | * PCI_VDEVICE - macro used to describe a specific pci device in short form | ||
410 | * @vend: the vendor name | ||
411 | * @dev: the 16 bit PCI Device ID | ||
412 | * | ||
413 | * This macro is used to create a struct pci_device_id that matches a | ||
414 | * specific PCI device. The subvendor, and subdevice fields will be set | ||
415 | * to PCI_ANY_ID. The macro allows the next field to follow as the device | ||
416 | * private data. | ||
417 | */ | ||
418 | |||
419 | #define PCI_VDEVICE(vendor, device) \ | ||
420 | PCI_VENDOR_ID_##vendor, (device), \ | ||
421 | PCI_ANY_ID, PCI_ANY_ID, 0, 0 | ||
422 | |||
399 | /* these external functions are only available when PCI support is enabled */ | 423 | /* these external functions are only available when PCI support is enabled */ |
400 | #ifdef CONFIG_PCI | 424 | #ifdef CONFIG_PCI |
401 | 425 | ||
@@ -448,12 +472,13 @@ extern void pci_sort_breadthfirst(void); | |||
448 | 472 | ||
449 | /* Generic PCI functions exported to card drivers */ | 473 | /* Generic PCI functions exported to card drivers */ |
450 | 474 | ||
451 | struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); | 475 | struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); |
452 | struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int device, const struct pci_dev *from); | ||
453 | struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); | 476 | struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); |
454 | int pci_find_capability (struct pci_dev *dev, int cap); | 477 | int pci_find_capability (struct pci_dev *dev, int cap); |
455 | int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); | 478 | int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); |
456 | int pci_find_ext_capability (struct pci_dev *dev, int cap); | 479 | int pci_find_ext_capability (struct pci_dev *dev, int cap); |
480 | int pci_find_ht_capability (struct pci_dev *dev, int ht_cap); | ||
481 | int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap); | ||
457 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 482 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
458 | 483 | ||
459 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | 484 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
@@ -468,6 +493,7 @@ struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); | |||
468 | struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); | 493 | struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); |
469 | struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); | 494 | struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); |
470 | int pci_dev_present(const struct pci_device_id *ids); | 495 | int pci_dev_present(const struct pci_device_id *ids); |
496 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); | ||
471 | 497 | ||
472 | int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); | 498 | int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); |
473 | int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); | 499 | int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); |
@@ -503,6 +529,14 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val | |||
503 | 529 | ||
504 | int __must_check pci_enable_device(struct pci_dev *dev); | 530 | int __must_check pci_enable_device(struct pci_dev *dev); |
505 | int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); | 531 | int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); |
532 | int __must_check pcim_enable_device(struct pci_dev *pdev); | ||
533 | void pcim_pin_device(struct pci_dev *pdev); | ||
534 | |||
535 | static inline int pci_is_managed(struct pci_dev *pdev) | ||
536 | { | ||
537 | return pdev->is_managed; | ||
538 | } | ||
539 | |||
506 | void pci_disable_device(struct pci_dev *dev); | 540 | void pci_disable_device(struct pci_dev *dev); |
507 | void pci_set_master(struct pci_dev *dev); | 541 | void pci_set_master(struct pci_dev *dev); |
508 | #define HAVE_PCI_SET_MWI | 542 | #define HAVE_PCI_SET_MWI |
@@ -515,6 +549,7 @@ void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | |||
515 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 549 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
516 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); | 550 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); |
517 | void pci_restore_bars(struct pci_dev *dev); | 551 | void pci_restore_bars(struct pci_dev *dev); |
552 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | ||
518 | 553 | ||
519 | /* ROM control related routines */ | 554 | /* ROM control related routines */ |
520 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 555 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
@@ -543,6 +578,8 @@ int __must_check pci_request_regions(struct pci_dev *, const char *); | |||
543 | void pci_release_regions(struct pci_dev *); | 578 | void pci_release_regions(struct pci_dev *); |
544 | int __must_check pci_request_region(struct pci_dev *, int, const char *); | 579 | int __must_check pci_request_region(struct pci_dev *, int, const char *); |
545 | void pci_release_region(struct pci_dev *, int); | 580 | void pci_release_region(struct pci_dev *, int); |
581 | int pci_request_selected_regions(struct pci_dev *, int, const char *); | ||
582 | void pci_release_selected_regions(struct pci_dev *, int); | ||
546 | 583 | ||
547 | /* drivers/pci/bus.c */ | 584 | /* drivers/pci/bus.c */ |
548 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, | 585 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, |
@@ -555,10 +592,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus, | |||
555 | void pci_enable_bridges(struct pci_bus *bus); | 592 | void pci_enable_bridges(struct pci_bus *bus); |
556 | 593 | ||
557 | /* Proper probing supporting hot-pluggable devices */ | 594 | /* Proper probing supporting hot-pluggable devices */ |
558 | int __must_check __pci_register_driver(struct pci_driver *, struct module *); | 595 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
596 | const char *mod_name); | ||
559 | static inline int __must_check pci_register_driver(struct pci_driver *driver) | 597 | static inline int __must_check pci_register_driver(struct pci_driver *driver) |
560 | { | 598 | { |
561 | return __pci_register_driver(driver, THIS_MODULE); | 599 | return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); |
562 | } | 600 | } |
563 | 601 | ||
564 | void pci_unregister_driver(struct pci_driver *); | 602 | void pci_unregister_driver(struct pci_driver *); |
@@ -593,10 +631,6 @@ enum pci_dma_burst_strategy { | |||
593 | strategy_parameter byte boundaries */ | 631 | strategy_parameter byte boundaries */ |
594 | }; | 632 | }; |
595 | 633 | ||
596 | #if defined(CONFIG_ISA) || defined(CONFIG_EISA) | ||
597 | extern struct pci_dev *isa_bridge; | ||
598 | #endif | ||
599 | |||
600 | struct msix_entry { | 634 | struct msix_entry { |
601 | u16 vector; /* kernel uses to write allocated vector */ | 635 | u16 vector; /* kernel uses to write allocated vector */ |
602 | u16 entry; /* driver uses to specify entry, OS writes */ | 636 | u16 entry; /* driver uses to specify entry, OS writes */ |
@@ -604,7 +638,6 @@ struct msix_entry { | |||
604 | 638 | ||
605 | 639 | ||
606 | #ifndef CONFIG_PCI_MSI | 640 | #ifndef CONFIG_PCI_MSI |
607 | static inline void pci_scan_msi_device(struct pci_dev *dev) {} | ||
608 | static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} | 641 | static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} |
609 | static inline void pci_disable_msi(struct pci_dev *dev) {} | 642 | static inline void pci_disable_msi(struct pci_dev *dev) {} |
610 | static inline int pci_enable_msix(struct pci_dev* dev, | 643 | static inline int pci_enable_msix(struct pci_dev* dev, |
@@ -612,7 +645,6 @@ static inline int pci_enable_msix(struct pci_dev* dev, | |||
612 | static inline void pci_disable_msix(struct pci_dev *dev) {} | 645 | static inline void pci_disable_msix(struct pci_dev *dev) {} |
613 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} | 646 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} |
614 | #else | 647 | #else |
615 | extern void pci_scan_msi_device(struct pci_dev *dev); | ||
616 | extern int pci_enable_msi(struct pci_dev *dev); | 648 | extern int pci_enable_msi(struct pci_dev *dev); |
617 | extern void pci_disable_msi(struct pci_dev *dev); | 649 | extern void pci_disable_msi(struct pci_dev *dev); |
618 | extern int pci_enable_msix(struct pci_dev* dev, | 650 | extern int pci_enable_msix(struct pci_dev* dev, |
@@ -681,6 +713,7 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev * | |||
681 | { return NULL; } | 713 | { return NULL; } |
682 | 714 | ||
683 | #define pci_dev_present(ids) (0) | 715 | #define pci_dev_present(ids) (0) |
716 | #define pci_find_present(ids) (NULL) | ||
684 | #define pci_dev_put(dev) do { } while (0) | 717 | #define pci_dev_put(dev) do { } while (0) |
685 | 718 | ||
686 | static inline void pci_set_master(struct pci_dev *dev) { } | 719 | static inline void pci_set_master(struct pci_dev *dev) { } |
@@ -703,8 +736,6 @@ static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { | |||
703 | static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } | 736 | static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } |
704 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } | 737 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } |
705 | 738 | ||
706 | #define isa_bridge ((struct pci_dev *)NULL) | ||
707 | |||
708 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | 739 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) |
709 | 740 | ||
710 | static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } | 741 | static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } |
@@ -783,6 +814,7 @@ enum pci_fixup_pass { | |||
783 | pci_fixup_header, /* After reading configuration header */ | 814 | pci_fixup_header, /* After reading configuration header */ |
784 | pci_fixup_final, /* Final phase of device fixups */ | 815 | pci_fixup_final, /* Final phase of device fixups */ |
785 | pci_fixup_enable, /* pci_enable_device() time */ | 816 | pci_fixup_enable, /* pci_enable_device() time */ |
817 | pci_fixup_resume, /* pci_enable_device() time */ | ||
786 | }; | 818 | }; |
787 | 819 | ||
788 | /* Anonymous variables would be nice... */ | 820 | /* Anonymous variables would be nice... */ |
@@ -801,6 +833,9 @@ enum pci_fixup_pass { | |||
801 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ | 833 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ |
802 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | 834 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ |
803 | vendor##device##hook, vendor, device, hook) | 835 | vendor##device##hook, vendor, device, hook) |
836 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ | ||
837 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | ||
838 | resume##vendor##device##hook, vendor, device, hook) | ||
804 | 839 | ||
805 | 840 | ||
806 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 841 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |