Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev iommu_dvmamap_load*(), pass an alignmen...



details:   https://anonhg.NetBSD.org/src/rev/15b587db0d91
branches:  trunk
changeset: 494127:15b587db0d91
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Jul 02 14:00:38 2000 +0000

description:
iommu_dvmamap_load*(), pass an alignment constraint, as well as
EX_BOUNDZERO, to extent_alloc().  this fixes problems with it
(extent_alloc()) returning incorrect values, when the start of
the extent is not aligned as strongly as the requested area..

raw access to ide disks now works.

diffstat:

 sys/arch/sparc64/dev/iommu.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (64 lines):

diff -r 4143a7cf71fc -r 15b587db0d91 sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c      Sun Jul 02 13:35:35 2000 +0000
+++ b/sys/arch/sparc64/dev/iommu.c      Sun Jul 02 14:00:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iommu.c,v 1.19 2000/06/29 07:37:55 mrg Exp $   */
+/*     $NetBSD: iommu.c,v 1.20 2000/07/02 14:00:38 mrg Exp $   */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -452,7 +452,7 @@
        int err;
        bus_size_t sgsize;
        paddr_t curaddr;
-       u_long dvmaddr;
+       u_long dvmaddr, align;
        vaddr_t vaddr = (vaddr_t)buf;
        pmap_t pmap;
 
@@ -475,17 +475,15 @@
                return (EINVAL);
        }
 
-#if 1
        sgsize = round_page(buflen + ((int)vaddr & PGOFSET));
-#else
-       sgsize = buflen + ((int)vaddr & PGOFSET);
-#endif
+
        /*
         * XXX Need to implement "don't dma across this boundry".
         */
+       align = max(map->_dm_boundary, NBPG);
        s = splhigh();
-       err = extent_alloc(is->is_dvmamap, sgsize, NBPG,
-           map->_dm_boundary, EX_NOWAIT, (u_long *)&dvmaddr);
+       err = extent_alloc(is->is_dvmamap, sgsize, align,
+           map->_dm_boundary, EX_NOWAIT|EX_BOUNDZERO, (u_long *)&dvmaddr);
        splx(s);
 
 #ifdef DEBUG
@@ -600,7 +598,7 @@
        int err;
        bus_size_t sgsize;
        paddr_t pa;
-       u_long boundary;
+       u_long boundary, align;
        u_long dvmaddr;
        struct pglist *mlist;
        int pagesz = PAGE_SIZE;
@@ -635,10 +633,11 @@
        if ((boundary = segs[0]._ds_boundary) == 0)
                boundary = map->_dm_boundary;
        
+       align = max(map->_dm_boundary, NBPG);
        s = splhigh();
-       err = extent_alloc(is->is_dvmamap, sgsize, NBPG, boundary, 
-                          (flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : EX_NOWAIT, 
-                          (u_long *)&dvmaddr);
+       err = extent_alloc(is->is_dvmamap, sgsize, align, boundary, 
+          ((flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : EX_NOWAIT)|EX_BOUNDZERO, 
+           (u_long *)&dvmaddr);
        splx(s);
 
        if (err != 0)



Home | Main Index | Thread Index | Old Index