Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/arch/sparc/sparc Pull up revisions 1.174-1.175 (req...



details:   https://anonhg.NetBSD.org/src/rev/9f95676abd1e
branches:  netbsd-1-5
changeset: 490651:9f95676abd1e
user:      he <he%NetBSD.org@localhost>
date:      Sun Feb 04 19:07:13 2001 +0000

description:
Pull up revisions 1.174-1.175 (requested by pk):
  Bus_dma fixes to support certain sbus extension devices on sun4c
  machines.

diffstat:

 sys/arch/sparc/sparc/machdep.c |  31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diffs (66 lines):

diff -r 7d61fd0aa3a3 -r 9f95676abd1e sys/arch/sparc/sparc/machdep.c
--- a/sys/arch/sparc/sparc/machdep.c    Sun Feb 04 19:02:50 2001 +0000
+++ b/sys/arch/sparc/sparc/machdep.c    Sun Feb 04 19:07:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.165.4.3 2000/07/22 21:19:45 pk Exp $ */
+/*     $NetBSD: machdep.c,v 1.165.4.4 2001/02/04 19:07:13 he Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -1323,8 +1323,11 @@
 #endif
 
        /* XXX - Implement this! */
-       if (boundary)
-               panic("_bus_dma_valloc_skewed: not implemented");
+       if (boundary) {
+               printf("_bus_dma_valloc_skewed: "
+                       "boundary check not implemented");
+               return (0);
+       }
 
        /*
         * First, find a region large enough to contain any aligned chunk
@@ -1332,7 +1335,7 @@
        oversize = size + align - PAGE_SIZE;
        sva = uvm_km_valloc(kernel_map, oversize);
        if (sva == 0)
-               return (ENOMEM);
+               return (0);
 
        /*
         * Compute start of aligned region
@@ -1393,8 +1396,23 @@
                /*
                 * XXX Need to implement "don't dma across this boundry".
                 */
-               if (map->_dm_boundary != 0)
-                       panic("bus_dmamap_load: boundaries not implemented");
+               if (map->_dm_boundary != 0) {
+                       bus_addr_t baddr;
+
+                       /* Calculate first boundary line after `buf' */
+                       baddr = ((bus_addr_t)va + map->_dm_boundary) &
+                                       -map->_dm_boundary;
+
+                       /*
+                        * If the requested segment crosses the boundary,
+                        * we can't grant a direct map. For now, steal some
+                        * space from the `24BIT' map instead.
+                        *
+                        * (XXX - no overflow detection here)
+                        */
+                       if (buflen > (baddr - (bus_addr_t)va))
+                               goto no_fit;
+               }
                map->dm_mapsize = buflen;
                map->dm_nsegs = 1;
                map->dm_segs[0].ds_addr = (bus_addr_t)va;
@@ -1403,6 +1421,7 @@
                return (0);
        }
 
+no_fit:
        sgsize = round_page(buflen + (va & (pagesz - 1)));
 
        if (extent_alloc(dvmamap24, sgsize, pagesz, map->_dm_boundary,



Home | Main Index | Thread Index | Old Index