Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127335
b: refs/heads/master
c: 1ca8879
h: refs/heads/master
i:
  127333: 3f5625a
  127331: adb068d
  127327: 63cc816
v: v3
  • Loading branch information
Sheng Yang authored and Jesse Barnes committed Jan 7, 2009
1 parent 1b9bd6e commit 9206c7a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f7b7baae6b30ff04124259ff8d7c0c0d281320e6
refs/heads/master: 1ca887970a3971a22e4875b7c6ad5ae3ce49f61a
41 changes: 41 additions & 0 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,43 @@ static int __pcie_flr(struct pci_dev *dev, int probe)
return 0;
}

static int __pci_af_flr(struct pci_dev *dev, int probe)
{
int cappos = pci_find_capability(dev, PCI_CAP_ID_AF);
u8 status;
u8 cap;

if (!cappos)
return -ENOTTY;
pci_read_config_byte(dev, cappos + PCI_AF_CAP, &cap);
if (!(cap & PCI_AF_CAP_TP) || !(cap & PCI_AF_CAP_FLR))
return -ENOTTY;

if (probe)
return 0;

pci_block_user_cfg_access(dev);

/* Wait for Transaction Pending bit clean */
msleep(100);
pci_read_config_byte(dev, cappos + PCI_AF_STATUS, &status);
if (status & PCI_AF_STATUS_TP) {
dev_info(&dev->dev, "Busy after 100ms while trying to"
" reset; sleeping for 1 second\n");
ssleep(1);
pci_read_config_byte(dev,
cappos + PCI_AF_STATUS, &status);
if (status & PCI_AF_STATUS_TP)
dev_info(&dev->dev, "Still busy after 1s; "
"proceeding with reset anyway\n");
}
pci_write_config_byte(dev, cappos + PCI_AF_CTRL, PCI_AF_CTRL_FLR);
mdelay(100);

pci_unblock_user_cfg_access(dev);
return 0;
}

static int __pci_reset_function(struct pci_dev *pdev, int probe)
{
int res;
Expand All @@ -1797,6 +1834,10 @@ static int __pci_reset_function(struct pci_dev *pdev, int probe)
if (res != -ENOTTY)
return res;

res = __pci_af_flr(pdev, probe);
if (res != -ENOTTY)
return res;

return res;
}

Expand Down

0 comments on commit 9206c7a

Please sign in to comment.