mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[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>
This commit is contained in:
parent
f043ca43c1
commit
41017f0cac
4 changed files with 246 additions and 29 deletions
|
@ -100,6 +100,12 @@ enum pci_bus_flags {
|
|||
PCI_BUS_FLAGS_NO_MSI = (pci_bus_flags_t) 1,
|
||||
};
|
||||
|
||||
struct pci_cap_saved_state {
|
||||
struct hlist_node next;
|
||||
char cap_nr;
|
||||
u32 data[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* The pci_dev structure is used to describe PCI devices.
|
||||
*/
|
||||
|
@ -159,6 +165,7 @@ struct pci_dev {
|
|||
unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
|
||||
|
||||
u32 saved_config_space[16]; /* config space saved at suspend time */
|
||||
struct hlist_head saved_cap_space;
|
||||
struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
|
||||
int rom_attr_enabled; /* has display of the rom attribute been enabled? */
|
||||
struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
|
||||
|
@ -169,6 +176,30 @@ struct pci_dev {
|
|||
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
|
||||
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
|
||||
|
||||
static inline struct pci_cap_saved_state *pci_find_saved_cap(
|
||||
struct pci_dev *pci_dev,char cap)
|
||||
{
|
||||
struct pci_cap_saved_state *tmp;
|
||||
struct hlist_node *pos;
|
||||
|
||||
hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
|
||||
if (tmp->cap_nr == cap)
|
||||
return tmp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
|
||||
struct pci_cap_saved_state *new_cap)
|
||||
{
|
||||
hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
|
||||
}
|
||||
|
||||
static inline void pci_remove_saved_cap(struct pci_cap_saved_state *cap)
|
||||
{
|
||||
hlist_del(&cap->next);
|
||||
}
|
||||
|
||||
/*
|
||||
* For PCI devices, the region numbers are assigned this way:
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue