aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h63
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
372extern struct resource busn_resource;
373
372struct pci_host_bridge_window { 374struct 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 */
482static 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
480struct pci_ops { 507struct pci_ops {
@@ -669,6 +696,9 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
669struct pci_bus *pci_create_root_bus(struct device *parent, int bus, 696struct 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);
699int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
700int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
701void pci_bus_release_busn_res(struct pci_bus *b);
672struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, 702struct 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);
715int pci_find_capability(struct pci_dev *dev, int cap); 745int pci_find_capability(struct pci_dev *dev, int cap);
716int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 746int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
717int pci_find_ext_capability(struct pci_dev *dev, int cap); 747int pci_find_ext_capability(struct pci_dev *dev, int cap);
718int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn,
719 int cap);
720int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); 748int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
721int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); 749int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
722struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 750struct 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 */
810int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val);
811int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val);
812int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val);
813int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val);
814int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val);
815int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val);
816
781int __must_check pci_enable_device(struct pci_dev *dev); 817int __must_check pci_enable_device(struct pci_dev *dev);
782int __must_check pci_enable_device_io(struct pci_dev *dev); 818int __must_check pci_enable_device_io(struct pci_dev *dev);
783int __must_check pci_enable_device_mem(struct pci_dev *dev); 819int __must_check pci_enable_device_mem(struct pci_dev *dev);
@@ -876,7 +912,6 @@ enum pci_obff_signal_type {
876int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); 912int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
877void pci_disable_obff(struct pci_dev *dev); 913void pci_disable_obff(struct pci_dev *dev);
878 914
879bool pci_ltr_supported(struct pci_dev *dev);
880int pci_enable_ltr(struct pci_dev *dev); 915int pci_enable_ltr(struct pci_dev *dev);
881void pci_disable_ltr(struct pci_dev *dev); 916void pci_disable_ltr(struct pci_dev *dev);
882int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); 917int 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,
1333static inline int pci_domain_nr(struct pci_bus *bus) 1368static inline int pci_domain_nr(struct pci_bus *bus)
1334{ return 0; } 1369{ return 0; }
1335 1370
1371static 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
1489void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1527void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1528struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1529int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1490#else 1530#else
1491static inline void pci_fixup_device(enum pci_fixup_pass pass, 1531static inline void pci_fixup_device(enum pci_fixup_pass pass,
1492 struct pci_dev *dev) {} 1532 struct pci_dev *dev) {}
1533static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
1534{
1535 return pci_dev_get(dev);
1536}
1537static 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
1495void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1544void __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
1594void pci_request_acs(void); 1643void pci_request_acs(void);
1595 1644bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);
1645bool 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)