mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-18 06:15:12 +00:00
PCI: Track the size of each saved capability data area
This will allow us to store and load it later. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
9f728f53dd
commit
24a4742f0b
@ -830,7 +830,7 @@ static int pci_save_pcie_state(struct pci_dev *dev)
|
|||||||
dev_err(&dev->dev, "buffer not found in %s\n", __func__);
|
dev_err(&dev->dev, "buffer not found in %s\n", __func__);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
cap = (u16 *)&save_state->data[0];
|
cap = (u16 *)&save_state->cap.data[0];
|
||||||
|
|
||||||
pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
|
pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ static void pci_restore_pcie_state(struct pci_dev *dev)
|
|||||||
pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
|
pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
|
||||||
if (!save_state || pos <= 0)
|
if (!save_state || pos <= 0)
|
||||||
return;
|
return;
|
||||||
cap = (u16 *)&save_state->data[0];
|
cap = (u16 *)&save_state->cap.data[0];
|
||||||
|
|
||||||
pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
|
pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
|
||||||
|
|
||||||
@ -899,7 +899,8 @@ static int pci_save_pcix_state(struct pci_dev *dev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_read_config_word(dev, pos + PCI_X_CMD, (u16 *)save_state->data);
|
pci_read_config_word(dev, pos + PCI_X_CMD,
|
||||||
|
(u16 *)save_state->cap.data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -914,7 +915,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
|
|||||||
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
|
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
|
||||||
if (!save_state || pos <= 0)
|
if (!save_state || pos <= 0)
|
||||||
return;
|
return;
|
||||||
cap = (u16 *)&save_state->data[0];
|
cap = (u16 *)&save_state->cap.data[0];
|
||||||
|
|
||||||
pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
|
pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
|
||||||
}
|
}
|
||||||
@ -1771,7 +1772,8 @@ static int pci_add_cap_save_buffer(
|
|||||||
if (!save_state)
|
if (!save_state)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
save_state->cap_nr = cap;
|
save_state->cap.cap_nr = cap;
|
||||||
|
save_state->cap.size = size;
|
||||||
pci_add_saved_cap(dev, save_state);
|
pci_add_saved_cap(dev, save_state);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -214,10 +214,15 @@ enum pci_bus_speed {
|
|||||||
PCI_SPEED_UNKNOWN = 0xff,
|
PCI_SPEED_UNKNOWN = 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct pci_cap_saved_data {
|
||||||
|
char cap_nr;
|
||||||
|
unsigned int size;
|
||||||
|
u32 data[0];
|
||||||
|
};
|
||||||
|
|
||||||
struct pci_cap_saved_state {
|
struct pci_cap_saved_state {
|
||||||
struct hlist_node next;
|
struct hlist_node next;
|
||||||
char cap_nr;
|
struct pci_cap_saved_data cap;
|
||||||
u32 data[0];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pcie_link_state;
|
struct pcie_link_state;
|
||||||
@ -366,7 +371,7 @@ static inline struct pci_cap_saved_state *pci_find_saved_cap(
|
|||||||
struct hlist_node *pos;
|
struct hlist_node *pos;
|
||||||
|
|
||||||
hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
|
hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
|
||||||
if (tmp->cap_nr == cap)
|
if (tmp->cap.cap_nr == cap)
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user