Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82349
b: refs/heads/master
c: f1050a3
h: refs/heads/master
i:
  82347: 1d1d889
v: v3
  • Loading branch information
Kenji Kaneshige authored and Greg Kroah-Hartman committed Feb 1, 2008
1 parent 9369121 commit 4621868
Show file tree
Hide file tree
Showing 2 changed files with 46 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: 8bb7c7af1ff2a9e9e0936dbdd15901c80329c7af
refs/heads/master: f1050a35cd99d6cfded7ce1273757dca84e92f9b
45 changes: 45 additions & 0 deletions trunk/drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,15 +636,57 @@ static int hpc_power_on_slot(struct slot * slot)
return retval;
}

static inline int pcie_mask_bad_dllp(struct controller *ctrl)
{
struct pci_dev *dev = ctrl->pci_dev;
int pos;
u32 reg;

pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
if (!pos)
return 0;
pci_read_config_dword(dev, pos + PCI_ERR_COR_MASK, &reg);
if (reg & PCI_ERR_COR_BAD_DLLP)
return 0;
reg |= PCI_ERR_COR_BAD_DLLP;
pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg);
return 1;
}

static inline void pcie_unmask_bad_dllp(struct controller *ctrl)
{
struct pci_dev *dev = ctrl->pci_dev;
u32 reg;
int pos;

pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
if (!pos)
return;
pci_read_config_dword(dev, pos + PCI_ERR_COR_MASK, &reg);
if (!(reg & PCI_ERR_COR_BAD_DLLP))
return;
reg &= ~PCI_ERR_COR_BAD_DLLP;
pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg);
}

static int hpc_power_off_slot(struct slot * slot)
{
struct controller *ctrl = slot->ctrl;
u16 slot_cmd;
u16 cmd_mask;
int retval = 0;
int changed;

dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot);

/*
* Set Bad DLLP Mask bit in Correctable Error Mask
* Register. This is the workaround against Bad DLLP error
* that sometimes happens during turning power off the slot
* which conforms to PCI Express 1.0a spec.
*/
changed = pcie_mask_bad_dllp(ctrl);

slot_cmd = POWER_OFF;
cmd_mask = PWR_CTRL;
/*
Expand Down Expand Up @@ -681,6 +723,9 @@ static int hpc_power_off_slot(struct slot * slot)
*/
msleep(1000);

if (changed)
pcie_unmask_bad_dllp(ctrl);

return retval;
}

Expand Down

0 comments on commit 4621868

Please sign in to comment.