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.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f5c7cd343e56..c1968f464c38 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -218,6 +218,7 @@ struct pci_dev {
218 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 218 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
219 u8 revision; /* PCI revision, low byte of class word */ 219 u8 revision; /* PCI revision, low byte of class word */
220 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 220 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
221 u8 pcie_cap; /* PCI-E capability offset */
221 u8 pcie_type; /* PCI-E device/port type */ 222 u8 pcie_type; /* PCI-E device/port type */
222 u8 rom_base_reg; /* which config register controls the ROM */ 223 u8 rom_base_reg; /* which config register controls the ROM */
223 u8 pin; /* which interrupt pin this device uses */ 224 u8 pin; /* which interrupt pin this device uses */
@@ -242,6 +243,7 @@ struct pci_dev {
242 unsigned int d2_support:1; /* Low power state D2 is supported */ 243 unsigned int d2_support:1; /* Low power state D2 is supported */
243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 244 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
244 unsigned int wakeup_prepared:1; 245 unsigned int wakeup_prepared:1;
246 unsigned int d3_delay; /* D3->D0 transition time in ms */
245 247
246#ifdef CONFIG_PCIEASPM 248#ifdef CONFIG_PCIEASPM
247 struct pcie_link_state *link_state; /* ASPM link state. */ 249 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -280,6 +282,7 @@ struct pci_dev {
280 unsigned int is_virtfn:1; 282 unsigned int is_virtfn:1;
281 unsigned int reset_fn:1; 283 unsigned int reset_fn:1;
282 unsigned int is_hotplug_bridge:1; 284 unsigned int is_hotplug_bridge:1;
285 unsigned int aer_firmware_first:1;
283 pci_dev_flags_t dev_flags; 286 pci_dev_flags_t dev_flags;
284 atomic_t enable_cnt; /* pci_enable_device has been called */ 287 atomic_t enable_cnt; /* pci_enable_device has been called */
285 288
@@ -564,6 +567,9 @@ void pcibios_align_resource(void *, struct resource *, resource_size_t,
564 resource_size_t); 567 resource_size_t);
565void pcibios_update_irq(struct pci_dev *, int irq); 568void pcibios_update_irq(struct pci_dev *, int irq);
566 569
570/* Weak but can be overriden by arch */
571void pci_fixup_cardbus(struct pci_bus *);
572
567/* Generic PCI functions used internally */ 573/* Generic PCI functions used internally */
568 574
569extern struct pci_bus *pci_find_bus(int domain, int busnr); 575extern struct pci_bus *pci_find_bus(int domain, int busnr);
@@ -635,7 +641,13 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
635 unsigned int ss_vendor, unsigned int ss_device, 641 unsigned int ss_vendor, unsigned int ss_device,
636 struct pci_dev *from); 642 struct pci_dev *from);
637struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 643struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
638struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 644struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
645 unsigned int devfn);
646static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
647 unsigned int devfn)
648{
649 return pci_get_domain_bus_and_slot(0, bus, devfn);
650}
639struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 651struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
640int pci_dev_present(const struct pci_device_id *ids); 652int pci_dev_present(const struct pci_device_id *ids);
641 653
@@ -701,6 +713,7 @@ void pci_disable_device(struct pci_dev *dev);
701void pci_set_master(struct pci_dev *dev); 713void pci_set_master(struct pci_dev *dev);
702void pci_clear_master(struct pci_dev *dev); 714void pci_clear_master(struct pci_dev *dev);
703int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 715int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
716int pci_set_cacheline_size(struct pci_dev *dev);
704#define HAVE_PCI_SET_MWI 717#define HAVE_PCI_SET_MWI
705int __must_check pci_set_mwi(struct pci_dev *dev); 718int __must_check pci_set_mwi(struct pci_dev *dev);
706int pci_try_set_mwi(struct pci_dev *dev); 719int pci_try_set_mwi(struct pci_dev *dev);
@@ -743,6 +756,10 @@ pci_power_t pci_target_state(struct pci_dev *dev);
743int pci_prepare_to_sleep(struct pci_dev *dev); 756int pci_prepare_to_sleep(struct pci_dev *dev);
744int pci_back_from_sleep(struct pci_dev *dev); 757int pci_back_from_sleep(struct pci_dev *dev);
745 758
759/* For use by arch with custom probe code */
760void set_pcie_port_type(struct pci_dev *pdev);
761void set_pcie_hotplug_bridge(struct pci_dev *pdev);
762
746/* Functions for PCI Hotplug drivers to use */ 763/* Functions for PCI Hotplug drivers to use */
747int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 764int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
748#ifdef CONFIG_HOTPLUG 765#ifdef CONFIG_HOTPLUG
@@ -1246,6 +1263,8 @@ extern int pci_pci_problems;
1246 1263
1247extern unsigned long pci_cardbus_io_size; 1264extern unsigned long pci_cardbus_io_size;
1248extern unsigned long pci_cardbus_mem_size; 1265extern unsigned long pci_cardbus_mem_size;
1266extern u8 __devinitdata pci_dfl_cache_line_size;
1267extern u8 pci_cache_line_size;
1249 1268
1250extern unsigned long pci_hotplug_io_size; 1269extern unsigned long pci_hotplug_io_size;
1251extern unsigned long pci_hotplug_mem_size; 1270extern unsigned long pci_hotplug_mem_size;
@@ -1290,5 +1309,34 @@ extern void pci_hp_create_module_link(struct pci_slot *pci_slot);
1290extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); 1309extern void pci_hp_remove_module_link(struct pci_slot *pci_slot);
1291#endif 1310#endif
1292 1311
1312/**
1313 * pci_pcie_cap - get the saved PCIe capability offset
1314 * @dev: PCI device
1315 *
1316 * PCIe capability offset is calculated at PCI device initialization
1317 * time and saved in the data structure. This function returns saved
1318 * PCIe capability offset. Using this instead of pci_find_capability()
1319 * reduces unnecessary search in the PCI configuration space. If you
1320 * need to calculate PCIe capability offset from raw device for some
1321 * reasons, please use pci_find_capability() instead.
1322 */
1323static inline int pci_pcie_cap(struct pci_dev *dev)
1324{
1325 return dev->pcie_cap;
1326}
1327
1328/**
1329 * pci_is_pcie - check if the PCI device is PCI Express capable
1330 * @dev: PCI device
1331 *
1332 * Retrun true if the PCI device is PCI Express capable, false otherwise.
1333 */
1334static inline bool pci_is_pcie(struct pci_dev *dev)
1335{
1336 return !!pci_pcie_cap(dev);
1337}
1338
1339void pci_request_acs(void);
1340
1293#endif /* __KERNEL__ */ 1341#endif /* __KERNEL__ */
1294#endif /* LINUX_PCI_H */ 1342#endif /* LINUX_PCI_H */