Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Fix PRB blanking, so as not to stomp on the feet ...



details:   https://anonhg.NetBSD.org/src/rev/5ed4aa856169
branches:  trunk
changeset: 823481:5ed4aa856169
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Mon Apr 24 21:14:32 2017 +0000

description:
Fix PRB blanking, so as not to stomp on the feet of neighboring slots.
Also, don't blank some PRB fields twice.

[:U+1F633:]

diffstat:

 sys/dev/ic/siisata.c |  22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)

diffs (88 lines):

diff -r 301b515a9f1f -r 5ed4aa856169 sys/dev/ic/siisata.c
--- a/sys/dev/ic/siisata.c      Mon Apr 24 18:18:15 2017 +0000
+++ b/sys/dev/ic/siisata.c      Mon Apr 24 21:14:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.32 2017/04/24 13:19:50 jakllsch Exp $ */
+/* $NetBSD: siisata.c,v 1.33 2017/04/24 21:14:32 jakllsch Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.32 2017/04/24 13:19:50 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.33 2017/04/24 21:14:32 jakllsch Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -558,7 +558,7 @@
                DELAY(10);
 
        prb = schp->sch_prb[slot];
-       memset(prb, 0, sizeof(struct siisata_prb));
+       memset(prb, 0, SIISATA_CMD_SIZE);
        prb->prb_control =
            htole16(PRB_CF_SOFT_RESET | PRB_CF_INTERRUPT_MASK);
        KASSERT(drvp->drive <= PMP_PORT_CTL);
@@ -696,7 +696,7 @@
                    & PR_PS_PORT_READY))
                        DELAY(10);
                prb = schp->sch_prb[slot];
-               memset(prb, 0, sizeof(struct siisata_prb));
+               memset(prb, 0, SIISATA_CMD_SIZE);
                prb->prb_control = htole16(PRB_CF_SOFT_RESET);
                prb->prb_fis[rhd_c] = PMP_PORT_CTL;
 
@@ -836,14 +836,12 @@
        chp->ch_error = 0;
 
        prb = schp->sch_prb[slot];
-       memset(prb, 0, sizeof(struct siisata_prb));
+       memset(prb, 0, SIISATA_CMD_SIZE);
 
        satafis_rhd_construct_cmd(ata_c, prb->prb_fis);
        KASSERT(xfer->c_drive <= PMP_PORT_CTL);
        prb->prb_fis[rhd_c] |= xfer->c_drive;
 
-       memset(prb->prb_atapi, 0, sizeof(prb->prb_atapi));
-
        if (ata_c->r_command == ATA_DATA_SET_MANAGEMENT) {
                prb->prb_control |= htole16(PRB_CF_PROTOCOL_OVERRIDE);
                prb->prb_protocol_override |= htole16(PRB_PO_WRITE);
@@ -1051,14 +1049,12 @@
        chp->ch_error = 0;
 
        prb = schp->sch_prb[slot];
-       memset(prb, 0, sizeof(struct siisata_prb));
+       memset(prb, 0, SIISATA_CMD_SIZE);
 
        satafis_rhd_construct_bio(xfer, prb->prb_fis);
        KASSERT(xfer->c_drive <= PMP_PORT_CTL);
        prb->prb_fis[rhd_c] |= xfer->c_drive;
 
-       memset(prb->prb_atapi, 0, sizeof(prb->prb_atapi));
-
        if (siisata_dma_setup(chp, slot, ata_bio->databuf, ata_bio->bcount,
            (ata_bio->flags & ATA_READ) ? BUS_DMA_READ : BUS_DMA_WRITE)) {
                ata_bio->error = ERR_DMA;
@@ -1237,9 +1233,6 @@
            schp->sch_datad[slot]->dm_mapsize,
            (op == BUS_DMA_READ) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
 
-       /* make sure it's clean */
-       memset(prbp->prb_sge, 0, SIISATA_NSGE * sizeof(struct siisata_prb));
-
        SIISATA_DEBUG_PRINT(("%s: %d segs, %ld count\n", __func__,
            schp->sch_datad[slot]->dm_nsegs, (long unsigned int) count),
            DEBUG_FUNCS | DEBUG_DEBUG);
@@ -1593,8 +1586,7 @@
        chp->ch_error = 0;
 
        prbp = schp->sch_prb[slot];
-       memset(prbp, 0, sizeof(struct siisata_prb));
-
+       memset(prbp, 0, SIISATA_CMD_SIZE);
 
        /* fill in direction for ATAPI command */
        if ((sc_xfer->xs_control & XS_CTL_DATA_IN))



Home | Main Index | Thread Index | Old Index