diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 93 |
1 files changed, 80 insertions, 13 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index c8d95e369ff4..c446b5ca2d38 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -214,12 +214,17 @@ enum pci_bus_speed { | |||
214 | PCI_SPEED_UNKNOWN = 0xff, | 214 | PCI_SPEED_UNKNOWN = 0xff, |
215 | }; | 215 | }; |
216 | 216 | ||
217 | struct pci_cap_saved_state { | 217 | struct pci_cap_saved_data { |
218 | struct hlist_node next; | ||
219 | char cap_nr; | 218 | char cap_nr; |
219 | unsigned int size; | ||
220 | u32 data[0]; | 220 | u32 data[0]; |
221 | }; | 221 | }; |
222 | 222 | ||
223 | struct pci_cap_saved_state { | ||
224 | struct hlist_node next; | ||
225 | struct pci_cap_saved_data cap; | ||
226 | }; | ||
227 | |||
223 | struct pcie_link_state; | 228 | struct pcie_link_state; |
224 | struct pci_vpd; | 229 | struct pci_vpd; |
225 | struct pci_sriov; | 230 | struct pci_sriov; |
@@ -366,7 +371,7 @@ static inline struct pci_cap_saved_state *pci_find_saved_cap( | |||
366 | struct hlist_node *pos; | 371 | struct hlist_node *pos; |
367 | 372 | ||
368 | hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { | 373 | hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { |
369 | if (tmp->cap_nr == cap) | 374 | if (tmp->cap.cap_nr == cap) |
370 | return tmp; | 375 | return tmp; |
371 | } | 376 | } |
372 | return NULL; | 377 | return NULL; |
@@ -541,7 +546,7 @@ struct pci_error_handlers { | |||
541 | struct module; | 546 | struct module; |
542 | struct pci_driver { | 547 | struct pci_driver { |
543 | struct list_head node; | 548 | struct list_head node; |
544 | char *name; | 549 | const char *name; |
545 | const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */ | 550 | const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */ |
546 | int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ | 551 | int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ |
547 | void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ | 552 | void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ |
@@ -806,7 +811,11 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); | |||
806 | 811 | ||
807 | /* Power management related routines */ | 812 | /* Power management related routines */ |
808 | int pci_save_state(struct pci_dev *dev); | 813 | int pci_save_state(struct pci_dev *dev); |
809 | int pci_restore_state(struct pci_dev *dev); | 814 | void pci_restore_state(struct pci_dev *dev); |
815 | struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); | ||
816 | int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state); | ||
817 | int pci_load_and_free_saved_state(struct pci_dev *dev, | ||
818 | struct pci_saved_state **state); | ||
810 | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); | 819 | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); |
811 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 820 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
812 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 821 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
@@ -819,6 +828,8 @@ pci_power_t pci_target_state(struct pci_dev *dev); | |||
819 | int pci_prepare_to_sleep(struct pci_dev *dev); | 828 | int pci_prepare_to_sleep(struct pci_dev *dev); |
820 | int pci_back_from_sleep(struct pci_dev *dev); | 829 | int pci_back_from_sleep(struct pci_dev *dev); |
821 | bool pci_dev_run_wake(struct pci_dev *dev); | 830 | bool pci_dev_run_wake(struct pci_dev *dev); |
831 | bool pci_check_pme_status(struct pci_dev *dev); | ||
832 | void pci_pme_wakeup_bus(struct pci_bus *bus); | ||
822 | 833 | ||
823 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | 834 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
824 | bool enable) | 835 | bool enable) |
@@ -826,6 +837,23 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | |||
826 | return __pci_enable_wake(dev, state, false, enable); | 837 | return __pci_enable_wake(dev, state, false, enable); |
827 | } | 838 | } |
828 | 839 | ||
840 | #define PCI_EXP_IDO_REQUEST (1<<0) | ||
841 | #define PCI_EXP_IDO_COMPLETION (1<<1) | ||
842 | void pci_enable_ido(struct pci_dev *dev, unsigned long type); | ||
843 | void pci_disable_ido(struct pci_dev *dev, unsigned long type); | ||
844 | |||
845 | enum pci_obff_signal_type { | ||
846 | PCI_EXP_OBFF_SIGNAL_L0, | ||
847 | PCI_EXP_OBFF_SIGNAL_ALWAYS, | ||
848 | }; | ||
849 | int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); | ||
850 | void pci_disable_obff(struct pci_dev *dev); | ||
851 | |||
852 | bool pci_ltr_supported(struct pci_dev *dev); | ||
853 | int pci_enable_ltr(struct pci_dev *dev); | ||
854 | void pci_disable_ltr(struct pci_dev *dev); | ||
855 | int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); | ||
856 | |||
829 | /* For use by arch with custom probe code */ | 857 | /* For use by arch with custom probe code */ |
830 | void set_pcie_port_type(struct pci_dev *pdev); | 858 | void set_pcie_port_type(struct pci_dev *pdev); |
831 | void set_pcie_hotplug_bridge(struct pci_dev *pdev); | 859 | void set_pcie_hotplug_bridge(struct pci_dev *pdev); |
@@ -913,8 +941,11 @@ int pci_cfg_space_size_ext(struct pci_dev *dev); | |||
913 | int pci_cfg_space_size(struct pci_dev *dev); | 941 | int pci_cfg_space_size(struct pci_dev *dev); |
914 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); | 942 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); |
915 | 943 | ||
944 | #define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) | ||
945 | #define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) | ||
946 | |||
916 | int pci_set_vga_state(struct pci_dev *pdev, bool decode, | 947 | int pci_set_vga_state(struct pci_dev *pdev, bool decode, |
917 | unsigned int command_bits, bool change_bridge); | 948 | unsigned int command_bits, u32 flags); |
918 | /* kmem_cache style wrapper around pci_alloc_consistent() */ | 949 | /* kmem_cache style wrapper around pci_alloc_consistent() */ |
919 | 950 | ||
920 | #include <linux/pci-dma.h> | 951 | #include <linux/pci-dma.h> |
@@ -991,13 +1022,28 @@ extern void pci_restore_msi_state(struct pci_dev *dev); | |||
991 | extern int pci_msi_enabled(void); | 1022 | extern int pci_msi_enabled(void); |
992 | #endif | 1023 | #endif |
993 | 1024 | ||
1025 | #ifdef CONFIG_PCIEPORTBUS | ||
1026 | extern bool pcie_ports_disabled; | ||
1027 | extern bool pcie_ports_auto; | ||
1028 | #else | ||
1029 | #define pcie_ports_disabled true | ||
1030 | #define pcie_ports_auto false | ||
1031 | #endif | ||
1032 | |||
994 | #ifndef CONFIG_PCIEASPM | 1033 | #ifndef CONFIG_PCIEASPM |
995 | static inline int pcie_aspm_enabled(void) | 1034 | static inline int pcie_aspm_enabled(void) { return 0; } |
996 | { | 1035 | static inline bool pcie_aspm_support_enabled(void) { return false; } |
997 | return 0; | ||
998 | } | ||
999 | #else | 1036 | #else |
1000 | extern int pcie_aspm_enabled(void); | 1037 | extern int pcie_aspm_enabled(void); |
1038 | extern bool pcie_aspm_support_enabled(void); | ||
1039 | #endif | ||
1040 | |||
1041 | #ifdef CONFIG_PCIEAER | ||
1042 | void pci_no_aer(void); | ||
1043 | bool pci_aer_available(void); | ||
1044 | #else | ||
1045 | static inline void pci_no_aer(void) { } | ||
1046 | static inline bool pci_aer_available(void) { return false; } | ||
1001 | #endif | 1047 | #endif |
1002 | 1048 | ||
1003 | #ifndef CONFIG_PCIE_ECRC | 1049 | #ifndef CONFIG_PCIE_ECRC |
@@ -1044,7 +1090,7 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
1044 | 1090 | ||
1045 | /* some architectures require additional setup to direct VGA traffic */ | 1091 | /* some architectures require additional setup to direct VGA traffic */ |
1046 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, | 1092 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, |
1047 | unsigned int command_bits, bool change_bridge); | 1093 | unsigned int command_bits, u32 flags); |
1048 | extern void pci_register_set_vga_state(arch_set_vga_state_t func); | 1094 | extern void pci_register_set_vga_state(arch_set_vga_state_t func); |
1049 | 1095 | ||
1050 | #else /* CONFIG_PCI is not enabled */ | 1096 | #else /* CONFIG_PCI is not enabled */ |
@@ -1165,12 +1211,15 @@ static inline int pci_save_state(struct pci_dev *dev) | |||
1165 | return 0; | 1211 | return 0; |
1166 | } | 1212 | } |
1167 | 1213 | ||
1168 | static inline int pci_restore_state(struct pci_dev *dev) | 1214 | static inline void pci_restore_state(struct pci_dev *dev) |
1215 | { } | ||
1216 | |||
1217 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) | ||
1169 | { | 1218 | { |
1170 | return 0; | 1219 | return 0; |
1171 | } | 1220 | } |
1172 | 1221 | ||
1173 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 1222 | static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable) |
1174 | { | 1223 | { |
1175 | return 0; | 1224 | return 0; |
1176 | } | 1225 | } |
@@ -1187,6 +1236,23 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | |||
1187 | return 0; | 1236 | return 0; |
1188 | } | 1237 | } |
1189 | 1238 | ||
1239 | static inline void pci_enable_ido(struct pci_dev *dev, unsigned long type) | ||
1240 | { | ||
1241 | } | ||
1242 | |||
1243 | static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type) | ||
1244 | { | ||
1245 | } | ||
1246 | |||
1247 | static inline int pci_enable_obff(struct pci_dev *dev, unsigned long type) | ||
1248 | { | ||
1249 | return 0; | ||
1250 | } | ||
1251 | |||
1252 | static inline void pci_disable_obff(struct pci_dev *dev) | ||
1253 | { | ||
1254 | } | ||
1255 | |||
1190 | static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) | 1256 | static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) |
1191 | { | 1257 | { |
1192 | return -EIO; | 1258 | return -EIO; |
@@ -1463,6 +1529,7 @@ void pci_request_acs(void); | |||
1463 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" | 1529 | #define PCI_VPD_RO_KEYWORD_PARTNO "PN" |
1464 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" | 1530 | #define PCI_VPD_RO_KEYWORD_MFR_ID "MN" |
1465 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" | 1531 | #define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" |
1532 | #define PCI_VPD_RO_KEYWORD_CHKSUM "RV" | ||
1466 | 1533 | ||
1467 | /** | 1534 | /** |
1468 | * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length | 1535 | * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length |