summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ahci.c
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2012-08-11 13:52:28 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2012-08-11 13:52:28 +0000
commit2e49cf9ee092305431f3a467f58d33a0ed2878dd (patch)
tree0bedef8427def17ccca27fee9c5ac2ddf1ea68db /sys/dev/pci/ahci.c
parentf167b8bb20b7e9b16231ca82eb4bd53f59eacd5c (diff)
Fix state tracking for the error ccb, and pay attention when the READ_LOG_EXT
command used in ncq error recovery fails. Fixes 'ccb->ccb_xa.state == ATA_S_ONCHIP' assertion failures when talking to dying disks. broken disk supplied by Aidan Rowe ok dlg@
Diffstat (limited to 'sys/dev/pci/ahci.c')
-rw-r--r--sys/dev/pci/ahci.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index 2fcb7d22e17..7bda90956ce 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.192 2012/07/02 13:24:53 jmatthew Exp $ */
+/* $OpenBSD: ahci.c,v 1.193 2012/08/11 13:52:27 jmatthew Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -3088,6 +3088,7 @@ ahci_get_err_ccb(struct ahci_port *ap)
*/
err_ccb = ap->ap_ccb_err;
err_ccb->ccb_xa.flags = 0;
+ err_ccb->ccb_xa.state = ATA_S_SETUP;
err_ccb->ccb_done = ahci_empty_done;
return (err_ccb);
@@ -3225,7 +3226,8 @@ ahci_port_read_ncq_error(struct ahci_port *ap, int *err_slotp, int pmp_port)
}
ccb->ccb_xa.state = ATA_S_PENDING;
- if (ahci_poll(ccb, 1000, NULL) != 0)
+ if (ahci_poll(ccb, 1000, NULL) != 0 ||
+ ccb->ccb_xa.state == ATA_S_ERROR)
goto err;
rc = 0;
@@ -3620,7 +3622,8 @@ ret:
void
ahci_empty_done(struct ahci_ccb *ccb)
{
- ccb->ccb_xa.state = ATA_S_COMPLETE;
+ if (ccb->ccb_xa.state != ATA_S_ERROR)
+ ccb->ccb_xa.state = ATA_S_COMPLETE;
}
int