Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add struct pmap_limits and pm_{min, max}addr from uv...



details:   https://anonhg.NetBSD.org/src/rev/39699b90aa15
branches:  trunk
changeset: 338841:39699b90aa15
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jun 11 08:22:08 2015 +0000

description:
Add struct pmap_limits and pm_{min,max}addr from uvm/pmap/map.h and use it to
store avail_start, avail_end, virtual_start, and virtual_end.
Remove iospace and let emips just bump pmap_limits.virtual_start to get the
VA space it needs.
pmap_segtab.c is almost identical to uvm/pmap/pmap_segtab.c now.  It won't
be long until we switch to the uvm/pmap one.

diffstat:

 sys/arch/arc/arc/bus_dma.c                 |   12 +-
 sys/arch/arc/isa/isadma_bounce.c           |   10 +-
 sys/arch/emips/emips/bus_dma.c             |   12 +-
 sys/arch/emips/emips/machdep.c             |   11 +-
 sys/arch/ews4800mips/ews4800mips/bus_dma.c |   10 +-
 sys/arch/hpcmips/hpcmips/bus_dma.c         |   14 +-
 sys/arch/hpcmips/include/kloader.h         |   10 +-
 sys/arch/hpcmips/vr/vrdcu.c                |    8 +-
 sys/arch/mips/include/bus_dma_defs.h       |    4 +-
 sys/arch/mips/include/pmap.h               |   31 +++-
 sys/arch/mips/include/pte.h                |   16 ++-
 sys/arch/mips/mips/cpu_subr.c              |    6 +-
 sys/arch/mips/mips/mips_machdep.c          |    8 +-
 sys/arch/mips/mips/pmap.c                  |   82 ++++++------
 sys/arch/mips/mips/pmap_segtab.c           |  193 ++++++++++++++++------------
 sys/arch/mips/mips/vm_machdep.c            |   22 +-
 sys/arch/mipsco/mipsco/bus_dma.c           |    9 +-
 sys/arch/newsmips/newsmips/bus.c           |    7 +-
 sys/arch/pmax/pmax/bus_dma.c               |    7 +-
 sys/arch/sgimips/ioc/if_le_oioc.c          |    7 +-
 20 files changed, 268 insertions(+), 211 deletions(-)

diffs (truncated from 1279 to 300 lines):

diff -r 0839affba5dc -r 39699b90aa15 sys/arch/arc/arc/bus_dma.c
--- a/sys/arch/arc/arc/bus_dma.c        Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/arc/arc/bus_dma.c        Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.33 2011/07/01 19:28:00 dyoung Exp $      */
+/*     $NetBSD: bus_dma.c,v 1.34 2015/06/11 08:22:08 matt Exp $        */
 /*     NetBSD: bus_dma.c,v 1.20 2000/01/10 03:24:36 simonb Exp         */
 
 /*-
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.33 2011/07/01 19:28:00 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.34 2015/06/11 08:22:08 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -554,8 +554,8 @@
 {
 
        return _bus_dmamem_alloc_range(t, size, alignment, boundary,
-           segs, nsegs, rsegs, flags, mips_avail_start,
-           trunc_page(mips_avail_end));
+           segs, nsegs, rsegs, flags, pmap_limits.avail_start,
+           trunc_page(pmap_limits.avail_end));
 }
 
 /*
@@ -575,7 +575,7 @@
        /* Always round the size. */
        size = round_page(size);
 
-       high = mips_avail_end - PAGE_SIZE;
+       high = pmap_limits.avail_end - PAGE_SIZE;
 
        /*
         * Allocate pages from the VM system.
@@ -599,7 +599,7 @@
        for (; m != NULL; m = TAILQ_NEXT(m, pageq.queue)) {
                curaddr = VM_PAGE_TO_PHYS(m);
 #ifdef DIAGNOSTIC
-               if (curaddr < mips_avail_start || curaddr >= high) {
+               if (curaddr < pmap_limits.avail_start || curaddr >= high) {
                        printf("uvm_pglistalloc returned non-sensical"
                            " address 0x%llx\n", (long long)curaddr);
                        panic("_bus_dmamem_alloc_range");
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/arc/isa/isadma_bounce.c
--- a/sys/arch/arc/isa/isadma_bounce.c  Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/arc/isa/isadma_bounce.c  Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isadma_bounce.c,v 1.13 2011/07/01 19:25:41 dyoung Exp $ */
+/* $NetBSD: isadma_bounce.c,v 1.14 2015/06/11 08:22:08 matt Exp $ */
 /* NetBSD: isadma_bounce.c,v 1.2 2000/06/01 05:49:36 thorpej Exp  */
 
 /*-
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isadma_bounce.c,v 1.13 2011/07/01 19:25:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isadma_bounce.c,v 1.14 2015/06/11 08:22:08 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -172,7 +172,7 @@
         * ISA DMA controller), we may have to bounce it as well.
         */
        cookieflags = 0;
