aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2006-02-08 04:11:38 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-04-14 15:25:25 -0400
commit41017f0cac925e4a6bcf3359b75e5538112d4216 (patch)
tree5c8f4590707450820ffb286f681bcaeb300cde84 /include/linux/pci.h
parentf043ca43c1ae354346f72dc5826d820d5619f0b2 (diff)
[PATCH] PCI: MSI(X) save/restore for suspend/resume
Add MSI(X) configure sapce save/restore in generic PCI helper. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0aad5a378e95..15e1675edef9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -100,6 +100,12 @@ enum pci_bus_flags {
100 PCI_BUS_FLAGS_NO_MSI = (pci_bus_flags_t) 1, 100 PCI_BUS_FLAGS_NO_MSI = (pci_bus_flags_t) 1,
101}; 101};
102 102
103struct pci_cap_saved_state {
104 struct hlist_node next;
105 char cap_nr;
106 u32 data[0];
107};
108
103/* 109/*
104 * The pci_dev structure is used to describe PCI devices. 110 * The pci_dev structure is used to describe PCI devices.
105 */ 111 */
@@ -159,6 +165,7 @@ struct pci_dev {
159 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 165 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
160 166
161 u32 saved_config_space[16]; /* config space saved at suspend time */ 167 u32 saved_config_space[16]; /* config space saved at suspend time */
168 struct hlist_head saved_cap_space;
162 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 169 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
163 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 170 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
164 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 171 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
@@ -169,6 +176,30 @@ struct pci_dev {
169#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 176#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
170#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 177#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
171 178
179static inline struct pci_cap_saved_state *pci_find_saved_cap(
180 struct pci_dev *pci_dev,char cap)
181{
182 struct pci_cap_saved_state *tmp;
183 struct hlist_node *pos;
184
185 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
186 if (tmp->cap_nr == cap)
187 return tmp;
188 }
189 return NULL;
190}
191
192static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
193 struct pci_cap_saved_state *new_cap)
194{
195 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
196}
197
198static inline void pci_remove_saved_cap(struct pci_cap_saved_state *cap)
199{
200 hlist_del(&cap->next);
201}
202
172/* 203/*
173 * For PCI devices, the region numbers are assigned this way: 204 * For PCI devices, the region numbers are assigned this way:
174 * 205 *