Don't put #ifdefs in prep_initppc(). Instead, let callers specify the

additional BAT-mapped regions they care about.
This commit is contained in:
thorpej 2021-02-27 01:31:23 +00:00
parent 88fd56785b
commit c9906b54e3
7 changed files with 37 additions and 28 deletions

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.108 2018/07/15 05:16:41 maxv Exp $");
#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 @@ initppc(u_long startkernel, u_long endkernel, u_int args, void *btinfo)
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);
}
/*

View File

@ -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 @@ initppc(u_long startkernel, u_long endkernel, u_int args, void *btinfo)
*/
boothowto = 0; /* XXX - should make this an option */
prep_initppc(startkernel, endkernel, args);
prep_initppc(startkernel, endkernel, args, 0);
}
/*

View File

@ -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 @@ initppc(u_long startkernel, u_long endkernel, void *btinfo)
ns_per_tick = 1000000000 / ticks_per_sec;
}
prep_initppc(startkernel, endkernel, boothowto);
prep_initppc(startkernel, endkernel, boothowto, 0);
(*platform->pic_setup)();
}

View File

@ -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 @@ extern struct powerpc_bus_space genppc_isa_mem_space_tag;
#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

View File

@ -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 @@ extern struct powerpc_bus_space genppc_isa_mem_space_tag;
#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

View File

@ -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 @@ prep_bus_space_init(void)
*/
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);

View File

@ -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 @@ initppc(u_long startkernel, u_long endkernel, u_int args, void *btinfo)
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);
}
/*