-       if (mips_avail_end > ISA_DMA_BOUNCE_THRESHOLD ||
+       if (pmap_limits.avail_end > ISA_DMA_BOUNCE_THRESHOLD ||
            ((map->_dm_size / PAGE_SIZE) + 1) > map->_dm_segcnt) {
                cookieflags |= ID_MIGHT_NEED_BOUNCE;
                cookiesize += (sizeof(bus_dma_segment_t) *
@@ -568,10 +568,10 @@
 {
        paddr_t high;
 
-       if (mips_avail_end > ISA_DMA_BOUNCE_THRESHOLD)
+       if (pmap_limits.avail_end > ISA_DMA_BOUNCE_THRESHOLD)
                high = trunc_page(ISA_DMA_BOUNCE_THRESHOLD);
        else
-               high = trunc_page(mips_avail_end);
+               high = trunc_page(pmap_limits.avail_end);
 
        return _bus_dmamem_alloc_range(t, size, alignment, boundary,
            segs, nsegs, rsegs, flags, 0, high);
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/emips/emips/bus_dma.c
--- a/sys/arch/emips/emips/bus_dma.c    Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/emips/emips/bus_dma.c    Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.3 2012/10/02 23:54:53 christos Exp $     */
+/*     $NetBSD: bus_dma.c,v 1.4 2015/06/11 08:22:08 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.3 2012/10/02 23:54:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.4 2015/06/11 08:22:08 matt Exp $");
 
 #include "opt_cputype.h"
 
@@ -658,10 +658,10 @@
     bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
     int flags)
 {
-       return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,
-                                              segs, nsegs, rsegs, flags,
-                                              mips_avail_start /*low*/,
-                                              mips_avail_end - PAGE_SIZE /*high*/));
+       return _bus_dmamem_alloc_range_common(t, size, alignment, boundary,
+            segs, nsegs, rsegs, flags,
+            pmap_limits.avail_start /*low*/,
+            pmap_limits.avail_end - PAGE_SIZE /*high*/);
 }
 
 /*
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/emips/emips/machdep.c
--- a/sys/arch/emips/emips/machdep.c    Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/emips/emips/machdep.c    Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.10 2014/03/24 20:06:31 christos Exp $    */
+/*     $NetBSD: machdep.c,v 1.11 2015/06/11 08:22:08 matt Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10 2014/03/24 20:06:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.11 2015/06/11 08:22:08 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -82,8 +82,8 @@
 #include <ddb/db_extern.h>
 #endif
 
-extern vaddr_t iospace;
-extern vsize_t iospace_size;
+vaddr_t iospace = 64 * 1024; /* BUGBUG make it an option? */
+vsize_t iospace_size;
 
 #include "ksyms.h"
 
@@ -315,7 +315,8 @@
        /*
         * Initialize the virtual memory system.
         */
-       iospace_size = 64*1024; /* BUGBUG make it an option? */
+       iospace = pmap_limits.virtual_start;
+       pmap_limits.virtual_start += iospace_size;
        pmap_bootstrap();
 
        mips_init_lwp0_uarea();
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/ews4800mips/ews4800mips/bus_dma.c
--- a/sys/arch/ews4800mips/ews4800mips/bus_dma.c        Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/ews4800mips/ews4800mips/bus_dma.c        Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.13 2012/10/02 23:54:52 christos Exp $    */
+/*     $NetBSD: bus_dma.c,v 1.14 2015/06/11 08:22:08 matt Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.13 2012/10/02 23:54:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.14 2015/06/11 08:22:08 matt Exp $");
 
 /* #define     BUS_DMA_DEBUG */
 #include <sys/param.h>
@@ -542,11 +542,11 @@
     bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
     int flags)
 {
-       extern paddr_t mips_avail_start, mips_avail_end;
 
-       return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,
+       return _bus_dmamem_alloc_range_common(t, size, alignment, boundary,
            segs, nsegs, rsegs, flags,
-           mips_avail_start /*low*/, mips_avail_end - PAGE_SIZE /*high*/));
+           pmap_limits.avail_start /*low*/,
+           pmap_limits.avail_end - PAGE_SIZE /*high*/);
 }
 
 /*
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/hpcmips/hpcmips/bus_dma.c
--- a/sys/arch/hpcmips/hpcmips/bus_dma.c        Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/hpcmips/hpcmips/bus_dma.c        Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.38 2012/10/02 23:54:52 christos Exp $    */
+/*     $NetBSD: bus_dma.c,v 1.39 2015/06/11 08:22:09 matt Exp $        */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.38 2012/10/02 23:54:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.39 2015/06/11 08:22:09 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -517,12 +517,10 @@
     bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
     int flags)
 {
-       psize_t high;
-
-       high = mips_avail_end - PAGE_SIZE;
+       paddr_t high = pmap_limits.avail_end - PAGE_SIZE;
 
        return (_hpcmips_bd_mem_alloc_range(t, size, alignment, boundary,
-           segs, nsegs, rsegs, flags, mips_avail_start, high));
+           segs, nsegs, rsegs, flags, pmap_limits.avail_start, high));
 }
 
 /*
@@ -537,8 +535,8 @@
 {
 #ifdef DIAGNOSTIC
 
-       high = high<(mips_avail_end - PAGE_SIZE)? high: (mips_avail_end - PAGE_SIZE);
-       low = low>mips_avail_start? low: mips_avail_start;
+       high = high<(pmap_limits.avail_end - PAGE_SIZE)? high: (pmap_limits.avail_end - PAGE_SIZE);
+       low = low>pmap_limits.avail_start? low: pmap_limits.avail_start;
 #endif
 
        return (_bus_dmamem_alloc_range_common(t, size, alignment, boundary,
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/hpcmips/include/kloader.h
--- a/sys/arch/hpcmips/include/kloader.h        Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/hpcmips/include/kloader.h        Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kloader.h,v 1.5 2011/03/16 13:08:22 tsutsui Exp $      */
+/*     $NetBSD: kloader.h,v 1.6 2015/06/11 08:22:09 matt Exp $ */
 
 /*-
  * Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
@@ -28,8 +28,12 @@
 
 #include <dev/kloader.h>
 
+#include <uvm/uvm_extern.h>
+
+#include <mips/cpuregs.h>
+
 #define PG_VADDR(pg)   MIPS_PHYS_TO_KSEG0(VM_PAGE_TO_PHYS(pg))
 
 /* XXX: kludge: MI kloader.c assumes avail_start and avail_end are common */
