Skip to content

Commit

Permalink
PCI: read-modify-write the pcie device control register when initiati…
Browse files Browse the repository at this point in the history
…ng pcie flr

The pcie_flr routine writes the device control register with the FLR bit
set clearing all other fields for the FLR duration. Among other fields,
the Max_Payload_Size is also cleared which can cause errors if there are
transactions lurking in the HW pipeline. The patch replaces the blank
write with read-modify-write of the control register keeping the other
fields intact.

Signed-off-by: Shmulik Ravid <shmulikr@broadcom.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Shmulik Ravid authored and Jesse Barnes committed Dec 4, 2009
1 parent bb96540 commit 04b55c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,7 @@ static int pcie_flr(struct pci_dev *dev, int probe)
int i;
int pos;
u32 cap;
u16 status;
u16 status, control;

pos = pci_pcie_cap(dev);
if (!pos)
Expand All @@ -2167,8 +2167,10 @@ static int pcie_flr(struct pci_dev *dev, int probe)
"proceeding with reset anyway\n");

clear:
pci_write_config_word(dev, pos + PCI_EXP_DEVCTL,
PCI_EXP_DEVCTL_BCR_FLR);
pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &control);
control |= PCI_EXP_DEVCTL_BCR_FLR;
pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, control);

msleep(100);

return 0;
Expand Down

0 comments on commit 04b55c4

Please sign in to comment.