diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 352 |
1 files changed, 107 insertions, 245 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index a13d6825e586..fb57c892b214 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -224,7 +224,8 @@ enum pci_bus_speed { | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | struct pci_cap_saved_data { | 226 | struct pci_cap_saved_data { |
227 | char cap_nr; | 227 | u16 cap_nr; |
228 | bool cap_extended; | ||
228 | unsigned int size; | 229 | unsigned int size; |
229 | u32 data[0]; | 230 | u32 data[0]; |
230 | }; | 231 | }; |
@@ -351,7 +352,7 @@ struct pci_dev { | |||
351 | struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ | 352 | struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ |
352 | #ifdef CONFIG_PCI_MSI | 353 | #ifdef CONFIG_PCI_MSI |
353 | struct list_head msi_list; | 354 | struct list_head msi_list; |
354 | struct kset *msi_kset; | 355 | const struct attribute_group **msi_irq_groups; |
355 | #endif | 356 | #endif |
356 | struct pci_vpd *vpd; | 357 | struct pci_vpd *vpd; |
357 | #ifdef CONFIG_PCI_ATS | 358 | #ifdef CONFIG_PCI_ATS |
@@ -375,7 +376,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev) | |||
375 | } | 376 | } |
376 | 377 | ||
377 | struct pci_dev *pci_alloc_dev(struct pci_bus *bus); | 378 | struct pci_dev *pci_alloc_dev(struct pci_bus *bus); |
378 | struct pci_dev * __deprecated alloc_pci_dev(void); | ||
379 | 379 | ||
380 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) | 380 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
381 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) | 381 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) |
@@ -385,8 +385,6 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
385 | return (pdev->error_state != pci_channel_io_normal); | 385 | return (pdev->error_state != pci_channel_io_normal); |
386 | } | 386 | } |
387 | 387 | ||
388 | extern struct resource busn_resource; | ||
389 | |||
390 | struct pci_host_bridge_window { | 388 | struct pci_host_bridge_window { |
391 | struct list_head list; | 389 | struct list_head list; |
392 | struct resource *res; /* host bridge aperture (CPU address) */ | 390 | struct resource *res; /* host bridge aperture (CPU address) */ |
@@ -551,8 +549,8 @@ int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, | |||
551 | int reg, int len, u32 val); | 549 | int reg, int len, u32 val); |
552 | 550 | ||
553 | struct pci_bus_region { | 551 | struct pci_bus_region { |
554 | resource_size_t start; | 552 | dma_addr_t start; |
555 | resource_size_t end; | 553 | dma_addr_t end; |
556 | }; | 554 | }; |
557 | 555 | ||
558 | struct pci_dynids { | 556 | struct pci_dynids { |
@@ -634,8 +632,7 @@ struct pci_driver { | |||
634 | * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table | 632 | * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table |
635 | * @_table: device table name | 633 | * @_table: device table name |
636 | * | 634 | * |
637 | * This macro is used to create a struct pci_device_id array (a device table) | 635 | * This macro is deprecated and should not be used in new code. |
638 | * in a generic manner. | ||
639 | */ | 636 | */ |
640 | #define DEFINE_PCI_DEVICE_TABLE(_table) \ | 637 | #define DEFINE_PCI_DEVICE_TABLE(_table) \ |
641 | const struct pci_device_id _table[] | 638 | const struct pci_device_id _table[] |
@@ -737,9 +734,9 @@ void pci_fixup_cardbus(struct pci_bus *); | |||
737 | 734 | ||
738 | /* Generic PCI functions used internally */ | 735 | /* Generic PCI functions used internally */ |
739 | 736 | ||
740 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | 737 | void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, |
741 | struct resource *res); | 738 | struct resource *res); |
742 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | 739 | void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res, |
743 | struct pci_bus_region *region); | 740 | struct pci_bus_region *region); |
744 | void pcibios_scan_specific_bus(int busn); | 741 | void pcibios_scan_specific_bus(int busn); |
745 | struct pci_bus *pci_find_bus(int domain, int busnr); | 742 | struct pci_bus *pci_find_bus(int domain, int busnr); |
@@ -763,7 +760,6 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | |||
763 | const char *name, | 760 | const char *name, |
764 | struct hotplug_slot *hotplug); | 761 | struct hotplug_slot *hotplug); |
765 | void pci_destroy_slot(struct pci_slot *slot); | 762 | void pci_destroy_slot(struct pci_slot *slot); |
766 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr); | ||
767 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 763 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
768 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 764 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
769 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 765 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
@@ -779,6 +775,7 @@ struct pci_dev *pci_dev_get(struct pci_dev *dev); | |||
779 | void pci_dev_put(struct pci_dev *dev); | 775 | void pci_dev_put(struct pci_dev *dev); |
780 | void pci_remove_bus(struct pci_bus *b); | 776 | void pci_remove_bus(struct pci_bus *b); |
781 | void pci_stop_and_remove_bus_device(struct pci_dev *dev); | 777 | void pci_stop_and_remove_bus_device(struct pci_dev *dev); |
778 | void pci_stop_and_remove_bus_device_locked(struct pci_dev *dev); | ||
782 | void pci_stop_root_bus(struct pci_bus *bus); | 779 | void pci_stop_root_bus(struct pci_bus *bus); |
783 | void pci_remove_root_bus(struct pci_bus *bus); | 780 | void pci_remove_root_bus(struct pci_bus *bus); |
784 | void pci_setup_cardbus(struct pci_bus *bus); | 781 | void pci_setup_cardbus(struct pci_bus *bus); |
@@ -938,6 +935,7 @@ bool pci_check_and_unmask_intx(struct pci_dev *dev); | |||
938 | void pci_msi_off(struct pci_dev *dev); | 935 | void pci_msi_off(struct pci_dev *dev); |
939 | int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); | 936 | int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); |
940 | int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); | 937 | int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); |
938 | int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask); | ||
941 | int pci_wait_for_pending_transaction(struct pci_dev *dev); | 939 | int pci_wait_for_pending_transaction(struct pci_dev *dev); |
942 | int pcix_get_max_mmrbc(struct pci_dev *dev); | 940 | int pcix_get_max_mmrbc(struct pci_dev *dev); |
943 | int pcix_get_mmrbc(struct pci_dev *dev); | 941 | int pcix_get_mmrbc(struct pci_dev *dev); |
@@ -951,10 +949,13 @@ int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed, | |||
951 | int __pci_reset_function(struct pci_dev *dev); | 949 | int __pci_reset_function(struct pci_dev *dev); |
952 | int __pci_reset_function_locked(struct pci_dev *dev); | 950 | int __pci_reset_function_locked(struct pci_dev *dev); |
953 | int pci_reset_function(struct pci_dev *dev); | 951 | int pci_reset_function(struct pci_dev *dev); |
952 | int pci_try_reset_function(struct pci_dev *dev); | ||
954 | int pci_probe_reset_slot(struct pci_slot *slot); | 953 | int pci_probe_reset_slot(struct pci_slot *slot); |
955 | int pci_reset_slot(struct pci_slot *slot); | 954 | int pci_reset_slot(struct pci_slot *slot); |
955 | int pci_try_reset_slot(struct pci_slot *slot); | ||
956 | int pci_probe_reset_bus(struct pci_bus *bus); | 956 | int pci_probe_reset_bus(struct pci_bus *bus); |
957 | int pci_reset_bus(struct pci_bus *bus); | 957 | int pci_reset_bus(struct pci_bus *bus); |
958 | int pci_try_reset_bus(struct pci_bus *bus); | ||
958 | void pci_reset_bridge_secondary_bus(struct pci_dev *dev); | 959 | void pci_reset_bridge_secondary_bus(struct pci_dev *dev); |
959 | void pci_update_resource(struct pci_dev *dev, int resno); | 960 | void pci_update_resource(struct pci_dev *dev, int resno); |
960 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 961 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
@@ -974,9 +975,14 @@ void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); | |||
974 | int pci_save_state(struct pci_dev *dev); | 975 | int pci_save_state(struct pci_dev *dev); |
975 | void pci_restore_state(struct pci_dev *dev); | 976 | void pci_restore_state(struct pci_dev *dev); |
976 | struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); | 977 | struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); |
977 | int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state); | ||
978 | int pci_load_and_free_saved_state(struct pci_dev *dev, | 978 | int pci_load_and_free_saved_state(struct pci_dev *dev, |
979 | struct pci_saved_state **state); | 979 | struct pci_saved_state **state); |
980 | struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap); | ||
981 | struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev, | ||
982 | u16 cap); | ||
983 | int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size); | ||
984 | int pci_add_ext_cap_save_buffer(struct pci_dev *dev, | ||
985 | u16 cap, unsigned int size); | ||
980 | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); | 986 | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); |
981 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 987 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
982 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 988 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
@@ -985,7 +991,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable); | |||
985 | int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, | 991 | int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
986 | bool runtime, bool enable); | 992 | bool runtime, bool enable); |
987 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | 993 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); |
988 | pci_power_t pci_target_state(struct pci_dev *dev); | ||
989 | int pci_prepare_to_sleep(struct pci_dev *dev); | 994 | int pci_prepare_to_sleep(struct pci_dev *dev); |
990 | int pci_back_from_sleep(struct pci_dev *dev); | 995 | int pci_back_from_sleep(struct pci_dev *dev); |
991 | bool pci_dev_run_wake(struct pci_dev *dev); | 996 | bool pci_dev_run_wake(struct pci_dev *dev); |
@@ -998,21 +1003,10 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | |||
998 | return __pci_enable_wake(dev, state, false, enable); | 1003 | return __pci_enable_wake(dev, state, false, enable); |
999 | } | 1004 | } |
1000 | 1005 | ||
1001 | #define PCI_EXP_IDO_REQUEST (1<<0) | 1006 | /* PCI Virtual Channel */ |
1002 | #define PCI_EXP_IDO_COMPLETION (1<<1) | 1007 | int pci_save_vc_state(struct pci_dev *dev); |
1003 | void pci_enable_ido(struct pci_dev *dev, unsigned long type); | 1008 | void pci_restore_vc_state(struct pci_dev *dev); |
1004 | void pci_disable_ido(struct pci_dev *dev, unsigned long type); | 1009 | void pci_allocate_vc_save_buffers(struct pci_dev *dev); |
1005 | |||
1006 | enum pci_obff_signal_type { | ||
1007 | PCI_EXP_OBFF_SIGNAL_L0 = 0, | ||
1008 | PCI_EXP_OBFF_SIGNAL_ALWAYS = 1, | ||
1009 | }; | ||
1010 | int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); | ||
1011 | void pci_disable_obff(struct pci_dev *dev); | ||
1012 | |||
1013 | int pci_enable_ltr(struct pci_dev *dev); | ||
1014 | void pci_disable_ltr(struct pci_dev *dev); | ||
1015 | int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); | ||
1016 | 1010 | ||
1017 | /* For use by arch with custom probe code */ | 1011 | /* For use by arch with custom probe code */ |
1018 | void set_pcie_port_type(struct pci_dev *pdev); | 1012 | void set_pcie_port_type(struct pci_dev *pdev); |
@@ -1022,11 +1016,12 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev); | |||
1022 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 1016 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
1023 | unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); | 1017 | unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); |
1024 | unsigned int pci_rescan_bus(struct pci_bus *bus); | 1018 | unsigned int pci_rescan_bus(struct pci_bus *bus); |
1019 | void pci_lock_rescan_remove(void); | ||
1020 | void pci_unlock_rescan_remove(void); | ||
1025 | 1021 | ||
1026 | /* Vital product data routines */ | 1022 | /* Vital product data routines */ |
1027 | ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); | 1023 | ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); |
1028 | ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); | 1024 | ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); |
1029 | int pci_vpd_truncate(struct pci_dev *dev, size_t size); | ||
1030 | 1025 | ||
1031 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ | 1026 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ |
1032 | resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); | 1027 | resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); |
@@ -1078,6 +1073,14 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus, | |||
1078 | resource_size_t), | 1073 | resource_size_t), |
1079 | void *alignf_data); | 1074 | void *alignf_data); |
1080 | 1075 | ||
1076 | static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar) | ||
1077 | { | ||
1078 | struct pci_bus_region region; | ||
1079 | |||
1080 | pcibios_resource_to_bus(pdev->bus, ®ion, &pdev->resource[bar]); | ||
1081 | return region.start; | ||
1082 | } | ||
1083 | |||
1081 | /* Proper probing supporting hot-pluggable devices */ | 1084 | /* Proper probing supporting hot-pluggable devices */ |
1082 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, | 1085 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
1083 | const char *mod_name); | 1086 | const char *mod_name); |
@@ -1115,7 +1118,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
1115 | 1118 | ||
1116 | void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), | 1119 | void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), |
1117 | void *userdata); | 1120 | void *userdata); |
1118 | int pci_cfg_space_size_ext(struct pci_dev *dev); | ||
1119 | int pci_cfg_space_size(struct pci_dev *dev); | 1121 | int pci_cfg_space_size(struct pci_dev *dev); |
1120 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); | 1122 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); |
1121 | void pci_setup_bridge(struct pci_bus *bus); | 1123 | void pci_setup_bridge(struct pci_bus *bus); |
@@ -1154,59 +1156,42 @@ struct msix_entry { | |||
1154 | }; | 1156 | }; |
1155 | 1157 | ||
1156 | 1158 | ||
1157 | #ifndef CONFIG_PCI_MSI | 1159 | #ifdef CONFIG_PCI_MSI |
1158 | static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec) | 1160 | int pci_msi_vec_count(struct pci_dev *dev); |
1159 | { | 1161 | int pci_enable_msi_block(struct pci_dev *dev, int nvec); |
1160 | return -1; | ||
1161 | } | ||
1162 | |||
1163 | static inline int | ||
1164 | pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec) | ||
1165 | { | ||
1166 | return -1; | ||
1167 | } | ||
1168 | |||
1169 | static inline void pci_msi_shutdown(struct pci_dev *dev) | ||
1170 | { } | ||
1171 | static inline void pci_disable_msi(struct pci_dev *dev) | ||
1172 | { } | ||
1173 | |||
1174 | static inline int pci_msix_table_size(struct pci_dev *dev) | ||
1175 | { | ||
1176 | return 0; | ||
1177 | } | ||
1178 | static inline int pci_enable_msix(struct pci_dev *dev, | ||
1179 | struct msix_entry *entries, int nvec) | ||
1180 | { | ||
1181 | return -1; | ||
1182 | } | ||
1183 | |||
1184 | static inline void pci_msix_shutdown(struct pci_dev *dev) | ||
1185 | { } | ||
1186 | static inline void pci_disable_msix(struct pci_dev *dev) | ||
1187 | { } | ||
1188 | |||
1189 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) | ||
1190 | { } | ||
1191 | |||
1192 | static inline void pci_restore_msi_state(struct pci_dev *dev) | ||
1193 | { } | ||
1194 | static inline int pci_msi_enabled(void) | ||
1195 | { | ||
1196 | return 0; | ||
1197 | } | ||
1198 | #else | ||
1199 | int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); | ||
1200 | int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); | ||
1201 | void pci_msi_shutdown(struct pci_dev *dev); | 1162 | void pci_msi_shutdown(struct pci_dev *dev); |
1202 | void pci_disable_msi(struct pci_dev *dev); | 1163 | void pci_disable_msi(struct pci_dev *dev); |
1203 | int pci_msix_table_size(struct pci_dev *dev); | 1164 | int pci_msix_vec_count(struct pci_dev *dev); |
1204 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); | 1165 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); |
1205 | void pci_msix_shutdown(struct pci_dev *dev); | 1166 | void pci_msix_shutdown(struct pci_dev *dev); |
1206 | void pci_disable_msix(struct pci_dev *dev); | 1167 | void pci_disable_msix(struct pci_dev *dev); |
1207 | void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 1168 | void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
1208 | void pci_restore_msi_state(struct pci_dev *dev); | 1169 | void pci_restore_msi_state(struct pci_dev *dev); |
1209 | int pci_msi_enabled(void); | 1170 | int pci_msi_enabled(void); |
1171 | int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); | ||
1172 | int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, | ||
1173 | int minvec, int maxvec); | ||
1174 | #else | ||
1175 | static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } | ||
1176 | static inline int pci_enable_msi_block(struct pci_dev *dev, int nvec) | ||
1177 | { return -ENOSYS; } | ||
1178 | static inline void pci_msi_shutdown(struct pci_dev *dev) { } | ||
1179 | static inline void pci_disable_msi(struct pci_dev *dev) { } | ||
1180 | static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } | ||
1181 | static inline int pci_enable_msix(struct pci_dev *dev, | ||
1182 | struct msix_entry *entries, int nvec) | ||
1183 | { return -ENOSYS; } | ||
1184 | static inline void pci_msix_shutdown(struct pci_dev *dev) { } | ||
1185 | static inline void pci_disable_msix(struct pci_dev *dev) { } | ||
1186 | static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { } | ||
1187 | static inline void pci_restore_msi_state(struct pci_dev *dev) { } | ||
1188 | static inline int pci_msi_enabled(void) { return 0; } | ||
1189 | static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, | ||
1190 | int maxvec) | ||
1191 | { return -ENOSYS; } | ||
1192 | static inline int pci_enable_msix_range(struct pci_dev *dev, | ||
1193 | struct msix_entry *entries, int minvec, int maxvec) | ||
1194 | { return -ENOSYS; } | ||
1210 | #endif | 1195 | #endif |
1211 | 1196 | ||
1212 | #ifdef CONFIG_PCIEPORTBUS | 1197 | #ifdef CONFIG_PCIEPORTBUS |
@@ -1217,12 +1202,10 @@ extern bool pcie_ports_auto; | |||
1217 | #define pcie_ports_auto false | 1202 | #define pcie_ports_auto false |
1218 | #endif | 1203 | #endif |
1219 | 1204 | ||
1220 | #ifndef CONFIG_PCIEASPM | 1205 | #ifdef CONFIG_PCIEASPM |
1221 | static inline int pcie_aspm_enabled(void) { return 0; } | ||
1222 | static inline bool pcie_aspm_support_enabled(void) { return false; } | ||
1223 | #else | ||
1224 | int pcie_aspm_enabled(void); | ||
1225 | bool pcie_aspm_support_enabled(void); | 1206 | bool pcie_aspm_support_enabled(void); |
1207 | #else | ||
1208 | static inline bool pcie_aspm_support_enabled(void) { return false; } | ||
1226 | #endif | 1209 | #endif |
1227 | 1210 | ||
1228 | #ifdef CONFIG_PCIEAER | 1211 | #ifdef CONFIG_PCIEAER |
@@ -1233,15 +1216,12 @@ static inline void pci_no_aer(void) { } | |||
1233 | static inline bool pci_aer_available(void) { return false; } | 1216 | static inline bool pci_aer_available(void) { return false; } |
1234 | #endif | 1217 | #endif |
1235 | 1218 | ||
1236 | #ifndef CONFIG_PCIE_ECRC | 1219 | #ifdef CONFIG_PCIE_ECRC |
1237 | static inline void pcie_set_ecrc_checking(struct pci_dev *dev) | ||
1238 | { | ||
1239 | return; | ||
1240 | } | ||
1241 | static inline void pcie_ecrc_get_policy(char *str) {}; | ||
1242 | #else | ||
1243 | void pcie_set_ecrc_checking(struct pci_dev *dev); | 1220 | void pcie_set_ecrc_checking(struct pci_dev *dev); |
1244 | void pcie_ecrc_get_policy(char *str); | 1221 | void pcie_ecrc_get_policy(char *str); |
1222 | #else | ||
1223 | static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { } | ||
1224 | static inline void pcie_ecrc_get_policy(char *str) { } | ||
1245 | #endif | 1225 | #endif |
1246 | 1226 | ||
1247 | #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) | 1227 | #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) |
@@ -1265,15 +1245,8 @@ void pci_cfg_access_unlock(struct pci_dev *dev); | |||
1265 | extern int pci_domains_supported; | 1245 | extern int pci_domains_supported; |
1266 | #else | 1246 | #else |
1267 | enum { pci_domains_supported = 0 }; | 1247 | enum { pci_domains_supported = 0 }; |
1268 | static inline int pci_domain_nr(struct pci_bus *bus) | 1248 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } |
1269 | { | 1249 | static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } |
1270 | return 0; | ||
1271 | } | ||
1272 | |||
1273 | static inline int pci_proc_domain(struct pci_bus *bus) | ||
1274 | { | ||
1275 | return 0; | ||
1276 | } | ||
1277 | #endif /* CONFIG_PCI_DOMAINS */ | 1250 | #endif /* CONFIG_PCI_DOMAINS */ |
1278 | 1251 | ||
1279 | /* some architectures require additional setup to direct VGA traffic */ | 1252 | /* some architectures require additional setup to direct VGA traffic */ |
@@ -1302,180 +1275,88 @@ _PCI_NOP_ALL(write,) | |||
1302 | static inline struct pci_dev *pci_get_device(unsigned int vendor, | 1275 | static inline struct pci_dev *pci_get_device(unsigned int vendor, |
1303 | unsigned int device, | 1276 | unsigned int device, |
1304 | struct pci_dev *from) | 1277 | struct pci_dev *from) |
1305 | { | 1278 | { return NULL; } |
1306 | return NULL; | ||
1307 | } | ||
1308 | 1279 | ||
1309 | static inline struct pci_dev *pci_get_subsys(unsigned int vendor, | 1280 | static inline struct pci_dev *pci_get_subsys(unsigned int vendor, |
1310 | unsigned int device, | 1281 | unsigned int device, |
1311 | unsigned int ss_vendor, | 1282 | unsigned int ss_vendor, |
1312 | unsigned int ss_device, | 1283 | unsigned int ss_device, |
1313 | struct pci_dev *from) | 1284 | struct pci_dev *from) |
1314 | { | 1285 | { return NULL; } |
1315 | return NULL; | ||
1316 | } | ||
1317 | 1286 | ||
1318 | static inline struct pci_dev *pci_get_class(unsigned int class, | 1287 | static inline struct pci_dev *pci_get_class(unsigned int class, |
1319 | struct pci_dev *from) | 1288 | struct pci_dev *from) |
1320 | { | 1289 | { return NULL; } |
1321 | return NULL; | ||
1322 | } | ||
1323 | 1290 | ||
1324 | #define pci_dev_present(ids) (0) | 1291 | #define pci_dev_present(ids) (0) |
1325 | #define no_pci_devices() (1) | 1292 | #define no_pci_devices() (1) |
1326 | #define pci_dev_put(dev) do { } while (0) | 1293 | #define pci_dev_put(dev) do { } while (0) |
1327 | 1294 | ||
1328 | static inline void pci_set_master(struct pci_dev *dev) | 1295 | static inline void pci_set_master(struct pci_dev *dev) { } |
1329 | { } | 1296 | static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } |
1330 | 1297 | static inline void pci_disable_device(struct pci_dev *dev) { } | |
1331 | static inline int pci_enable_device(struct pci_dev *dev) | ||
1332 | { | ||
1333 | return -EIO; | ||
1334 | } | ||
1335 | |||
1336 | static inline void pci_disable_device(struct pci_dev *dev) | ||
1337 | { } | ||
1338 | |||
1339 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) | 1298 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) |
1340 | { | 1299 | { return -EIO; } |
1341 | return -EIO; | ||
1342 | } | ||
1343 | |||
1344 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | 1300 | static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) |
1345 | { | 1301 | { return -EIO; } |
1346 | return -EIO; | ||
1347 | } | ||
1348 | |||
1349 | static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, | 1302 | static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, |
1350 | unsigned int size) | 1303 | unsigned int size) |
1351 | { | 1304 | { return -EIO; } |
1352 | return -EIO; | ||
1353 | } | ||
1354 | |||
1355 | static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, | 1305 | static inline int pci_set_dma_seg_boundary(struct pci_dev *dev, |
1356 | unsigned long mask) | 1306 | unsigned long mask) |
1357 | { | 1307 | { return -EIO; } |
1358 | return -EIO; | ||
1359 | } | ||
1360 | |||
1361 | static inline int pci_assign_resource(struct pci_dev *dev, int i) | 1308 | static inline int pci_assign_resource(struct pci_dev *dev, int i) |
1362 | { | 1309 | { return -EBUSY; } |
1363 | return -EBUSY; | ||
1364 | } | ||
1365 | |||
1366 | static inline int __pci_register_driver(struct pci_driver *drv, | 1310 | static inline int __pci_register_driver(struct pci_driver *drv, |
1367 | struct module *owner) | 1311 | struct module *owner) |
1368 | { | 1312 | { return 0; } |
1369 | return 0; | ||
1370 | } | ||
1371 | |||
1372 | static inline int pci_register_driver(struct pci_driver *drv) | 1313 | static inline int pci_register_driver(struct pci_driver *drv) |
1373 | { | 1314 | { return 0; } |
1374 | return 0; | 1315 | static inline void pci_unregister_driver(struct pci_driver *drv) { } |
1375 | } | ||
1376 | |||
1377 | static inline void pci_unregister_driver(struct pci_driver *drv) | ||
1378 | { } | ||
1379 | |||
1380 | static inline int pci_find_capability(struct pci_dev *dev, int cap) | 1316 | static inline int pci_find_capability(struct pci_dev *dev, int cap) |
1381 | { | 1317 | { return 0; } |
1382 | return 0; | ||
1383 | } | ||
1384 | |||
1385 | static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, | 1318 | static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, |
1386 | int cap) | 1319 | int cap) |
1387 | { | 1320 | { return 0; } |
1388 | return 0; | ||
1389 | } | ||
1390 | |||
1391 | static inline int pci_find_ext_capability(struct pci_dev *dev, int cap) | 1321 | static inline int pci_find_ext_capability(struct pci_dev *dev, int cap) |
1392 | { | 1322 | { return 0; } |
1393 | return 0; | ||
1394 | } | ||
1395 | 1323 | ||
1396 | /* Power management related routines */ | 1324 | /* Power management related routines */ |
1397 | static inline int pci_save_state(struct pci_dev *dev) | 1325 | static inline int pci_save_state(struct pci_dev *dev) { return 0; } |
1398 | { | 1326 | static inline void pci_restore_state(struct pci_dev *dev) { } |
1399 | return 0; | ||
1400 | } | ||
1401 | |||
1402 | static inline void pci_restore_state(struct pci_dev *dev) | ||
1403 | { } | ||
1404 | |||
1405 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 1327 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
1406 | { | 1328 | { return 0; } |
1407 | return 0; | ||
1408 | } | ||
1409 | |||
1410 | static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable) | 1329 | static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable) |
1411 | { | 1330 | { return 0; } |
1412 | return 0; | ||
1413 | } | ||
1414 | |||
1415 | static inline pci_power_t pci_choose_state(struct pci_dev *dev, | 1331 | static inline pci_power_t pci_choose_state(struct pci_dev *dev, |
1416 | pm_message_t state) | 1332 | pm_message_t state) |
1417 | { | 1333 | { return PCI_D0; } |
1418 | return PCI_D0; | ||
1419 | } | ||
1420 | |||
1421 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | 1334 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
1422 | int enable) | 1335 | int enable) |
1423 | { | 1336 | { return 0; } |
1424 | return 0; | ||
1425 | } | ||
1426 | |||
1427 | static inline void pci_enable_ido(struct pci_dev *dev, unsigned long type) | ||
1428 | { | ||
1429 | } | ||
1430 | |||
1431 | static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type) | ||
1432 | { | ||
1433 | } | ||
1434 | |||
1435 | static inline int pci_enable_obff(struct pci_dev *dev, unsigned long type) | ||
1436 | { | ||
1437 | return 0; | ||
1438 | } | ||
1439 | |||
1440 | static inline void pci_disable_obff(struct pci_dev *dev) | ||
1441 | { | ||
1442 | } | ||
1443 | 1337 | ||
1444 | static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) | 1338 | static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) |
1445 | { | 1339 | { return -EIO; } |
1446 | return -EIO; | 1340 | static inline void pci_release_regions(struct pci_dev *dev) { } |
1447 | } | ||
1448 | |||
1449 | static inline void pci_release_regions(struct pci_dev *dev) | ||
1450 | { } | ||
1451 | 1341 | ||
1452 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | 1342 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) |
1453 | 1343 | ||
1454 | static inline void pci_block_cfg_access(struct pci_dev *dev) | 1344 | static inline void pci_block_cfg_access(struct pci_dev *dev) { } |
1455 | { } | ||
1456 | |||
1457 | static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev) | 1345 | static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev) |
1458 | { return 0; } | 1346 | { return 0; } |
1459 | 1347 | static inline void pci_unblock_cfg_access(struct pci_dev *dev) { } | |
1460 | static inline void pci_unblock_cfg_access(struct pci_dev *dev) | ||
1461 | { } | ||
1462 | 1348 | ||
1463 | static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) | 1349 | static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) |
1464 | { return NULL; } | 1350 | { return NULL; } |
1465 | |||
1466 | static inline struct pci_dev *pci_get_slot(struct pci_bus *bus, | 1351 | static inline struct pci_dev *pci_get_slot(struct pci_bus *bus, |
1467 | unsigned int devfn) | 1352 | unsigned int devfn) |
1468 | { return NULL; } | 1353 | { return NULL; } |
1469 | |||
1470 | static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | 1354 | static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, |
1471 | unsigned int devfn) | 1355 | unsigned int devfn) |
1472 | { return NULL; } | 1356 | { return NULL; } |
1473 | 1357 | ||
1474 | static inline int pci_domain_nr(struct pci_bus *bus) | 1358 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } |
1475 | { return 0; } | 1359 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } |
1476 | |||
1477 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) | ||
1478 | { return NULL; } | ||
1479 | 1360 | ||
1480 | #define dev_is_pci(d) (false) | 1361 | #define dev_is_pci(d) (false) |
1481 | #define dev_is_pf(d) (false) | 1362 | #define dev_is_pf(d) (false) |
@@ -1486,10 +1367,6 @@ static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) | |||
1486 | 1367 | ||
1487 | #include <asm/pci.h> | 1368 | #include <asm/pci.h> |
1488 | 1369 | ||
1489 | #ifndef PCIBIOS_MAX_MEM_32 | ||
1490 | #define PCIBIOS_MAX_MEM_32 (-1) | ||
1491 | #endif | ||
1492 | |||
1493 | /* these helpers provide future and backwards compatibility | 1370 | /* these helpers provide future and backwards compatibility |
1494 | * for accessing popular PCI BAR info */ | 1371 | * for accessing popular PCI BAR info */ |
1495 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) | 1372 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) |
@@ -1635,7 +1512,7 @@ struct pci_dev *pci_get_dma_source(struct pci_dev *dev); | |||
1635 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); | 1512 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); |
1636 | #else | 1513 | #else |
1637 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | 1514 | static inline void pci_fixup_device(enum pci_fixup_pass pass, |
1638 | struct pci_dev *dev) {} | 1515 | struct pci_dev *dev) { } |
1639 | static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev) | 1516 | static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev) |
1640 | { | 1517 | { |
1641 | return pci_dev_get(dev); | 1518 | return pci_dev_get(dev); |
@@ -1707,32 +1584,17 @@ int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); | |||
1707 | int pci_sriov_get_totalvfs(struct pci_dev *dev); | 1584 | int pci_sriov_get_totalvfs(struct pci_dev *dev); |
1708 | #else | 1585 | #else |
1709 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1586 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
1710 | { | 1587 | { return -ENODEV; } |
1711 | return -ENODEV; | 1588 | static inline void pci_disable_sriov(struct pci_dev *dev) { } |
1712 | } | ||
1713 | static inline void pci_disable_sriov(struct pci_dev *dev) | ||
1714 | { | ||
1715 | } | ||
1716 | static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev) | 1589 | static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev) |
1717 | { | 1590 | { return IRQ_NONE; } |
1718 | return IRQ_NONE; | 1591 | static inline int pci_num_vf(struct pci_dev *dev) { return 0; } |
1719 | } | ||
1720 | static inline int pci_num_vf(struct pci_dev *dev) | ||
1721 | { | ||
1722 | return 0; | ||
1723 | } | ||
1724 | static inline int pci_vfs_assigned(struct pci_dev *dev) | 1592 | static inline int pci_vfs_assigned(struct pci_dev *dev) |
1725 | { | 1593 | { return 0; } |
1726 | return 0; | ||
1727 | } | ||
1728 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) | 1594 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) |
1729 | { | 1595 | { return 0; } |
1730 | return 0; | ||
1731 | } | ||
1732 | static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) | 1596 | static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) |
1733 | { | 1597 | { return 0; } |
1734 | return 0; | ||
1735 | } | ||
1736 | #endif | 1598 | #endif |
1737 | 1599 | ||
1738 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | 1600 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) |