Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Don't put #ifdefs in prep_initppc(). Instead, let ...



details:   https://anonhg.NetBSD.org/src/rev/b4d56fe3428f
branches:  trunk
changeset: 953123:b4d56fe3428f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Feb 27 01:31:23 2021 +0000

description:
Don't put #ifdefs in prep_initppc().  Instead, let callers specify the
additional BAT-mapped regions they care about.

diffstat:

 sys/arch/bebox/bebox/machdep.c            |  10 +++++++---
 sys/arch/ibmnws/ibmnws/machdep.c          |   6 +++---
 sys/arch/mvmeppc/mvmeppc/machdep.c        |   6 +++---
 sys/arch/powerpc/include/prep_bus.h       |   4 ++--
 sys/arch/powerpc/include/prep_bus_funcs.h |   4 ++--
 sys/arch/powerpc/oea/prep_machdep.c       |  26 ++++++++++++++------------
 sys/arch/prep/prep/machdep.c              |   9 ++++++---
 7 files changed, 37 insertions(+), 28 deletions(-)

diffs (214 lines):

diff -r d003cd4b686e -r b4d56fe3428f sys/arch/bebox/bebox/machdep.c
--- a/sys/arch/bebox/bebox/machdep.c    Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/bebox/bebox/machdep.c    Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.108 2018/07/15 05:16:41 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.109 2021/02/27 01:31:24 thorpej Exp $    */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.108 2018/07/15 05:16:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.109 2021/02/27 01:31:24 thorpej Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -56,6 +56,7 @@
 #include <machine/bootinfo.h>
 #include <machine/powerpc.h>
 
+#include <powerpc/bat.h>
 #include <powerpc/pic/picvar.h> 
 #include <powerpc/pio.h>
 #include <powerpc/prep_bus.h>
@@ -140,7 +141,10 @@
                ns_per_tick = 1000000000 / ticks_per_sec;
        }
 
-       prep_initppc(startkernel, endkernel, args);
+       prep_initppc(startkernel, endkernel, args,
+           /* BeBox mainboard registers */
+           0x7ffff000, BAT_BL_8M,              /* XXX magic number */
+           0);
 }
 
 /*
diff -r d003cd4b686e -r b4d56fe3428f sys/arch/ibmnws/ibmnws/machdep.c
--- a/sys/arch/ibmnws/ibmnws/machdep.c  Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/ibmnws/ibmnws/machdep.c  Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.17 2012/07/28 23:11:00 matt Exp $        */
+/*     $NetBSD: machdep.c,v 1.18 2021/02/27 01:31:24 thorpej Exp $     */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2012/07/28 23:11:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.18 2021/02/27 01:31:24 thorpej Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -149,7 +149,7 @@
         */
        boothowto = 0;          /* XXX - should make this an option */
 
-       prep_initppc(startkernel, endkernel, args);
+       prep_initppc(startkernel, endkernel, args, 0);
 }
 
 /*
diff -r d003cd4b686e -r b4d56fe3428f sys/arch/mvmeppc/mvmeppc/machdep.c
--- a/sys/arch/mvmeppc/mvmeppc/machdep.c        Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/mvmeppc/mvmeppc/machdep.c        Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.31 2014/03/26 17:44:36 christos Exp $    */
+/*     $NetBSD: machdep.c,v 1.32 2021/02/27 01:31:24 thorpej Exp $     */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.31 2014/03/26 17:44:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.32 2021/02/27 01:31:24 thorpej Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_mvmetype.h"
@@ -148,7 +148,7 @@
                ns_per_tick = 1000000000 / ticks_per_sec;
        }
 
-       prep_initppc(startkernel, endkernel, boothowto);
+       prep_initppc(startkernel, endkernel, boothowto, 0);
 
        (*platform->pic_setup)();
 }
