summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1997-07-21 11:26:11 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1997-07-21 11:26:11 +0000
commit63a48794a62dd4b809b68d7809a222b81bdff2b4 (patch)
tree1ed284ab3fd20aee06d723b7f983c0eee629150e
parentf91963ea0e51df13dd7d636e8fd1063a28b9f27f (diff)
SCSI copy optimizations
-rw-r--r--sys/arch/wgrisc/dev/asc.c6
-rw-r--r--sys/arch/wgrisc/dev/dma.h25
2 files changed, 21 insertions, 10 deletions
diff --git a/sys/arch/wgrisc/dev/asc.c b/sys/arch/wgrisc/dev/asc.c
index 4ccba234be5..82cb4b7430e 100644
--- a/sys/arch/wgrisc/dev/asc.c
+++ b/sys/arch/wgrisc/dev/asc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asc.c,v 1.2 1997/02/17 19:08:25 pefo Exp $ */
+/* $OpenBSD: asc.c,v 1.3 1997/07/21 11:26:09 pefo Exp $ */
/* $NetBSD: asc.c,v 1.10 1994/12/05 19:11:12 dean Exp $ */
/*-
@@ -651,8 +651,10 @@ asc_scsi_cmd(xs)
#ifdef R4K
R4K_HitFlushDCache(xs->data, xs->datalen);
#else
+#ifndef ASC_NOFLUSH
R3K_FlushDCache();
#endif
+#endif
}
/*
* The hack on the next few lines are to avoid buffers
@@ -1419,8 +1421,10 @@ asc_end(asc, status, ss, ir)
#ifdef R4K
R4K_HitFlushDCache(state->buf, state->buflen);
#else
+#ifndef ASC_NOFLUSH
R3K_FlushDCache();
#endif
+#endif
asc->cmd[target] = scsicmd;
asc_startcmd(asc, target);
return(0);
diff --git a/sys/arch/wgrisc/dev/dma.h b/sys/arch/wgrisc/dev/dma.h
index 0eb2e30899f..899cd8ff838 100644
--- a/sys/arch/wgrisc/dev/dma.h
+++ b/sys/arch/wgrisc/dev/dma.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma.h,v 1.3 1997/02/17 19:08:28 pefo Exp $ */
+/* $OpenBSD: dma.h,v 1.4 1997/07/21 11:26:10 pefo Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -35,6 +35,15 @@
extern vm_map_t phys_map;
/*
+ * Little endian mips uses bounce buffer so flush
+ * for dma is not requiered.
+ */
+
+#ifdef MIPSEL
+#define ASC_NOFLUSH
+#endif
+
+/*
* Structure used to control dma.
*/
@@ -106,10 +115,9 @@ typedef struct dma_softc {
int *_p = (int *)PHYS_TO_UNCACHED(pa); \
int *_v = (int *)b; \
int _n = sz; \
- while(_n > 0) { \
- *_p = htonl(*_v); \
- _p++; _v++; _n -= 4; \
- } \
+ if(_n) { \
+ copynswap(_v, _p, _n); \
+ } \
} \
dcmd = ((d) == DMA_FROM_DEV) ? 0x30 : 0x10; \
if((a)->dma_ch == DMA_CH0) { \
@@ -151,9 +159,8 @@ typedef struct dma_softc {
int *_v = (int *)(c)->req_va; \
int *_p = (int *)PHYS_TO_UNCACHED(CACHED_TO_PHYS(dma_buffer)); \
int _n = (c)->req_size - resudial; \
- while(_n > 0) { \
- *_v = htonl(*_p); \
- _p++; _v++; _n -= 4; \
- } \
+ if(_n) { \
+ copynswap(_p, _v, _n); \
+ } \
} \
}