diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2016-10-02 18:56:06 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2016-10-02 18:56:06 +0000 |
commit | 616f8261d7da32ac011308482010a88178e31f35 (patch) | |
tree | 549535777014a7af636054ace6017ba17f73d39a /sys | |
parent | 87cdd56fac41122d4371664f09e2b9729eaba3e7 (diff) |
Some HABs reset parts of AHCI_PREG_CMD when AHCI_PREG_SCTL_DET_INIT
gets set. Therefore, ahci_port_softreset() restores the sate of the
former register once the device detection sequence is finished. The
device detection code in ahci_pmp_port_portreset() does not restore
AHCI_PREG_CMD afterwards, so let it catch up. Apparently, this part
was an oversight as ahci_pmp_port_portreset() did not otherwise use
"cmd".
From Marius Strobl
tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7)
ok jmatthew@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ahci.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index 8fa7e0b9cc7..d600f3eff3a 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.27 2016/10/02 18:54:02 patrick Exp $ */ +/* $OpenBSD: ahci.c,v 1.28 2016/10/02 18:56:05 patrick Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -1313,6 +1313,7 @@ ahci_pmp_port_portreset(struct ahci_port *ap, int pmp_port) DPRINTF(AHCI_D_VERBOSE, "%s.%d: PMP port reset\n", PORTNAME(ap), pmp_port); + /* Save previous command register state */ cmd = ahci_pread(ap, AHCI_PREG_CMD) & ~AHCI_PREG_CMD_ICC; /* turn off power management and disable the PHY */ @@ -1390,6 +1391,8 @@ ahci_pmp_port_portreset(struct ahci_port *ap, int pmp_port) rc = 0; err: + /* Restore preserved port state */ + ahci_pwrite(ap, AHCI_PREG_CMD, cmd); splx(s); return (rc); } |