summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-10-02 18:53:29 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-10-02 18:53:29 +0000
commit215615798f244b35152e5e0839f6c12dd6d61bb2 (patch)
treec0ec02276da712113bab2d710d65cf9bd7c7aec4 /sys/dev/ic
parent1fd447882b95ebf3b29bca73039223b116c4db2d (diff)
Given that ahci_port_alloc() grabs one CCB for use during NCQ error
recovery from the CCB pool sized based on the NCS capability, i. e. number of command slots reported by the controller, it is necessary to pretend at least 2 slots in sc->sc_ncmds for devices without NCQ support. That way, also at least 1 available slot is made available for atascsi(4). Otherwise, controllers having only a single command slot will trigger "no free xfers on a new port" in atascsi(4). Note that pretending 2 command slots is also fine with the abuse of the NCQ error recovery CCB in ahci_port_softreset(). From Marius Strobl tested by awolk (amd64), bluhm (amd64, i386), myself (amd64, armv7) ok jmatthew@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/ahci.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c
index 1026e1e9046..9f0708f898a 100644
--- a/sys/dev/ic/ahci.c
+++ b/sys/dev/ic/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.25 2016/10/02 18:51:44 patrick Exp $ */
+/* $OpenBSD: ahci.c,v 1.26 2016/10/02 18:53:28 patrick Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -253,6 +253,13 @@ ahci_attach(struct ahci_softc *sc)
}
noccc:
#endif
+ /*
+ * Given that ahci_port_alloc() will grab one CCB for error recovery
+ * in the NCQ case from the pool of CCBs sized based on sc->sc_ncmds
+ * pretend at least 2 command slots for devices without NCQ support.
+ * That way, also at least 1 slot is made available for atascsi(4).
+ */
+ sc->sc_ncmds = max(2, sc->sc_ncmds);
for (i = 0; i < AHCI_MAX_PORTS; i++) {
if (!ISSET(pi, 1 << i)) {
/* dont allocate stuff if the port isnt implemented */