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.h93
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
217struct pci_cap_saved_state { 217struct 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
223struct pci_cap_saved_state {
224 struct hlist_node next;
225 struct pci_cap_saved_data cap;
226};
227
223struct pcie_link_state; 228struct pcie_link_state;
224struct pci_vpd; 229struct pci_vpd;
225struct pci_sriov; 230struct 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 {
541struct module; 546struct module;
542struct pci_driver { 547struct 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 */
808int pci_save_state(struct pci_dev *dev); 813int pci_save_state(struct pci_dev *dev);
809int pci_restore_state(struct pci_dev *dev); 814void pci_restore_state(struct pci_dev *dev);
815struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev);
816int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state);
817int pci_load_and_free_saved_state(struct pci_dev *dev,
818 struct pci_saved_state **state);
810int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); 819int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
811int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 820int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
812pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 821pci_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);
819int pci_prepare_to_sleep(struct pci_dev *dev); 828int pci_prepare_to_sleep(struct pci_dev *dev);
820int pci_back_from_sleep(struct pci_dev *dev); 829int pci_back_from_sleep(struct pci_dev *dev);
821bool pci_dev_run_wake(struct pci_dev *dev); 830bool pci_dev_run_wake(struct pci_dev *dev);
831bool pci_check_pme_status(struct pci_dev *dev);
832void pci_pme_wakeup_bus(struct pci_bus *bus);
822 833
823static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 834static 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)
842void pci_enable_ido(struct pci_dev *dev, unsigned long type);
843void pci_disable_ido(struct pci_dev *dev, unsigned long type);
844
845enum pci_obff_signal_type {
846 PCI_EXP_OBFF_SIGNAL_L0,
847 PCI_EXP_OBFF_SIGNAL_ALWAYS,
848};
849int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
850void pci_disable_obff(struct pci_dev *dev);
851
852bool pci_ltr_supported(struct pci_dev *dev);
853int pci_enable_ltr(struct pci_dev *dev);
854void pci_disable_ltr(struct pci_dev *dev);
855int 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 */
830void set_pcie_port_type(struct pci_dev *pdev); 858void set_pcie_port_type(struct pci_dev *pdev);
831void set_pcie_hotplug_bridge(struct pci_dev *pdev); 859void set_pcie_hotplug_bridge(struct pci_dev *pdev);
@@ -913,8 +941,11 @@ int pci_cfg_space_size_ext(struct pci_dev *dev);
913int pci_cfg_space_size(struct pci_dev *dev); 941int pci_cfg_space_size(struct pci_dev *dev);
914unsigned char pci_bus_max_busnr(struct pci_bus *bus); 942unsigned 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
916int pci_set_vga_state(struct pci_dev *pdev, bool decode, 947int 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);
991extern int pci_msi_enabled(void); 1022extern int pci_msi_enabled(void);
992#endif 1023#endif
993 1024
1025#ifdef CONFIG_PCIEPORTBUS
1026extern bool pcie_ports_disabled;
1027extern 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
995static inline int pcie_aspm_enabled(void) 1034static inline int pcie_aspm_enabled(void) { return 0; }
996{ 1035static inline bool pcie_aspm_support_enabled(void) { return false; }
997 return 0;
998}
999#else 1036#else
1000extern int pcie_aspm_enabled(void); 1037extern int pcie_aspm_enabled(void);
1038extern bool pcie_aspm_support_enabled(void);
1039#endif
1040
1041#ifdef CONFIG_PCIEAER
1042void pci_no_aer(void);
1043bool pci_aer_available(void);
1044#else
1045static inline void pci_no_aer(void) { }
1046static 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 */
1046typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1092typedef 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);
1048extern void pci_register_set_vga_state(arch_set_vga_state_t func); 1094extern 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
1168static inline int pci_restore_state(struct pci_dev *dev) 1214static inline void pci_restore_state(struct pci_dev *dev)
1215{ }
1216
1217static 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
1173static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) 1222static 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
1239static inline void pci_enable_ido(struct pci_dev *dev, unsigned long type)
1240{
1241}
1242
1243static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type)
1244{
1245}
1246
1247static inline int pci_enable_obff(struct pci_dev *dev, unsigned long type)
1248{
1249 return 0;
1250}
1251
1252static inline void pci_disable_obff(struct pci_dev *dev)
1253{
1254}
1255
1190static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) 1256static 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