Module Name: src
Committed By: jdolecek
Date: Tue Apr 11 18:13:17 UTC 2017
Modified Files:
src/sys/dev/ic [jdolecek-ncq]: ahcisata_core.c mvsata.c siisata.c
Log Message:
fix to not access active_xfer directly
To generate a diff of this commit:
cvs rdiff -u -r1.57.6.1 -r1.57.6.2 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.30.4.1 -r1.30.4.2 src/sys/dev/ic/siisata.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.57.6.1 src/sys/dev/ic/ahcisata_core.c:1.57.6.2
--- src/sys/dev/ic/ahcisata_core.c:1.57.6.1 Mon Apr 10 22:57:02 2017
+++ src/sys/dev/ic/ahcisata_core.c Tue Apr 11 18:13:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_core.c,v 1.57.6.1 2017/04/10 22:57:02 jdolecek Exp $ */
+/* $NetBSD: ahcisata_core.c,v 1.57.6.2 2017/04/11 18:13:17 jdolecek Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.57.6.1 2017/04/10 22:57:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.57.6.2 2017/04/11 18:13:17 jdolecek Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@@ -1433,7 +1433,7 @@ static void
ahci_timeout(void *v)
{
struct ata_channel *chp = (struct ata_channel *)v;
- struct ata_xfer *xfer = chp->ch_queue->active_xfers[0];
+ struct ata_xfer *xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, 0); /* XXX slot */
#ifdef AHCI_DEBUG
struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac;
#endif
Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.35.6.1 src/sys/dev/ic/mvsata.c:1.35.6.2
--- src/sys/dev/ic/mvsata.c:1.35.6.1 Mon Apr 10 22:57:02 2017
+++ src/sys/dev/ic/mvsata.c Tue Apr 11 18:13:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mvsata.c,v 1.35.6.1 2017/04/10 22:57:02 jdolecek Exp $ */
+/* $NetBSD: mvsata.c,v 1.35.6.2 2017/04/11 18:13:17 jdolecek Exp $ */
/*
* Copyright (c) 2008 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.1 2017/04/10 22:57:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.2 2017/04/11 18:13:17 jdolecek Exp $");
#include "opt_mvsata.h"
@@ -630,7 +630,10 @@ mvsata_reset_channel(struct ata_channel
xfer = mvport->port_reqtbl[i].xfer;
if (xfer == NULL)
continue;
- chp->ch_queue->active_xfers[0] = xfer;
+#if 0
+ /* This doesn't seem to be needed? */
+ chp->ch_queue->active_xfers[0] = xfer; /* XXX slot */
+#endif
xfer->c_kill_xfer(chp, xfer, KILL_RESET);
}
@@ -1447,15 +1450,11 @@ mvsata_bio_done(struct ata_channel *chp,
ata_bio->bcount = xfer->c_bcount;
/* mark controller inactive and free xfer */
- KASSERT(chp->ch_queue->active_xfers[0] != NULL);
ata_deactivate_xfer(chp, xfer);
ata_free_xfer(chp, xfer);
- if (chp->ch_drive[drive].drive_flags & ATA_DRIVE_WAITDRAIN) {
+ if (ata_waitdrain_check(chp, drive)) {
ata_bio->error = ERR_NODEV;
- chp->ch_drive[drive].drive_flags &= ~ATA_DRIVE_WAITDRAIN;
- wakeup(chp->ch_queue->active_xfers);
- }
ata_bio->flags |= ATA_ITSDONE;
(*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc);
atastart(chp);
@@ -1820,11 +1819,8 @@ mvsata_wdc_cmd_done(struct ata_channel *
MVSATA_WDC_WRITE_1(mvport, SRB_CAS, WDCTL_4BIT);
delay(10); /* some drives need a little delay here */
}
- if (chp->ch_drive[xfer->c_drive].drive_flags & ATA_DRIVE_WAITDRAIN) {
- mvsata_wdc_cmd_kill_xfer(chp, xfer, KILL_GONE);
- chp->ch_drive[xfer->c_drive].drive_flags &= ~ATA_DRIVE_WAITDRAIN;
- wakeup(chp->ch_queue->active_xfers);
- } else
+
+ if (!ata_waitdrain_xfer_check(chp, xfer))
mvsata_wdc_cmd_done_end(chp, xfer);
}
@@ -2462,8 +2458,9 @@ mvsata_edma_enqueue(struct mvsata_port *
return rv;
KASSERT(mvport->port_reqtbl[quetag].xfer == NULL);
- KASSERT(chp->ch_queue->active_xfers[0] != NULL);
- mvport->port_reqtbl[quetag].xfer = chp->ch_queue->active_xfers[0];
+ KASSERT(ata_queue_hwslot_to_xfer(chp->ch_queue, 0) != NULL);
+ mvport->port_reqtbl[quetag].xfer = ata_queue_hwslot_to_xfer(
+ chp->ch_queue, 0); /* XXX slot */
/* setup EDMA Physical Region Descriptors (ePRD) Table Data */
data_dmamap = mvport->port_reqtbl[quetag].data_dmamap;
@@ -2576,8 +2573,8 @@ mvsata_edma_handle(struct mvsata_port *m
#endif
crpb = mvport->port_crpb + erpqop;
quetag = CRPB_CHOSTQUETAG(le16toh(crpb->id));
- KASSERT(chp->ch_queue->active_xfers[0] != NULL);
- xfer = chp->ch_queue->active_xfers[0];
+ xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, 0); /* XXX slot */
+ KASSERT(xfer != NULL);
KASSERT(xfer == mvport->port_reqtbl[quetag].xfer);
#ifdef DIAGNOSTIC
if (xfer == NULL)
@@ -2765,9 +2762,10 @@ mvsata_bdma_init(struct mvsata_port *mvp
if (rv != 0)
return rv;
- KASSERT(chp->ch_queue->active_xfers[0] != NULL);
+ KASSERT(ata_queue_hwslot_to_xfer(chp->ch_queue, 0) != NULL);
KASSERT(mvport->port_reqtbl[quetag].xfer == NULL);
- mvport->port_reqtbl[quetag].xfer = chp->ch_queue->active_xfers[0];
+ mvport->port_reqtbl[quetag].xfer = ata_queue_hwslot_to_xfer(
+ chp->ch_queue, 0); /* XXX slot */
/* setup EDMA Physical Region Descriptors (ePRD) Table Data */
data_dmamap = mvport->port_reqtbl[quetag].data_dmamap;
@@ -3452,7 +3450,8 @@ mvsata_edma_setup_crqb(struct mvsata_por
uint8_t cmd, head;
int i;
const int drive =
- mvport->port_ata_channel.ch_queue->active_xfers[0]->c_drive;
+ ata_queue_hwslot_to_xfer(mvport->port_ata_channel.ch_queue, 0) /* XXX slot */
+ ->c_drive;
eprd_addr = mvport->port_eprd_dmamap->dm_segs[0].ds_addr +
mvport->port_reqtbl[quetag].eprd_offset;
@@ -3700,7 +3699,8 @@ mvsata_edma_setup_crqb_gen2e(struct mvsa
uint32_t ctrlflg, rw;
uint8_t cmd, head;
const int drive =
- mvport->port_ata_channel.ch_queue->active_xfers[0]->c_drive;
+ ata_queue_hwslot_to_xfer(mvport->port_ata_channel.ch_queue, 0) /* XXX slot */
+ ->c_drive;
eprd_addr = mvport->port_eprd_dmamap->dm_segs[0].ds_addr +
mvport->port_reqtbl[quetag].eprd_offset;
Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.30.4.1 src/sys/dev/ic/siisata.c:1.30.4.2
--- src/sys/dev/ic/siisata.c:1.30.4.1 Mon Apr 10 22:57:02 2017
+++ src/sys/dev/ic/siisata.c Tue Apr 11 18:13:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.30.4.1 2017/04/10 22:57:02 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.30.4.2 2017/04/11 18:13:17 jdolecek Exp $ */
/* from ahcisata_core.c */
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.1 2017/04/10 22:57:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.2 2017/04/11 18:13:17 jdolecek Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -480,7 +480,7 @@ siisata_intr_port(struct siisata_channel
sc = (struct siisata_softc *)schp->ata_channel.ch_atac;
chp = &schp->ata_channel;
- xfer = chp->ch_queue->active_xfers[0];
+ xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, 0); /* XXX slot */
slot = SIISATA_NON_NCQ_SLOT;
pis = PRREAD(sc, PRX(chp->ch_channel, PRO_PIS));
@@ -640,7 +640,7 @@ siisata_reset_channel(struct ata_channel
DELAY(10);
PRWRITE(sc, PRX(chp->ch_channel, PRO_SERROR),
PRREAD(sc, PRX(chp->ch_channel, PRO_SERROR)));
- if ((xfer = chp->ch_queue->active_xfers[0]) != NULL) {
+ if ((xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, 0)) != NULL) { /* XXX slot */
(*xfer->c_kill_xfer)(chp, xfer, KILL_RESET);
}
@@ -1191,7 +1191,7 @@ void
siisata_timeout(void *v)
{
struct ata_channel *chp = (struct ata_channel *)v;
- struct ata_xfer *xfer = chp->ch_queue->active_xfers[0];
+ struct ata_xfer *xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, 0); /* XXX slot */
int slot = SIISATA_NON_NCQ_SLOT;
int s = splbio();
SIISATA_DEBUG_PRINT(("%s: %p\n", __func__, xfer), DEBUG_INTR);