diff -r d003cd4b686e -r b4d56fe3428f sys/arch/powerpc/include/prep_bus.h
--- a/sys/arch/powerpc/include/prep_bus.h       Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/powerpc/include/prep_bus.h       Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prep_bus.h,v 1.3 2008/04/28 20:23:32 martin Exp $ */
+/* $NetBSD: prep_bus.h,v 1.4 2021/02/27 01:31:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 #include <machine/powerpc.h>
 
 void prep_bus_space_init(void);
-void prep_initppc(u_long, u_long, u_int);
+void prep_initppc(u_long, u_long, u_int, paddr_t, ...);
 void mem_regions(struct mem_region **, struct mem_region **);
 #endif
 
diff -r d003cd4b686e -r b4d56fe3428f sys/arch/powerpc/include/prep_bus_funcs.h
--- a/sys/arch/powerpc/include/prep_bus_funcs.h Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/powerpc/include/prep_bus_funcs.h Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prep_bus_funcs.h,v 1.1 2011/07/01 17:29:39 dyoung Exp $ */
+/* $NetBSD: prep_bus_funcs.h,v 1.2 2021/02/27 01:31:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 #include <machine/powerpc.h>
 
 void prep_bus_space_init(void);
-void prep_initppc(u_long, u_long, u_int);
+void prep_initppc(u_long, u_long, u_int, paddr_t, ...);
 void mem_regions(struct mem_region **, struct mem_region **);
 #endif
 
diff -r d003cd4b686e -r b4d56fe3428f sys/arch/powerpc/oea/prep_machdep.c
--- a/sys/arch/powerpc/oea/prep_machdep.c       Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/powerpc/oea/prep_machdep.c       Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prep_machdep.c,v 1.12 2020/07/06 09:34:17 rin Exp $ */
+/* $NetBSD: prep_machdep.c,v 1.13 2021/02/27 01:31:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: prep_machdep.c,v 1.12 2020/07/06 09:34:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prep_machdep.c,v 1.13 2021/02/27 01:31:23 thorpej Exp $");
 
 #include "ksyms.h"
 
@@ -136,25 +136,27 @@
  */
 
 void
-prep_initppc(u_long startkernel, u_long endkernel, u_int args)
+prep_initppc(u_long startkernel, u_long endkernel, u_int args, paddr_t pa, ...)
 {
+       va_list ap;
 
        /*
-        * Now setup fixed bat registers
-        * We setup the memory BAT, the IO space BAT, and a special
-        * BAT for certain machines that have rs6k style PCI bridges
-        * (only on port-prep)
+        * Set up fixed BAT registers.  We map the PReP IO and MEM
+        * space, plus any additional regions the platform wants.
         */
        oea_batinit(
            PREP_BUS_SPACE_MEM, BAT_BL_256M,
            PREP_BUS_SPACE_IO,  BAT_BL_256M,
-#if defined(bebox)
-           0x7ffff000, BAT_BL_8M,      /* BeBox Mainboard Registers (4KB) */
-#elif defined(prep)
-           0xbf800000, BAT_BL_8M,
-#endif
            0);
 
+       va_start(ap, pa);
+       while (pa != 0) {
+               register_t len = va_arg(ap, register_t);
+               oea_iobat_add(pa, len);
+               pa = va_arg(ap, paddr_t);
+       }
+       va_end(ap);
+
        /* Install vectors and interrupt handler. */
        oea_init(NULL);
 
diff -r d003cd4b686e -r b4d56fe3428f sys/arch/prep/prep/machdep.c
--- a/sys/arch/prep/prep/machdep.c      Sat Feb 27 01:22:18 2021 +0000
+++ b/sys/arch/prep/prep/machdep.c      Sat Feb 27 01:31:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.76 2018/08/27 17:17:25 martin Exp $      */
+/*     $NetBSD: machdep.c,v 1.77 2021/02/27 01:31:24 thorpej Exp $     */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.76 2018/08/27 17:17:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.77 2021/02/27 01:31:24 thorpej Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_openpic.h"
@@ -173,7 +173,10 @@
                busfreq = be32toh(vpd->ProcessorBusHz);
        }
 
-       prep_initppc(startkernel, endkernel, args);
+       prep_initppc(startkernel, endkernel, args,
+           /* rs6k-style PCI bridge */
+           0xbf800000, BAT_BL_8M,              /* XXX magic number */
+           0);
 }
 
 /*



Home | Main Index | Thread Index | Old Index