Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/dev/tc Pull up revision 1.18 (requested by mhitch):



details:   https://anonhg.NetBSD.org/src/rev/b7f2855dc73f
branches:  netbsd-1-4
changeset: 469852:b7f2855dc73f
user:      he <he%NetBSD.org@localhost>
date:      Sat Dec 04 20:32:11 1999 +0000

description:
Pull up revision 1.18 (requested by mhitch):
  Fix IOASIC DMA alignment problems.  This should fix the problems
  with dump(8) failing randomly on DECstations.

diffstat:

 sys/dev/tc/asc_ioasic.c |  39 ++++++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 15 deletions(-)

diffs (67 lines):

diff -r 54f5dc3b8a8d -r b7f2855dc73f sys/dev/tc/asc_ioasic.c
--- a/sys/dev/tc/asc_ioasic.c   Sat Dec 04 20:12:33 1999 +0000
+++ b/sys/dev/tc/asc_ioasic.c   Sat Dec 04 20:32:11 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asc_ioasic.c,v 1.15 1999/01/16 06:36:42 nisimura Exp $ */
+/*     $NetBSD: asc_ioasic.c,v 1.15.2.1 1999/12/04 20:32:11 he Exp $   */
 
 /*
  * Copyright 1996 The Board of Trustees of The Leland Stanford
@@ -148,6 +148,22 @@
        if (len > ((caddr_t)mips_trunc_page(cp + NBPG * 2) - cp))
                len = (caddr_t)mips_trunc_page(cp + NBPG * 2) - cp;
 
+       if ((vaddr_t)cp & 7) {
+               u_int32_t *p;
+               u_int32_t scrval;
+
+               p = (u_int32_t *)((vaddr_t)cp & ~7);
+               *((volatile u_int32_t *)IOASIC_REG_SCSI_SDR0(ioasic_base)) = p[0];
+               *((volatile u_int32_t *)IOASIC_REG_SCSI_SDR1(ioasic_base)) = p[1];
+               scrval = ((vaddr_t)cp >> 1) & 3;
+               cp = (caddr_t)((vaddr_t)cp & ~7);
+               if (flag != ASCDMA_READ) {
+                       scrval |= 4;
+                       cp += 8;
+               }
+               *((volatile int *)IOASIC_REG_SCSI_SCR(ioasic_base)) = scrval;
+       }
+
        /* If R4K, writeback and invalidate  the buffer */
        if (CPUISMIPS3)
                mips3_HitFlushDCache((vaddr_t)cp, len);
@@ -199,7 +215,6 @@
        register volatile u_int *dmap = (volatile u_int *)
                IOASIC_REG_SCSI_DMAPTR(ioasic_base);
        register u_short *to;
-       register int w;
        int nb;
 
        *ssr &= ~IOASIC_CSR_DMAEN_SCSI;
@@ -226,19 +241,13 @@
                            state->dmalen);
 #endif /* USE_CACHED_BUFFER */
                if ( (nb = *((int *)IOASIC_REG_SCSI_SCR(ioasic_base))) != 0) {
-                       /* pick up last upto6 bytes, sigh. */
-       
-                       /* Last byte really xferred is.. */
-                       w = *(int *)IOASIC_REG_SCSI_SDR0(ioasic_base);
-                       *to++ = w;
-                       if (--nb > 0) {
-                               w >>= 16;
-                               *to++ = w;
-                       }
-                       if (--nb > 0) {
-                               w = *(int *)IOASIC_REG_SCSI_SDR1(ioasic_base);
-                               *to++ = w;
-                       }
+                       int sdr[2];
+                       /* pick up last upto 6 bytes, sigh. */
+
+                       /* Copy untransferred data from IOASIC */
+                       sdr[0] = *(int *)IOASIC_REG_SCSI_SDR0(ioasic_base);
+                       sdr[1] = *(int *)IOASIC_REG_SCSI_SDR1(ioasic_base);
+                       memcpy(to, (char *)sdr, nb * 2);
                }
        }
 }



Home | Main Index | Thread Index | Old Index