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.h367
1 files changed, 249 insertions, 118 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ae1006322f80..4f96f1d94ac4 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -28,7 +28,7 @@
28 * 7:3 = slot 28 * 7:3 = slot
29 * 2:0 = function 29 * 2:0 = function
30 */ 30 */
31#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) 31#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
32#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) 32#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
33#define PCI_FUNC(devfn) ((devfn) & 0x07) 33#define PCI_FUNC(devfn) ((devfn) & 0x07)
34 34
@@ -66,7 +66,6 @@ enum pci_mmap_state {
66#define PCI_DMA_FROMDEVICE 2 66#define PCI_DMA_FROMDEVICE 2
67#define PCI_DMA_NONE 3 67#define PCI_DMA_NONE 3
68 68
69#define DEVICE_COUNT_COMPATIBLE 4
70#define DEVICE_COUNT_RESOURCE 12 69#define DEVICE_COUNT_RESOURCE 12
71 70
72typedef int __bitwise pci_power_t; 71typedef int __bitwise pci_power_t;
@@ -129,6 +128,7 @@ struct pci_cap_saved_state {
129 u32 data[0]; 128 u32 data[0];
130}; 129};
131 130
131struct pcie_link_state;
132/* 132/*
133 * The pci_dev structure is used to describe PCI devices. 133 * The pci_dev structure is used to describe PCI devices.
134 */ 134 */
@@ -164,13 +164,13 @@ struct pci_dev {
164 this is D0-D3, D0 being fully functional, 164 this is D0-D3, D0 being fully functional,
165 and D3 being off. */ 165 and D3 being off. */
166 166
167#ifdef CONFIG_PCIEASPM
168 struct pcie_link_state *link_state; /* ASPM link state. */
169#endif
170
167 pci_channel_state_t error_state; /* current connectivity state */ 171 pci_channel_state_t error_state; /* current connectivity state */
168 struct device dev; /* Generic device interface */ 172 struct device dev; /* Generic device interface */
169 173
170 /* device is compatible with these IDs */
171 unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
172 unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];
173
174 int cfg_size; /* Size of configuration space */ 174 int cfg_size; /* Size of configuration space */
175 175
176 /* 176 /*
@@ -219,7 +219,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
219} 219}
220 220
221static inline struct pci_cap_saved_state *pci_find_saved_cap( 221static inline struct pci_cap_saved_state *pci_find_saved_cap(
222 struct pci_dev *pci_dev,char cap) 222 struct pci_dev *pci_dev, char cap)
223{ 223{
224 struct pci_cap_saved_state *tmp; 224 struct pci_cap_saved_state *tmp;
225 struct hlist_node *pos; 225 struct hlist_node *pos;
@@ -278,13 +278,13 @@ struct pci_bus {
278 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 278 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
279 pci_bus_flags_t bus_flags; /* Inherited by child busses */ 279 pci_bus_flags_t bus_flags; /* Inherited by child busses */
280 struct device *bridge; 280 struct device *bridge;
281 struct class_device class_dev; 281 struct device dev;
282 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 282 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
283 struct bin_attribute *legacy_mem; /* legacy mem */ 283 struct bin_attribute *legacy_mem; /* legacy mem */
284}; 284};
285 285
286#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 286#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
287#define to_pci_bus(n) container_of(n, struct pci_bus, class_dev) 287#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
288 288
289/* 289/*
290 * Error values that may be returned by PCI functions. 290 * Error values that may be returned by PCI functions.
@@ -314,8 +314,8 @@ struct pci_raw_ops {
314extern struct pci_raw_ops *raw_pci_ops; 314extern struct pci_raw_ops *raw_pci_ops;
315 315
316struct pci_bus_region { 316struct pci_bus_region {
317 unsigned long start; 317 resource_size_t start;
318 unsigned long end; 318 resource_size_t end;
319}; 319};
320 320
321struct pci_dynids { 321struct pci_dynids {
@@ -351,11 +351,10 @@ enum pci_ers_result {
351}; 351};
352 352
353/* PCI bus error event callbacks */ 353/* PCI bus error event callbacks */
354struct pci_error_handlers 354struct pci_error_handlers {
355{
356 /* PCI bus error detected on this device */ 355 /* PCI bus error detected on this device */
357 pci_ers_result_t (*error_detected)(struct pci_dev *dev, 356 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
358 enum pci_channel_state error); 357 enum pci_channel_state error);
359 358
360 /* MMIO has been re-enabled, but not DMA */ 359 /* MMIO has been re-enabled, but not DMA */
361 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); 360 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
@@ -390,7 +389,7 @@ struct pci_driver {
390 struct pci_dynids dynids; 389 struct pci_dynids dynids;
391}; 390};
392 391
393#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 392#define to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
394 393
395/** 394/**
396 * PCI_DEVICE - macro used to describe a specific pci device 395 * PCI_DEVICE - macro used to describe a specific pci device
@@ -448,7 +447,7 @@ extern int no_pci_devices(void);
448 447
449void pcibios_fixup_bus(struct pci_bus *); 448void pcibios_fixup_bus(struct pci_bus *);
450int __must_check pcibios_enable_device(struct pci_dev *, int mask); 449int __must_check pcibios_enable_device(struct pci_dev *, int mask);
451char *pcibios_setup (char *str); 450char *pcibios_setup(char *str);
452 451
453/* Used only when drivers/pci/setup.c is used */ 452/* Used only when drivers/pci/setup.c is used */
454void pcibios_align_resource(void *, struct resource *, resource_size_t, 453void pcibios_align_resource(void *, struct resource *, resource_size_t,
@@ -459,8 +458,10 @@ void pcibios_update_irq(struct pci_dev *, int irq);
459 458
460extern struct pci_bus *pci_find_bus(int domain, int busnr); 459extern struct pci_bus *pci_find_bus(int domain, int busnr);
461void pci_bus_add_devices(struct pci_bus *bus); 460void pci_bus_add_devices(struct pci_bus *bus);
462struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 461struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
463static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) 462 struct pci_ops *ops, void *sysdata);
463static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
464 void *sysdata)
464{ 465{
465 struct pci_bus *root_bus; 466 struct pci_bus *root_bus;
466 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); 467 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
@@ -468,15 +469,18 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
468 pci_bus_add_devices(root_bus); 469 pci_bus_add_devices(root_bus);
469 return root_bus; 470 return root_bus;
470} 471}
471struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 472struct pci_bus *pci_create_bus(struct device *parent, int bus,
472struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); 473 struct pci_ops *ops, void *sysdata);
474struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
475 int busnr);
473int pci_scan_slot(struct pci_bus *bus, int devfn); 476int pci_scan_slot(struct pci_bus *bus, int devfn);
474struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 477struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
475void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 478void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
476unsigned int pci_scan_child_bus(struct pci_bus *bus); 479unsigned int pci_scan_child_bus(struct pci_bus *bus);
477int __must_check pci_bus_add_device(struct pci_dev *dev); 480int __must_check pci_bus_add_device(struct pci_dev *dev);
478void pci_read_bridge_bases(struct pci_bus *child); 481void pci_read_bridge_bases(struct pci_bus *child);
479struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 482struct resource *pci_find_parent_resource(const struct pci_dev *dev,
483 struct resource *res);
480int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 484int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
481extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 485extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
482extern void pci_dev_put(struct pci_dev *dev); 486extern void pci_dev_put(struct pci_dev *dev);
@@ -489,15 +493,19 @@ extern void pci_sort_breadthfirst(void);
489/* Generic PCI functions exported to card drivers */ 493/* Generic PCI functions exported to card drivers */
490 494
491#ifdef CONFIG_PCI_LEGACY 495#ifdef CONFIG_PCI_LEGACY
492struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); 496struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
493struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn); 497 unsigned int device,
498 const struct pci_dev *from);
499struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
500 unsigned int devfn);
494#endif /* CONFIG_PCI_LEGACY */ 501#endif /* CONFIG_PCI_LEGACY */
495 502
496int pci_find_capability (struct pci_dev *dev, int cap); 503int pci_find_capability(struct pci_dev *dev, int cap);
497int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 504int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
498int pci_find_ext_capability (struct pci_dev *dev, int cap); 505int pci_find_ext_capability(struct pci_dev *dev, int cap);
499int pci_find_ht_capability (struct pci_dev *dev, int ht_cap); 506int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
500int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap); 507int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
508void pcie_wait_pending_transaction(struct pci_dev *dev);
501struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 509struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
502 510
503struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, 511struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
@@ -505,49 +513,58 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
505struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device, 513struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
506 struct pci_dev *from); 514 struct pci_dev *from);
507 515
508struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 516struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
509 unsigned int ss_vendor, unsigned int ss_device, 517 unsigned int ss_vendor, unsigned int ss_device,
510 struct pci_dev *from); 518 struct pci_dev *from);
511struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); 519struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
512struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); 520struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
513struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); 521struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
514int pci_dev_present(const struct pci_device_id *ids); 522int pci_dev_present(const struct pci_device_id *ids);
515const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); 523const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
516 524
517int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); 525int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
518int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); 526 int where, u8 *val);
519int pci_bus_read_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 *val); 527int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn,
520int pci_bus_write_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 val); 528 int where, u16 *val);
521int pci_bus_write_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 val); 529int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn,
522int pci_bus_write_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 val); 530 int where, u32 *val);
531int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn,
532 int where, u8 val);
533int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn,
534 int where, u16 val);
535int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
536 int where, u32 val);
523 537
524static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) 538static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val)
525{ 539{
526 return pci_bus_read_config_byte (dev->bus, dev->devfn, where, val); 540 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
527} 541}
528static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) 542static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val)
529{ 543{
530 return pci_bus_read_config_word (dev->bus, dev->devfn, where, val); 544 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
531} 545}
532static inline int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val) 546static inline int pci_read_config_dword(struct pci_dev *dev, int where,
547 u32 *val)
533{ 548{
534 return pci_bus_read_config_dword (dev->bus, dev->devfn, where, val); 549 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
535} 550}
536static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) 551static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val)
537{ 552{
538 return pci_bus_write_config_byte (dev->bus, dev->devfn, where, val); 553 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
539} 554}
540static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) 555static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val)
541{ 556{
542 return pci_bus_write_config_word (dev->bus, dev->devfn, where, val); 557 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
543} 558}
544static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val) 559static inline int pci_write_config_dword(struct pci_dev *dev, int where,
560 u32 val)
545{ 561{
546 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 562 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
547} 563}
548 564
549int __must_check pci_enable_device(struct pci_dev *dev); 565int __must_check pci_enable_device(struct pci_dev *dev);
550int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); 566int __must_check pci_enable_device_io(struct pci_dev *dev);
567int __must_check pci_enable_device_mem(struct pci_dev *dev);
551int __must_check pci_reenable_device(struct pci_dev *); 568int __must_check pci_reenable_device(struct pci_dev *);
552int __must_check pcim_enable_device(struct pci_dev *pdev); 569int __must_check pcim_enable_device(struct pci_dev *pdev);
553void pcim_pin_device(struct pci_dev *pdev); 570void pcim_pin_device(struct pci_dev *pdev);
@@ -576,14 +593,11 @@ int pcie_set_readrq(struct pci_dev *dev, int rq);
576void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 593void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
577int __must_check pci_assign_resource(struct pci_dev *dev, int i); 594int __must_check pci_assign_resource(struct pci_dev *dev, int i);
578int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); 595int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
579void pci_restore_bars(struct pci_dev *dev);
580int pci_select_bars(struct pci_dev *dev, unsigned long flags); 596int pci_select_bars(struct pci_dev *dev, unsigned long flags);
581 597
582/* ROM control related routines */ 598/* ROM control related routines */
583void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 599void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
584void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
585void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 600void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
586void pci_remove_rom(struct pci_dev *pdev);
587size_t pci_get_rom_size(void __iomem *rom, size_t size); 601size_t pci_get_rom_size(void __iomem *rom, size_t size);
588 602
589/* Power management related routines */ 603/* Power management related routines */
@@ -594,7 +608,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
594int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 608int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
595 609
596/* Functions for PCI Hotplug drivers to use */ 610/* Functions for PCI Hotplug drivers to use */
597int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); 611int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
598 612
599/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 613/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
600void pci_bus_assign_resources(struct pci_bus *bus); 614void pci_bus_assign_resources(struct pci_bus *bus);
@@ -631,16 +645,18 @@ static inline int __must_check pci_register_driver(struct pci_driver *driver)
631 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 645 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
632} 646}
633 647
634void pci_unregister_driver(struct pci_driver *); 648void pci_unregister_driver(struct pci_driver *dev);
635void pci_remove_behind_bridge(struct pci_dev *); 649void pci_remove_behind_bridge(struct pci_dev *dev);
636struct pci_driver *pci_dev_driver(const struct pci_dev *); 650struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
637const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); 651const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
638int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 652 struct pci_dev *dev);
653int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
654 int pass);
639 655
640void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 656void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
641 void *userdata); 657 void *userdata);
642int pci_cfg_space_size(struct pci_dev *dev); 658int pci_cfg_space_size(struct pci_dev *dev);
643unsigned char pci_bus_max_busnr(struct pci_bus* bus); 659unsigned char pci_bus_max_busnr(struct pci_bus *bus);
644 660
645/* kmem_cache style wrapper around pci_alloc_consistent() */ 661/* kmem_cache style wrapper around pci_alloc_consistent() */
646 662
@@ -669,19 +685,36 @@ struct msix_entry {
669 685
670 686
671#ifndef CONFIG_PCI_MSI 687#ifndef CONFIG_PCI_MSI
672static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} 688static inline int pci_enable_msi(struct pci_dev *dev)
673static inline void pci_disable_msi(struct pci_dev *dev) {} 689{
674static inline int pci_enable_msix(struct pci_dev* dev, 690 return -1;
675 struct msix_entry *entries, int nvec) {return -1;} 691}
676static inline void pci_disable_msix(struct pci_dev *dev) {} 692
677static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} 693static inline void pci_disable_msi(struct pci_dev *dev)
694{ }
695
696static inline int pci_enable_msix(struct pci_dev *dev,
697 struct msix_entry *entries, int nvec)
698{
699 return -1;
700}
701
702static inline void pci_disable_msix(struct pci_dev *dev)
703{ }
704
705static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
706{ }
707
708static inline void pci_restore_msi_state(struct pci_dev *dev)
709{ }
678#else 710#else
679extern int pci_enable_msi(struct pci_dev *dev); 711extern int pci_enable_msi(struct pci_dev *dev);
680extern void pci_disable_msi(struct pci_dev *dev); 712extern void pci_disable_msi(struct pci_dev *dev);
681extern int pci_enable_msix(struct pci_dev* dev, 713extern int pci_enable_msix(struct pci_dev *dev,
682 struct msix_entry *entries, int nvec); 714 struct msix_entry *entries, int nvec);
683extern void pci_disable_msix(struct pci_dev *dev); 715extern void pci_disable_msix(struct pci_dev *dev);
684extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 716extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
717extern void pci_restore_msi_state(struct pci_dev *dev);
685#endif 718#endif
686 719
687#ifdef CONFIG_HT_IRQ 720#ifdef CONFIG_HT_IRQ
@@ -702,7 +735,11 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
702extern int pci_domains_supported; 735extern int pci_domains_supported;
703#else 736#else
704enum { pci_domains_supported = 0 }; 737enum { pci_domains_supported = 0 };
705static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 738static inline int pci_domain_nr(struct pci_bus *bus)
739{
740 return 0;
741}
742
706static inline int pci_proc_domain(struct pci_bus *bus) 743static inline int pci_proc_domain(struct pci_bus *bus)
707{ 744{
708 return 0; 745 return 0;
@@ -716,67 +753,161 @@ static inline int pci_proc_domain(struct pci_bus *bus)
716 * these as simple inline functions to avoid hair in drivers. 753 * these as simple inline functions to avoid hair in drivers.
717 */ 754 */
718 755
719#define _PCI_NOP(o,s,t) \ 756#define _PCI_NOP(o, s, t) \
720 static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ 757 static inline int pci_##o##_config_##s(struct pci_dev *dev, \
758 int where, t val) \
721 { return PCIBIOS_FUNC_NOT_SUPPORTED; } 759 { return PCIBIOS_FUNC_NOT_SUPPORTED; }
722#define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \ 760
723 _PCI_NOP(o,word,u16 x) \ 761#define _PCI_NOP_ALL(o, x) _PCI_NOP(o, byte, u8 x) \
724 _PCI_NOP(o,dword,u32 x) 762 _PCI_NOP(o, word, u16 x) \
763 _PCI_NOP(o, dword, u32 x)
725_PCI_NOP_ALL(read, *) 764_PCI_NOP_ALL(read, *)
726_PCI_NOP_ALL(write,) 765_PCI_NOP_ALL(write,)
727 766
728static inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) 767static inline struct pci_dev *pci_find_device(unsigned int vendor,
729{ return NULL; } 768 unsigned int device,
769 const struct pci_dev *from)
770{
771 return NULL;
772}
730 773
731static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) 774static inline struct pci_dev *pci_find_slot(unsigned int bus,
732{ return NULL; } 775 unsigned int devfn)
776{
777 return NULL;
778}
733 779
734static inline struct pci_dev *pci_get_device(unsigned int vendor, 780static inline struct pci_dev *pci_get_device(unsigned int vendor,
735 unsigned int device, struct pci_dev *from) 781 unsigned int device,
736{ return NULL; } 782 struct pci_dev *from)
783{
784 return NULL;
785}
737 786
738static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor, 787static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
739 unsigned int device, struct pci_dev *from) 788 unsigned int device,
740{ return NULL; } 789 struct pci_dev *from)
790{
791 return NULL;
792}
741 793
742static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 794static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
743unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from) 795 unsigned int device,
744{ return NULL; } 796 unsigned int ss_vendor,
797 unsigned int ss_device,
798 struct pci_dev *from)
799{
800 return NULL;
801}
745 802
746static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) 803static inline struct pci_dev *pci_get_class(unsigned int class,
747{ return NULL; } 804 struct pci_dev *from)
805{
806 return NULL;
807}
748 808
749#define pci_dev_present(ids) (0) 809#define pci_dev_present(ids) (0)
750#define no_pci_devices() (1) 810#define no_pci_devices() (1)
751#define pci_find_present(ids) (NULL) 811#define pci_find_present(ids) (NULL)
752#define pci_dev_put(dev) do { } while (0) 812#define pci_dev_put(dev) do { } while (0)
753 813
754static inline void pci_set_master(struct pci_dev *dev) { } 814static inline void pci_set_master(struct pci_dev *dev)
755static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } 815{ }
756static inline void pci_disable_device(struct pci_dev *dev) { } 816
757static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } 817static inline int pci_enable_device(struct pci_dev *dev)
758static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} 818{
759static inline int __pci_register_driver(struct pci_driver *drv, struct module *owner) { return 0;} 819 return -EIO;
760static inline int pci_register_driver(struct pci_driver *drv) { return 0;} 820}
761static inline void pci_unregister_driver(struct pci_driver *drv) { } 821
762static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } 822static inline void pci_disable_device(struct pci_dev *dev)
763static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } 823{ }
764static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } 824
825static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
826{
827 return -EIO;
828}
829
830static inline int pci_assign_resource(struct pci_dev *dev, int i)
831{
832 return -EBUSY;
833}
834
835static inline int __pci_register_driver(struct pci_driver *drv,
836 struct module *owner)
837{
838 return 0;
839}
840
841static inline int pci_register_driver(struct pci_driver *drv)
842{
843 return 0;
844}
845
846static inline void pci_unregister_driver(struct pci_driver *drv)
847{ }
848
849static inline int pci_find_capability(struct pci_dev *dev, int cap)
850{
851 return 0;
852}
853
854static inline int pci_find_next_capability(struct pci_dev *dev, u8 post,
855 int cap)
856{
857 return 0;
858}
859
860static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
861{
862 return 0;
863}
864
865static inline void pcie_wait_pending_transaction(struct pci_dev *dev)
866{ }
765 867
766/* Power management related routines */ 868/* Power management related routines */
767static inline int pci_save_state(struct pci_dev *dev) { return 0; } 869static inline int pci_save_state(struct pci_dev *dev)
768static inline int pci_restore_state(struct pci_dev *dev) { return 0; } 870{
769static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; } 871 return 0;
770static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } 872}
771static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } 873
874static inline int pci_restore_state(struct pci_dev *dev)
875{
876 return 0;
877}
878
879static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
880{
881 return 0;
882}
883
884static inline pci_power_t pci_choose_state(struct pci_dev *dev,
885 pm_message_t state)
886{
887 return PCI_D0;
888}
889
890static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
891 int enable)
892{
893 return 0;
894}
895
896static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
897{
898 return -EIO;
899}
772 900
773static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) { return -EIO; } 901static inline void pci_release_regions(struct pci_dev *dev)
774static inline void pci_release_regions(struct pci_dev *dev) { } 902{ }
775 903
776#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 904#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
777 905
778static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } 906static inline void pci_block_user_cfg_access(struct pci_dev *dev)
779static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { } 907{ }
908
909static inline void pci_unblock_user_cfg_access(struct pci_dev *dev)
910{ }
780 911
781static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 912static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
782{ return NULL; } 913{ return NULL; }
@@ -797,27 +928,27 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
797 928
798/* these helpers provide future and backwards compatibility 929/* these helpers provide future and backwards compatibility
799 * for accessing popular PCI BAR info */ 930 * for accessing popular PCI BAR info */
800#define pci_resource_start(dev,bar) ((dev)->resource[(bar)].start) 931#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
801#define pci_resource_end(dev,bar) ((dev)->resource[(bar)].end) 932#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
802#define pci_resource_flags(dev,bar) ((dev)->resource[(bar)].flags) 933#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
803#define pci_resource_len(dev,bar) \ 934#define pci_resource_len(dev,bar) \
804 ((pci_resource_start((dev),(bar)) == 0 && \ 935 ((pci_resource_start((dev), (bar)) == 0 && \
805 pci_resource_end((dev),(bar)) == \ 936 pci_resource_end((dev), (bar)) == \
806 pci_resource_start((dev),(bar))) ? 0 : \ 937 pci_resource_start((dev), (bar))) ? 0 : \
807 \ 938 \
808 (pci_resource_end((dev),(bar)) - \ 939 (pci_resource_end((dev), (bar)) - \
809 pci_resource_start((dev),(bar)) + 1)) 940 pci_resource_start((dev), (bar)) + 1))
810 941
811/* Similar to the helpers above, these manipulate per-pci_dev 942/* Similar to the helpers above, these manipulate per-pci_dev
812 * driver-specific data. They are really just a wrapper around 943 * driver-specific data. They are really just a wrapper around
813 * the generic device structure functions of these calls. 944 * the generic device structure functions of these calls.
814 */ 945 */
815static inline void *pci_get_drvdata (struct pci_dev *pdev) 946static inline void *pci_get_drvdata(struct pci_dev *pdev)
816{ 947{
817 return dev_get_drvdata(&pdev->dev); 948 return dev_get_drvdata(&pdev->dev);
818} 949}
819 950
820static inline void pci_set_drvdata (struct pci_dev *pdev, void *data) 951static inline void pci_set_drvdata(struct pci_dev *pdev, void *data)
821{ 952{
822 dev_set_drvdata(&pdev->dev, data); 953 dev_set_drvdata(&pdev->dev, data);
823} 954}
@@ -836,7 +967,7 @@ static inline char *pci_name(struct pci_dev *pdev)
836 */ 967 */
837#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER 968#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
838static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, 969static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
839 const struct resource *rsrc, resource_size_t *start, 970 const struct resource *rsrc, resource_size_t *start,
840 resource_size_t *end) 971 resource_size_t *end)
841{ 972{
842 *start = rsrc->start; 973 *start = rsrc->start;
@@ -888,9 +1019,9 @@ enum pci_fixup_pass {
888 1019
889void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1020void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
890 1021
891void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1022void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
892void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1023void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
893void __iomem * const * pcim_iomap_table(struct pci_dev *pdev); 1024void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
894int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 1025int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
895void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); 1026void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
896 1027