I will plan 2-steps for changing.
Step 1) Introduce all evbppc machine to mainbus as a root device.
Step 2) Prepare & Set cpu_attach_args (each 405xx).
(440xx will be future work.)
I attached a patch for applying (Step 1) in this mail.
Please review it.
If there is no objection, I will commit these changes.
How about above plan?
And have you any good(preferred) idea?
--
Kind Regards,
--- shige
Shigeyuki Fukushima <shige@{FreeBSD,jp.FreeBSD,NetBSD}.org>
? evbppc/evbppc/mainbus.c
? evbppc/evbppc/mainbusvar.h
Index: powerpc/conf/files.ibm4xx
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/conf/files.ibm4xx,v
retrieving revision 1.10
diff -u -r1.10 files.ibm4xx
--- powerpc/conf/files.ibm4xx 13 Mar 2006 15:31:11 -0000 1.10
+++ powerpc/conf/files.ibm4xx 4 May 2006 19:02:41 -0000
@@ -7,9 +7,14 @@
# Board Properties
file arch/powerpc/ibm4xx/board_prop.c
+# CPU
+device cpu { }
+attach cpu at mainbus
+file arch/powerpc/ibm4xx/cpu.c
+
# Processor Local Bus
device plb { [irq = -1] }
-attach plb at root
+attach plb at cpu
file arch/powerpc/ibm4xx/dev/plb.c plb
# On-chip Peripheral Bus
@@ -17,10 +22,6 @@
attach opb at plb
file arch/powerpc/ibm4xx/dev/opb.c opb
-device cpu {}
-attach cpu at plb
-file arch/powerpc/ibm4xx/cpu.c
-
device ecc
attach ecc at plb with ecc_plb
file arch/powerpc/ibm4xx/dev/ecc_plb.c ecc_plb
Index: powerpc/ibm4xx/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/cpu.c,v
retrieving revision 1.22
diff -u -r1.22 cpu.c
--- powerpc/ibm4xx/cpu.c 24 Dec 2005 22:45:36 -0000 1.22
+++ powerpc/ibm4xx/cpu.c 4 May 2006 19:02:41 -0000
@@ -46,7 +46,6 @@
#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
-#include <powerpc/ibm4xx/dev/plbvar.h>
struct cputab {
int version;
@@ -68,6 +67,9 @@
static int cpumatch(struct device *, struct cfdata *, void *);
static void cpuattach(struct device *, struct device *, void *);
+#ifndef PPC_IBM403
+static int cpu_core_print(void *, const char *);
+#endif
CFATTACH_DECL(cpu, sizeof(struct device),
cpumatch, cpuattach, NULL, NULL);
@@ -80,16 +82,12 @@
int cpufound = 0;
+
static int
cpumatch(struct device *parent, struct cfdata *cf, void *aux)
{
- struct plb_attach_args *paa = aux;
-
- /* make sure that we're looking for a CPU */
- if (strcmp(paa->plb_name, cf->cf_name) != 0)
- return (0);
- return !cpufound;
+ return 1;
}
static void
@@ -146,7 +144,21 @@
printf("PVR: owner %x core family %x cache %x version %x asic %x\n",
own, pcf, cas, pcl, aid);
#endif
+
+#ifndef PPC_IBM403
+ (void) config_found_ia(self, "cpu", NULL, cpu_core_print);
+#endif
+}
+
+#ifndef PPC_IBM403
+static int
+cpu_core_print(void *aux, const char *pnp)
+{
+
+ return (UNCONF);
}
+#endif
+
/*
* This routine must be explicitly called to initialize the
Index: powerpc/ibm4xx/dev/plb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/dev/plb.c,v
retrieving revision 1.14
diff -u -r1.14 plb.c
--- powerpc/ibm4xx/dev/plb.c 11 Dec 2005 12:18:42 -0000 1.14
+++ powerpc/ibm4xx/dev/plb.c 4 May 2006 19:02:41 -0000
@@ -86,7 +86,6 @@
* The devices that attach to the processor local bus on the 405GP
CPU.
*/
const struct plb_dev plb_devs [] = {
- { "cpu", },
{ "ecc", },
{ "opb", },
{ "pchb", },
Index: evbppc/conf/EXPLORA451
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/EXPLORA451,v
retrieving revision 1.25
diff -u -r1.25 EXPLORA451
--- evbppc/conf/EXPLORA451 19 Apr 2006 10:31:44 -0000 1.25
+++ evbppc/conf/EXPLORA451 4 May 2006 19:02:41 -0000
@@ -151,7 +151,8 @@
config netbsd root on ? type ?
-elb0 at root
+mainbus0 at root
+elb0 at mainbus?
cpu0 at elb?
com0 at elb?
Index: evbppc/conf/OPENBLOCKS200
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/OPENBLOCKS200,v
retrieving revision 1.14
diff -u -r1.14 OPENBLOCKS200
--- evbppc/conf/OPENBLOCKS200 29 Mar 2006 17:10:41 -0000 1.14
+++ evbppc/conf/OPENBLOCKS200 4 May 2006 19:02:42 -0000
@@ -133,11 +133,13 @@
# Device configuration
#
-plb0 at root # Processor Local Bus
+mainbus0 at root # Mainbus
-cpu0 at plb?
+cpu0 at mainbus? # CPU
-ecc0 at plb? irq 16 # On-chip ECC controller
+plb* at cpu? # Processor Local Bus
+
+ecc* at plb? irq 16 # On-chip ECC controller
opb* at plb? # On-chip Peripheral Bus
@@ -154,7 +156,7 @@
opbgpio0 at opb? addr ? irq ? # On-chip GPIO controller
gpio* at opbgpio? # GPIO bus
-pchb0 at plb? # PCI-Host bridges
+pchb* at plb? # PCI-Host bridges
pci* at pchb?
ppb* at pci? dev ? function ? # PCI-PCI bridges
Index: evbppc/conf/OPENBLOCKS266
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/OPENBLOCKS266,v
retrieving revision 1.32
diff -u -r1.32 OPENBLOCKS266
--- evbppc/conf/OPENBLOCKS266 2 Apr 2006 17:04:24 -0000 1.32
+++ evbppc/conf/OPENBLOCKS266 4 May 2006 19:02:42 -0000
@@ -152,10 +152,11 @@
# Device configuration
#
-plb0 at root # Processor Local Bus
-cpu0 at plb? # CPU
-ecc0 at plb? irq 16 # On-chip ECC controller
-pchb0 at plb? # PCI-Host bridges
+mainbus0 at root # Mainbus
+cpu0 at mainbus? # CPU
+plb* at cpu? # Processor Local Bus
+ecc* at plb? irq 16 # On-chip ECC controller
+pchb* at plb? # PCI-Host bridges
# On-chip Peripheral Bus support
opb* at plb? # On-chip Peripheral Bus
Index: evbppc/conf/WALNUT
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/WALNUT,v
retrieving revision 1.30
diff -u -r1.30 WALNUT
--- evbppc/conf/WALNUT 28 Mar 2006 20:58:39 -0000 1.30
+++ evbppc/conf/WALNUT 4 May 2006 19:02:42 -0000
@@ -135,9 +135,11 @@
# Device configuration
#
-plb0 at root # Processor Local Bus
+mainbus0 at root # MainBus
-cpu0 at plb?
+cpu0 at mainbus?
+
+plb0 at cpu? # Processor Local Bus
ecc0 at plb? irq 16 # On-chip ECC controller
@@ -241,7 +243,7 @@
sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
-pbus* at plb? # off-chip Peripheral BUS
+pbus* at mainbus? # off-chip Peripheral BUS
ds1743rtc0 at pbus? addr ? # RTC
todclock0 at ds1743rtc? # time-of-day device via rtc
device
Index: evbppc/conf/files.evbppc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/files.evbppc,v
retrieving revision 1.5
diff -u -r1.5 files.evbppc
--- evbppc/conf/files.evbppc 11 Dec 2005 12:17:11 -0000 1.5
+++ evbppc/conf/files.evbppc 4 May 2006 19:02:42 -0000
@@ -13,4 +13,9 @@
file arch/powerpc/powerpc/procfs_machdep.c procfs
file dev/cons.c
+# System bus
+device mainbus { }
+attach mainbus at root
+file arch/evbppc/evbppc/mainbus.c mainbus
+
include "arch/evbppc/conf/majors.evbppc"
Index: evbppc/conf/files.explora
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/files.explora,v
retrieving revision 1.5
diff -u -r1.5 files.explora
--- evbppc/conf/files.explora 11 Dec 2005 12:17:11 -0000 1.5
+++ evbppc/conf/files.explora 4 May 2006 19:02:42 -0000
@@ -22,7 +22,7 @@
# Explora local bus
device elb {}
-attach elb at root
+attach elb at mainbus
file arch/evbppc/explora/dev/elb.c elb
device cpu
Index: evbppc/conf/files.obs200
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/files.obs200,v
retrieving revision 1.3
diff -u -r1.3 files.obs200
--- evbppc/conf/files.obs200 29 Mar 2006 17:46:42 -0000 1.3
+++ evbppc/conf/files.obs200 4 May 2006 19:02:42 -0000
@@ -4,7 +4,6 @@
# obs200-specific configuration info
file arch/powerpc/ibm4xx/ibm4xx_autoconf.c
-file arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c
file arch/powerpc/ibm4xx/ibm40x_machdep.c
file arch/powerpc/ibm4xx/ibm4xx_machdep.c
file arch/powerpc/ibm4xx/intr.c
Index: evbppc/conf/files.obs405
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/files.obs405,v
retrieving revision 1.15
diff -u -r1.15 files.obs405
--- evbppc/conf/files.obs405 13 Mar 2006 16:20:58 -0000 1.15
+++ evbppc/conf/files.obs405 4 May 2006 19:02:42 -0000
@@ -3,7 +3,6 @@
# obs405-specific configuration info
file arch/powerpc/ibm4xx/ibm4xx_autoconf.c
-file arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c
file arch/powerpc/ibm4xx/ibm40x_machdep.c
file arch/powerpc/ibm4xx/ibm4xx_machdep.c
file arch/powerpc/ibm4xx/intr.c
Index: evbppc/conf/files.walnut
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/files.walnut,v
retrieving revision 1.9
diff -u -r1.9 files.walnut
--- evbppc/conf/files.walnut 27 Feb 2006 11:04:31 -0000 1.9
+++ evbppc/conf/files.walnut 4 May 2006 19:02:42 -0000
@@ -43,7 +43,7 @@
# Off-chip peripheral bus
device pbus {[addr=-1], [irq=-1]}
-attach pbus at plb
+attach pbus at mainbus
file arch/evbppc/walnut/dev/pbus.c pbus
define todservice {}
Index: evbppc/explora/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/explora/autoconf.c,v
retrieving revision 1.6
diff -u -r1.6 autoconf.c
--- evbppc/explora/autoconf.c 24 Dec 2005 22:45:35 -0000 1.6
+++ evbppc/explora/autoconf.c 4 May 2006 19:02:42 -0000
@@ -44,13 +44,24 @@
#include <sys/device.h>
#include <sys/systm.h>
+#include <evbppc/evbppc/mainbusvar.h>
+
+/*
+ * List of port-specific devices to attach to the mainbus.
+ */
+static const struct mainbusdev machine_mainbus_devs[] = {
+ { "elb", },
+ { NULL }
+};
+
+
void
cpu_configure(void)
{
intr_init();
calc_delayconst();
- if (config_rootfound("elb", NULL) == NULL)
+ if (config_rootfound("mainbus", &machine_mainbus_devs) == NULL)
panic("configure: elb not configured");
printf("biomask %x netmask %x ttymask %x\n", (u_short)imask
[IPL_BIO],
Index: evbppc/obs405/obs200_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/obs405/obs200_autoconf.c,v
retrieving revision 1.2
diff -u -r1.2 obs200_autoconf.c
--- evbppc/obs405/obs200_autoconf.c 11 Dec 2005 12:17:12 -0000 1.2
+++ evbppc/obs405/obs200_autoconf.c 4 May 2006 19:02:42 -0000
@@ -40,6 +40,44 @@
#include <machine/obs200.h>
+#include <powerpc/ibm4xx/dcr405gp.h>
+#include <evbppc/evbppc/mainbusvar.h>
+
+/*
+ * List of port-specific devices to attach to the mainbus.
+ */
+static const struct mainbusdev machine_mainbus_devs[] = {
+ { "cpu", },
+ { NULL }
+};
+
+/*
+ * Determine device configuration for a machine.
+ */
+void
+cpu_configure(void)
+{
+
+ intr_init();
+ calc_delayconst();
+
+ /* Make sure that timers run at CPU frequency */
+ mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
+
+ if (config_rootfound("mainbus", &machine_mainbus_devs) == NULL)
+ panic("configure: mainbus not configured");
+
+ printf("biomask %x netmask %x ttymask %x\n", (u_short)imask
[IPL_BIO],
+ (u_short)imask[IPL_NET], (u_short)imask[IPL_TTY]);
+
+ (void)spl0();
+
+ /*
+ * Now allow hardware interrupts.
+ */
+ __asm volatile ("wrteei 1");
+}
+
void device_register(struct device *dev, void *aux)
{
Index: evbppc/obs405/obs266_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/obs405/obs266_autoconf.c,v
retrieving revision 1.2
diff -u -r1.2 obs266_autoconf.c
--- evbppc/obs405/obs266_autoconf.c 11 Dec 2005 12:17:12 -0000 1.2
+++ evbppc/obs405/obs266_autoconf.c 4 May 2006 19:02:42 -0000
@@ -40,6 +40,44 @@
#include <machine/obs266.h>
+#include <powerpc/ibm4xx/dcr405gp.h>
+#include <evbppc/evbppc/mainbusvar.h>
+
+/*
+ * List of port-specific devices to attach to the mainbus.
+ */
+static const struct mainbusdev machine_mainbus_devs[] = {
+ { "cpu", },
+ { NULL }
+};
+
+/*
+ * Determine device configuration for a machine.
+ */
+void
+cpu_configure(void)
+{
+
+ intr_init();
+ calc_delayconst();
+
+ /* Make sure that timers run at CPU frequency */
+ mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
+
+ if (config_rootfound("mainbus", &machine_mainbus_devs) == NULL)
+ panic("configure: mainbus not configured");
+
+ printf("biomask %x netmask %x ttymask %x\n", (u_short)imask
[IPL_BIO],
+ (u_short)imask[IPL_NET], (u_short)imask[IPL_TTY]);
+
+ (void)spl0();
+
+ /*
+ * Now allow hardware interrupts.
+ */
+ __asm volatile ("wrteei 1");
+}
+
void device_register(struct device *dev, void *aux)
{
Index: evbppc/walnut/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/walnut/autoconf.c,v
retrieving revision 1.13
diff -u -r1.13 autoconf.c
--- evbppc/walnut/autoconf.c 26 Feb 2006 05:51:52 -0000 1.13
+++ evbppc/walnut/autoconf.c 4 May 2006 19:02:42 -0000
@@ -41,13 +41,14 @@
#include <dev/ic/comreg.h> /* For COM_FREQ */
+#include <evbppc/evbppc/mainbusvar.h>
#include <powerpc/ibm4xx/dcr405gp.h>
-#include <powerpc/ibm4xx/dev/plbvar.h>
/*
* List of port-specific devices to attach to the processor local
bus.
*/
-static const struct plb_dev local_plb_devs [] = {
+static const struct mainbusdev machine_mainbus_devs[] = {
+ { "cpu", },
{ "pbus", },
{ NULL }
};
@@ -65,7 +66,7 @@
/* Make sure that timers run at CPU frequency */
mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
- if (config_rootfound("plb", &local_plb_devs) == NULL)
+ if (config_rootfound("mainbus", &machine_mainbus_devs) == NULL)
panic("configure: plb not configured");
printf("biomask %x netmask %x ttymask %x\n", (u_short)imask
[IPL_BIO],
/* $NetBSD$ */
/*
* Copyright (c) 2006 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed
* to The NetBSD Foundation, Inc.
* by Shigeyuki Fukushima.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
copyright
* notice, this list of conditions and the following disclaimer
in the
* documentation and/or other materials provided with the
distribution.
* 3. All advertising materials mentioning features or use of this
software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <evbppc/evbppc/mainbusvar.h>
#include "locators.h"
static int mainbus_match(struct device *, struct cfdata *, void *);
static void mainbus_attach(struct device *, struct device *, void *);
static int mainbus_print(void *, const char *);
CFATTACH_DECL(mainbus, sizeof(struct device),
mainbus_match, mainbus_attach, NULL, NULL);
static int mainbus_found;
static int
mainbus_match(struct device *parent, struct cfdata *match, void *aux)
{
if (mainbus_found)
return 0;
return 1;
}
static void
mainbus_attach(struct device *parent, struct device *self, void *aux)
{
struct mainbusdev *machine_devs = aux;
mainbus_found = 1;
printf("\n");
while (machine_devs && machine_devs->dev_name != NULL) {
(void) config_found_ia(self, "mainbus", NULL, mainbus_print);
machine_devs++;
}
}
static int
mainbus_print(void *aux, const char *pnp)
{
return (UNCONF);
}
/* $NetBSD$ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed
* to The NetBSD Foundation, Inc.
* by Shigeyuki Fukushima.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
copyright
* notice, this list of conditions and the following disclaimer
in the
* documentation and/or other materials provided with the
distribution.
* 3. All advertising materials mentioning features or use of this
software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _EVBPPC_EVBPPC_MAINBUS_H_
#define _EVBPPC_EVBPPC_MAINBUS_H_
struct mainbusdev {
const char *dev_name; /* device name */
};
#endif /* _EVBPPC_EVBPPC_MAINBUS_H_ */