diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 40a039f1dffb..c739df91bac9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -369,6 +369,8 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
369 | return (pdev->error_state != pci_channel_io_normal); | 369 | return (pdev->error_state != pci_channel_io_normal); |
370 | } | 370 | } |
371 | 371 | ||
372 | extern struct resource busn_resource; | ||
373 | |||
372 | struct pci_host_bridge_window { | 374 | struct pci_host_bridge_window { |
373 | struct list_head list; | 375 | struct list_head list; |
374 | struct resource *res; /* host bridge aperture (CPU address) */ | 376 | struct resource *res; /* host bridge aperture (CPU address) */ |
@@ -420,6 +422,7 @@ struct pci_bus { | |||
420 | struct list_head slots; /* list of slots on this bus */ | 422 | struct list_head slots; /* list of slots on this bus */ |
421 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; | 423 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; |
422 | struct list_head resources; /* address space routed to this bus */ | 424 | struct list_head resources; /* address space routed to this bus */ |
425 | struct resource busn_res; /* bus numbers routed to this bus */ | ||
423 | 426 | ||
424 | struct pci_ops *ops; /* configuration access functions */ | 427 | struct pci_ops *ops; /* configuration access functions */ |
425 | void *sysdata; /* hook for sys-specific extension */ | 428 | void *sysdata; /* hook for sys-specific extension */ |
@@ -427,8 +430,6 @@ struct pci_bus { | |||
427 | 430 | ||
428 | unsigned char number; /* bus number */ | 431 | unsigned char number; /* bus number */ |
429 | unsigned char primary; /* number of primary bridge */ | 432 | unsigned char primary; /* number of primary bridge */ |
430 | unsigned char secondary; /* number of secondary bridge */ | ||
431 | unsigned char subordinate; /* max number of subordinate buses */ | ||
432 | unsigned char max_bus_speed; /* enum pci_bus_speed */ | 433 | unsigned char max_bus_speed; /* enum pci_bus_speed */ |
433 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ | 434 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ |
434 | 435 | ||
@@ -475,6 +476,32 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; | |||
475 | #define PCIBIOS_SET_FAILED 0x88 | 476 | #define PCIBIOS_SET_FAILED 0x88 |
476 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 | 477 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 |
477 | 478 | ||
479 | /* | ||
480 | * Translate above to generic errno for passing back through non-pci. | ||
481 | */ | ||
482 | static inline int pcibios_err_to_errno(int err) | ||
483 | { | ||
484 | if (err <= PCIBIOS_SUCCESSFUL) | ||
485 | return err; /* Assume already errno */ | ||
486 | |||
487 | switch (err) { | ||
488 | case PCIBIOS_FUNC_NOT_SUPPORTED: | ||
489 | return -ENOENT; | ||
490 | case PCIBIOS_BAD_VENDOR_ID: | ||
491 | return -EINVAL; | ||
492 | case PCIBIOS_DEVICE_NOT_FOUND: | ||
493 | return -ENODEV; | ||
494 | case PCIBIOS_BAD_REGISTER_NUMBER: | ||
495 | return -EFAULT; | ||
496 | case PCIBIOS_SET_FAILED: | ||
497 | return -EIO; | ||
498 | case PCIBIOS_BUFFER_TOO_SMALL: | ||
499 | return -ENOSPC; | ||
500 | } | ||
501 | |||
502 | return -ENOTTY; | ||
503 | } | ||
504 | |||
478 | /* Low-level architecture-dependent routines */ | 505 | /* Low-level architecture-dependent routines */ |
479 | 506 | ||
480 | struct pci_ops { | 507 | struct pci_ops { |
@@ -669,6 +696,9 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata); | |||
669 | struct pci_bus *pci_create_root_bus(struct device *parent, int bus, | 696 | struct pci_bus *pci_create_root_bus(struct device *parent, int bus, |
670 | struct pci_ops *ops, void *sysdata, | 697 | struct pci_ops *ops, void *sysdata, |
671 | struct list_head *resources); | 698 | struct list_head *resources); |
699 | int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); | ||
700 | int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); | ||
701 | void pci_bus_release_busn_res(struct pci_bus *b); | ||
672 | struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, | 702 | struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, |
673 | struct pci_ops *ops, void *sysdata, | 703 | struct pci_ops *ops, void *sysdata, |
674 | struct list_head *resources); | 704 | struct list_head *resources); |
@@ -715,8 +745,6 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | |||
715 | int pci_find_capability(struct pci_dev *dev, int cap); | 745 | int pci_find_capability(struct pci_dev *dev, int cap); |
716 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 746 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
717 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 747 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
718 | int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn, | ||
719 | int cap); | ||
720 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); | 748 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); |
721 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); | 749 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
722 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 750 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
@@ -778,6 +806,14 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where, | |||
778 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 806 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
779 | } | 807 | } |
780 | 808 | ||
809 | /* user-space driven config access */ | ||
810 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
811 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
812 | int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
813 | int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
814 | int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
815 | int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
816 | |||
781 | int __must_check pci_enable_device(struct pci_dev *dev); | 817 | int __must_check pci_enable_device(struct pci_dev *dev); |
782 | int __must_check pci_enable_device_io(struct pci_dev *dev); | 818 | int __must_check pci_enable_device_io(struct pci_dev *dev); |
783 | int __must_check pci_enable_device_mem(struct pci_dev *dev); | 819 | int __must_check pci_enable_device_mem(struct pci_dev *dev); |
@@ -876,7 +912,6 @@ enum pci_obff_signal_type { | |||
876 | int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); | 912 | int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); |
877 | void pci_disable_obff(struct pci_dev *dev); | 913 | void pci_disable_obff(struct pci_dev *dev); |
878 | 914 | ||
879 | bool pci_ltr_supported(struct pci_dev *dev); | ||
880 | int pci_enable_ltr(struct pci_dev *dev); | 915 | int pci_enable_ltr(struct pci_dev *dev); |
881 | void pci_disable_ltr(struct pci_dev *dev); | 916 | void pci_disable_ltr(struct pci_dev *dev); |
882 | int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); | 917 | int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); |
@@ -1333,6 +1368,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
1333 | static inline int pci_domain_nr(struct pci_bus *bus) | 1368 | static inline int pci_domain_nr(struct pci_bus *bus) |
1334 | { return 0; } | 1369 | { return 0; } |
1335 | 1370 | ||
1371 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) | ||
1372 | { return NULL; } | ||
1373 | |||
1336 | #define dev_is_pci(d) (false) | 1374 | #define dev_is_pci(d) (false) |
1337 | #define dev_is_pf(d) (false) | 1375 | #define dev_is_pf(d) (false) |
1338 | #define dev_num_vf(d) (0) | 1376 | #define dev_num_vf(d) (0) |
@@ -1487,9 +1525,20 @@ enum pci_fixup_pass { | |||
1487 | 1525 | ||
1488 | #ifdef CONFIG_PCI_QUIRKS | 1526 | #ifdef CONFIG_PCI_QUIRKS |
1489 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1527 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
1528 | struct pci_dev *pci_get_dma_source(struct pci_dev *dev); | ||
1529 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); | ||
1490 | #else | 1530 | #else |
1491 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | 1531 | static inline void pci_fixup_device(enum pci_fixup_pass pass, |
1492 | struct pci_dev *dev) {} | 1532 | struct pci_dev *dev) {} |
1533 | static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev) | ||
1534 | { | ||
1535 | return pci_dev_get(dev); | ||
1536 | } | ||
1537 | static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, | ||
1538 | u16 acs_flags) | ||
1539 | { | ||
1540 | return -ENOTTY; | ||
1541 | } | ||
1493 | #endif | 1542 | #endif |
1494 | 1543 | ||
1495 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1544 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
@@ -1592,7 +1641,9 @@ static inline bool pci_is_pcie(struct pci_dev *dev) | |||
1592 | } | 1641 | } |
1593 | 1642 | ||
1594 | void pci_request_acs(void); | 1643 | void pci_request_acs(void); |
1595 | 1644 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); | |
1645 | bool pci_acs_path_enabled(struct pci_dev *start, | ||
1646 | struct pci_dev *end, u16 acs_flags); | ||
1596 | 1647 | ||
1597 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ | 1648 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ |
1598 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) | 1649 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) |