From 8c076270953ef3824ce140da0986406b8c3d0490 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sat, 30 Jun 2007 14:32:50 +0000 Subject: [PATCH] Copy SCSI command before bus_dmamap_sync(9) PREREAD ops against data xfer buffer because command and data buffers might be in the same cacheline. --- sys/dev/ic/osiop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c index d4087c8af6ea..70cc151907f7 100644 --- a/sys/dev/ic/osiop.c +++ b/sys/dev/ic/osiop.c @@ -1,4 +1,4 @@ -/* $NetBSD: osiop.c,v 1.28 2007/06/30 14:08:58 tsutsui Exp $ */ +/* $NetBSD: osiop.c,v 1.29 2007/06/30 14:32:50 tsutsui Exp $ */ /* * Copyright (c) 2001 Izumi Tsutsui. All rights reserved. @@ -100,7 +100,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: osiop.c,v 1.28 2007/06/30 14:08:58 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osiop.c,v 1.29 2007/06/30 14:32:50 tsutsui Exp $"); /* #define OSIOP_DEBUG */ @@ -404,6 +404,9 @@ osiop_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, acb->status = ACB_S_READY; acb->xs = xs; + /* Copy SCSI command to DMA buffer */ + memcpy(acb->ds->scsipi_cmd, xs->cmd, xs->cmdlen); + /* Setup DMA map for data buffer */ if (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) { err = bus_dmamap_load(sc->sc_dmat, acb->datadma, @@ -927,8 +930,6 @@ osiop_start(struct osiop_softc *sc) acb->intstat = 0; - /* copy SCSI command to DMA buffer */ - memcpy(ds->scsipi_cmd, xs->cmd, acb->cmdlen); ds->cmd.count = acb->cmdlen; ti = &sc->sc_tinfo[target];