|
Lines 932-937
pcib_probe_hotplug(struct pcib_softc *sc)
Link Here
|
| 932 |
|
932 |
|
| 933 |
sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4); |
933 |
sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4); |
| 934 |
sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4); |
934 |
sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4); |
|
|
935 |
sc->pcie_slot_ctl = pcie_read_config(dev, PCIER_SLOT_CTL, 2); |
| 935 |
|
936 |
|
| 936 |
if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0) |
937 |
if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0) |
| 937 |
return; |
938 |
return; |
|
Lines 977-989
pcib_pcie_hotplug_command(struct pcib_softc *sc, uint16_t val, uint16_t mask)
Link Here
|
| 977 |
if (sc->flags & PCIB_HOTPLUG_CMD_PENDING) |
978 |
if (sc->flags & PCIB_HOTPLUG_CMD_PENDING) |
| 978 |
return; |
979 |
return; |
| 979 |
|
980 |
|
| 980 |
ctl = pcie_read_config(dev, PCIER_SLOT_CTL, 2); |
981 |
/* |
|
|
982 |
* A read from the PCIEM_SLOT_CTL_PCC bit should return |
| 983 |
* the last value written; however, some chips behave differently, |
| 984 |
* apparently returning the actual power state. Save the last value |
| 985 |
* written and use that saved value in the following logic. |
| 986 |
*/ |
| 987 |
ctl = sc->pcie_slot_ctl; |
| 981 |
new = (ctl & ~mask) | val; |
988 |
new = (ctl & ~mask) | val; |
| 982 |
if (new == ctl) |
989 |
if (new == ctl) |
| 983 |
return; |
990 |
return; |
| 984 |
if (bootverbose) |
991 |
if (bootverbose) |
| 985 |
device_printf(dev, "HotPlug command: %04x -> %04x\n", ctl, new); |
992 |
device_printf(dev, "HotPlug command: %04x -> %04x\n", ctl, new); |
| 986 |
pcie_write_config(dev, PCIER_SLOT_CTL, new, 2); |
993 |
pcie_write_config(dev, PCIER_SLOT_CTL, new, 2); |
|
|
994 |
sc->pcie_slot_ctl = new; |
| 987 |
if (!(sc->pcie_slot_cap & PCIEM_SLOT_CAP_NCCS) && |
995 |
if (!(sc->pcie_slot_cap & PCIEM_SLOT_CAP_NCCS) && |
| 988 |
(ctl & new) & PCIEM_SLOT_CTL_CCIE) { |
996 |
(ctl & new) & PCIEM_SLOT_CTL_CCIE) { |
| 989 |
sc->flags |= PCIB_HOTPLUG_CMD_PENDING; |
997 |
sc->flags |= PCIB_HOTPLUG_CMD_PENDING; |