-#define avail_start    mips_avail_start
-#define avail_end      mips_avail_end
+#define avail_start    pmap_limits.avail_start
+#define avail_end      pmap_limits.avail_end
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/hpcmips/vr/vrdcu.c
--- a/sys/arch/hpcmips/vr/vrdcu.c       Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/hpcmips/vr/vrdcu.c       Thu Jun 11 08:22:08 2015 +0000
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vrdcu.c,v 1.7 2012/10/27 17:17:55 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vrdcu.c,v 1.8 2015/06/11 08:22:09 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -222,12 +222,12 @@
 
        DPRINTFN(1, ("_vrdcu_dmamem_alloc\n"));
 
-       high = (mips_avail_end < VRDMAAU_BOUNCE_THRESHOLD ?
-               mips_avail_end : VRDMAAU_BOUNCE_THRESHOLD) - PAGE_SIZE;
+       high = (pmap_limits.avail_end < VRDMAAU_BOUNCE_THRESHOLD ?
+               pmap_limits.avail_end : VRDMAAU_BOUNCE_THRESHOLD) - PAGE_SIZE;
        alignment = alignment > VRDMAAU_ALIGNMENT ?
                    alignment : VRDMAAU_ALIGNMENT;
 
        return _hpcmips_bd_mem_alloc_range(t, size, alignment, boundary,
                                           segs, nsegs, rsegs, flags,
-                                          mips_avail_start, high);
+                                          pmap_limits.avail_start, high);
 }
diff -r 0839affba5dc -r 39699b90aa15 sys/arch/mips/include/bus_dma_defs.h
--- a/sys/arch/mips/include/bus_dma_defs.h      Thu Jun 11 08:16:47 2015 +0000
+++ b/sys/arch/mips/include/bus_dma_defs.h      Thu Jun 11 08:22:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma_defs.h,v 1.1 2011/07/01 17:28:55 dyoung Exp $ */
+/* $NetBSD: bus_dma_defs.h,v 1.2 2015/06/11 08:22:09 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -213,7 +213,7 @@
 };
 



Home | Main Index | Thread Index | Old Index