Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/tc Pull up rev 1.22 [approved by thorpej.



details:   https://anonhg.NetBSD.org/src/rev/70c4c3e595c0
branches:  netbsd-1-5
changeset: 489596:70c4c3e595c0
user:      mhitch <mhitch%NetBSD.org@localhost>
date:      Sat Sep 30 01:46:09 2000 +0000

description:
Pull up rev 1.22 [approved by thorpej.

Set up the physical addresses for DMAPTR/NEXTPTR before adjusting for
unaligned transfers and adjust the physical address to align the transfer.
If the buffer end just crossed the page boundary, the computation of the
NEXTPTR physical address resulted in using -1.  The cleanup at the end of
the DMA transfer would try to copy the residual data to physical address
0x1ffffffc.  This would silently corrupt data on the R3000 and usually
would hang the R4000.

diffstat:

 sys/dev/tc/asc_ioasic.c |  25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diffs (55 lines):

diff -r d8e0ecb0d1fe -r 70c4c3e595c0 sys/dev/tc/asc_ioasic.c
--- a/sys/dev/tc/asc_ioasic.c   Fri Sep 29 19:27:00 2000 +0000
+++ b/sys/dev/tc/asc_ioasic.c   Sat Sep 30 01:46:09 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asc_ioasic.c,v 1.21 2000/03/06 03:08:32 mhitch Exp $   */
+/*     $NetBSD: asc_ioasic.c,v 1.21.4.1 2000/09/30 01:46:09 mhitch Exp $       */
 
 /*
  * Copyright 1996 The Board of Trustees of The Leland Stanford
@@ -139,6 +139,15 @@
        if (len > ((caddr_t)mips_trunc_page(cp + NBPG * 2) - cp))
                len = (caddr_t)mips_trunc_page(cp + NBPG * 2) - cp;
 
+       /* Get physical address of buffer start, no next phys addr */
+       phys = (u_int)kvtophys((vaddr_t)cp);
+       nphys = -1;
+
+       /* Compute 2nd DMA pointer only if next page is part of this I/O */
+       if ((NBPG - (phys & (NBPG - 1))) < len) {
+               nphys = (u_int)kvtophys((vaddr_t)mips_trunc_page(cp + NBPG));
+       }
+
        if ((vaddr_t)cp & 7) {
                u_int32_t *p;
                u_int32_t scrval;
@@ -149,10 +158,10 @@
                bus_space_write_4(asc->sc_bst, asc->sc_bsh,
                                                IOASIC_SCSI_SDR1, p[1]);
                scrval = ((vaddr_t)cp >> 1) & 3;
-               cp = (caddr_t)((vaddr_t)cp & ~7);
+               phys &= ~7;
                if (flag != ASCDMA_READ) {
                        scrval |= 4;
-                       cp += 8;
+                       phys += 8;
                }
                bus_space_write_4(asc->sc_bst, asc->sc_bsh,
                                                IOASIC_SCSI_SCR, scrval);
@@ -162,16 +171,6 @@
        if (CPUISMIPS3)
                mips3_HitFlushDCache((vaddr_t)cp, len);
 
-       /* Get physical address of buffer start, no next phys addr */
-       phys = (u_int)kvtophys((vaddr_t)cp);
-       nphys = -1;
-
-       /* Compute 2nd DMA pointer only if next page is part of this I/O */
-       if ((NBPG - (phys & (NBPG - 1))) < len) {
-               cp = (caddr_t)mips_trunc_page(cp + NBPG);
-               nphys = (u_int)kvtophys((vaddr_t)cp);
-       }
-
        /* If not R4K, need to invalidate cache lines for both physical segments */
        if (!CPUISMIPS3 && flag == ASCDMA_READ) {
                MachFlushDCache(MIPS_PHYS_TO_KSEG0(phys),



Home | Main Index | Thread Index | Old Index