pciehp: block new requests from the device before power off
Disable Bus Master, SERR# and INTx to ensure that no new Requests will be generated from the device before turning power off, in accordance with the specification. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
f1050a35cd
commit
2326e2b999
|
@ -243,9 +243,13 @@ int pciehp_unconfigure_device(struct slot *p_slot)
|
||||||
u8 bctl = 0;
|
u8 bctl = 0;
|
||||||
u8 presence = 0;
|
u8 presence = 0;
|
||||||
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
|
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
|
||||||
|
u16 command;
|
||||||
|
|
||||||
dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus,
|
dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus,
|
||||||
p_slot->device);
|
p_slot->device);
|
||||||
|
ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence);
|
||||||
|
if (ret)
|
||||||
|
presence = 0;
|
||||||
|
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
struct pci_dev* temp = pci_get_slot(parent,
|
struct pci_dev* temp = pci_get_slot(parent,
|
||||||
|
@ -258,21 +262,26 @@ int pciehp_unconfigure_device(struct slot *p_slot)
|
||||||
pci_dev_put(temp);
|
pci_dev_put(temp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
|
if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) {
|
||||||
ret = p_slot->hpc_ops->get_adapter_status(p_slot,
|
pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl);
|
||||||
&presence);
|
if (bctl & PCI_BRIDGE_CTL_VGA) {
|
||||||
if (!ret && presence) {
|
err("Cannot remove display device %s\n",
|
||||||
pci_read_config_byte(temp, PCI_BRIDGE_CONTROL,
|
pci_name(temp));
|
||||||
&bctl);
|
pci_dev_put(temp);
|
||||||
if (bctl & PCI_BRIDGE_CTL_VGA) {
|
continue;
|
||||||
err("Cannot remove display device %s\n",
|
|
||||||
pci_name(temp));
|
|
||||||
pci_dev_put(temp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pci_remove_bus_device(temp);
|
pci_remove_bus_device(temp);
|
||||||
|
/*
|
||||||
|
* Ensure that no new Requests will be generated from
|
||||||
|
* the device.
|
||||||
|
*/
|
||||||
|
if (presence) {
|
||||||
|
pci_read_config_word(temp, PCI_COMMAND, &command);
|
||||||
|
command &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_SERR);
|
||||||
|
command |= PCI_COMMAND_INTX_DISABLE;
|
||||||
|
pci_write_config_word(temp, PCI_COMMAND, command);
|
||||||
|
}
|
||||||
pci_dev_put(temp);
|
pci_dev_put(temp);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue