Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Reorganise the IBM 4xx bus layout, using terminolog...



details:   https://anonhg.NetBSD.org/src/rev/07543e035783
branches:  trunk
changeset: 535204:07543e035783
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Aug 12 02:06:18 2002 +0000

description:
Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
 - Remove "mainbus" altogether.
 - The new root is "plb" - the Processor Local Bus.
 - Attached to this is the "opb" - the On-chip Peripheral Bus, to which
   all the on-chip devices are attached (except the cpu and pci host
   bridge).
 - Port-specific code can pass an array of 'struct plb_dev' to
   config_rootfound() to attach extra devices to the plb.  The walnut
   port attaches a "pbus" (Peripheral Bus) in here for the RTC and
   pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.

diffstat:

 sys/arch/powerpc/ibm4xx/cpu.c             |    8 +-
 sys/arch/powerpc/ibm4xx/dev/com_mainbus.c |  101 -------------
 sys/arch/powerpc/ibm4xx/dev/com_opb.c     |  100 +++++++++++++
 sys/arch/powerpc/ibm4xx/dev/if_emac.c     |   31 ++--
 sys/arch/powerpc/ibm4xx/dev/opb.c         |  172 +++++++++++++++++++++++
 sys/arch/powerpc/ibm4xx/dev/opbvar.h      |   46 ++++++
 sys/arch/powerpc/ibm4xx/dev/plb.c         |  156 +++++++++++++++++++++
 sys/arch/powerpc/ibm4xx/dev/plbvar.h      |   48 ++++++
 sys/arch/powerpc/ibm4xx/dev/wdog.c        |    9 +-
 sys/arch/powerpc/ibm4xx/mainbus.c         |  148 --------------------
 sys/arch/walnut/conf/WALNUT               |   39 +++--
 sys/arch/walnut/conf/files.walnut         |   43 +++--
 sys/arch/walnut/dev/ds1743.c              |   18 +-
 sys/arch/walnut/dev/pbus.c                |  206 ++++++++++++++++++++++++++++
 sys/arch/walnut/dev/pbusvar.h             |   46 ++++++
 sys/arch/walnut/dev/pckbc_mainbus.c       |  153 ---------------------
 sys/arch/walnut/dev/pckbc_pbus.c          |  153 +++++++++++++++++++++
 sys/arch/walnut/include/autoconf.h        |   48 ------
 sys/arch/walnut/pci/pchb.c                |   10 +-
 sys/arch/walnut/walnut/autoconf.c         |   47 ++----
 sys/arch/walnut/walnut/mainbus.c          |  217 ------------------------------
 21 files changed, 1028 insertions(+), 771 deletions(-)

diffs (truncated from 2129 to 300 lines):

diff -r 53c1f8afe059 -r 07543e035783 sys/arch/powerpc/ibm4xx/cpu.c
--- a/sys/arch/powerpc/ibm4xx/cpu.c     Mon Aug 12 01:03:12 2002 +0000
+++ b/sys/arch/powerpc/ibm4xx/cpu.c     Mon Aug 12 02:06:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.3 2002/07/11 01:38:48 simonb Exp $   */
+/*     $NetBSD: cpu.c,v 1.4 2002/08/12 02:06:18 simonb Exp $   */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,9 +40,9 @@
 #include <sys/device.h>
 #include <sys/properties.h>
 
-#include <machine/autoconf.h>
 #include <machine/dcr.h>
 #include <machine/cpu.h>
+#include <powerpc/ibm4xx/dev/plbvar.h>
 
 struct cputab {
        int version;
@@ -86,10 +86,10 @@
 static int
 cpumatch(struct device *parent, struct cfdata *cf, void *aux)
 {
-       struct mainbus_attach_args *maa = aux;
+       struct plb_attach_args *paa = aux;
 
        /* make sure that we're looking for a CPU */
-       if (strcmp(maa->mb_name, cf->cf_driver->cd_name) != 0)
+       if (strcmp(paa->plb_name, cf->cf_driver->cd_name) != 0)
                return (0);
 
        return !cpufound;
diff -r 53c1f8afe059 -r 07543e035783 sys/arch/powerpc/ibm4xx/dev/com_mainbus.c
--- a/sys/arch/powerpc/ibm4xx/dev/com_mainbus.c Mon Aug 12 01:03:12 2002 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*     $NetBSD: com_mainbus.c,v 1.4 2002/03/13 19:13:10 eeh Exp $      */
-
-/*
- * Copyright 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
- *
- * 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 for the NetBSD Project by
- *      Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- *    or promote products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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/param.h>
-#include <sys/device.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-
-#include <lib/libkern/libkern.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-struct com_mainbus_softc {
-       struct com_softc sc_com;
-       void *sc_ih;
-};
-
-static int     com_mainbus_probe(struct device *, struct cfdata *, void *);
-static void    com_mainbus_attach(struct device *, struct device *, void *);
-
-struct cfattach com_mainbus_ca = {
-       sizeof(struct com_mainbus_softc), com_mainbus_probe, com_mainbus_attach
-};
-
-int comfound = 0;
-
-int
-com_mainbus_probe(struct device *parent, struct cfdata *cf, void *aux)
-{
-       struct mainbus_attach_args *maa = aux;
-
-       /* match only com devices */
-       if (strcmp(maa->mb_name, cf->cf_driver->cd_name) != 0)
-               return 0;
-
-       return (comfound < 2);
-}
-
-struct com_softc *com0; /* XXX */
-
-void
-com_mainbus_attach(struct device *parent, struct device *self, void *aux)
-{
-       struct com_mainbus_softc *msc = (void *)self;
-       struct com_softc *sc = &msc->sc_com;
-       struct mainbus_attach_args *maa = aux;
-       int addr = maa->mb_addr;
-       int irq = maa->mb_irq;
-       
-       sc->sc_iot = galaxy_make_bus_space_tag(0, 0);
-       sc->sc_iobase = sc->sc_ioh = addr;
-       /* UART is clocked externally @ 11.0592MHz == COM_FREQ*6 */
-       sc->sc_frequency = COM_FREQ * 6;
-
-       comfound ++;
-
-       /* XXX console check */
-       /* XXX map */
-
-       com_attach_subr(sc);
-
-       intr_establish(irq, IST_LEVEL, IPL_SERIAL, comintr, sc);
-}
diff -r 53c1f8afe059 -r 07543e035783 sys/arch/powerpc/ibm4xx/dev/com_opb.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/com_opb.c     Mon Aug 12 02:06:18 2002 +0000
@@ -0,0 +1,100 @@
+/* $NetBSD: com_opb.c,v 1.1 2002/08/12 02:06:20 simonb Exp $ */
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
+ *
+ * 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 for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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/param.h>
+#include <sys/device.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+
+#include <lib/libkern/libkern.h>
+
+#include <powerpc/ibm4xx/dev/opbvar.h>
+
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+
+struct com_opb_softc {
+       struct com_softc sc_com;
+       void *sc_ih;
+};
+
+static int     com_opb_probe(struct device *, struct cfdata *, void *);
+static void    com_opb_attach(struct device *, struct device *, void *);
+
+struct cfattach com_opb_ca = {
+       sizeof(struct com_opb_softc), com_opb_probe, com_opb_attach
+};
+
+int comfound = 0;
+
+int
+com_opb_probe(struct device *parent, struct cfdata *cf, void *aux)
+{
+       struct opb_attach_args *oaa = aux;
+
+       /* match only com devices */
+       if (strcmp(oaa->opb_name, cf->cf_driver->cd_name) != 0)
+               return 0;
+
+       return (comfound < 2);
+}
+
+struct com_softc *com0; /* XXX */
+
+void
+com_opb_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct com_opb_softc *msc = (void *)self;
+       struct com_softc *sc = &msc->sc_com;
+       struct opb_attach_args *oaa = aux;
+       int addr = oaa->opb_addr;
+       int irq = oaa->opb_irq;
+       
+       sc->sc_iot = oaa->opb_bt;
+       sc->sc_iobase = sc->sc_ioh = addr;
+       /* UART is clocked externally @ 11.0592MHz == COM_FREQ*6 */
+       sc->sc_frequency = COM_FREQ * 6;
+
+       comfound++;
+
+       /* XXX console check */
+       /* XXX map */
+
+       com_attach_subr(sc);
+
+       intr_establish(irq, IST_LEVEL, IPL_SERIAL, comintr, sc);
+}
diff -r 53c1f8afe059 -r 07543e035783 sys/arch/powerpc/ibm4xx/dev/if_emac.c
--- a/sys/arch/powerpc/ibm4xx/dev/if_emac.c     Mon Aug 12 01:03:12 2002 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/if_emac.c     Mon Aug 12 02:06:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_emac.c,v 1.4 2002/08/09 14:10:30 simonb Exp $       */
+/*     $NetBSD: if_emac.c,v 1.5 2002/08/12 02:06:20 simonb Exp $       */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -55,8 +55,7 @@
 #include <net/bpf.h>
 #endif
 
-#include <machine/bus.h>
-#include <machine/autoconf.h>  /* for mainbus_attach_args; should use imb4xx opb */
+#include <powerpc/ibm4xx/dev/opbvar.h>
 
 #include <powerpc/ibm4xx/ibm405gp.h>
 #include <powerpc/ibm4xx/mal405gp.h>
@@ -278,10 +277,10 @@
 static int
 emac_match(struct device *parent, struct cfdata *cf, void *aux)
 {
-       struct mainbus_attach_args *maa = aux;
+       struct opb_attach_args *oaa = aux;
 
        /* match only on-chip ethernet devices */
-       if (strcmp(maa->mb_name, cf->cf_driver->cd_name) == 0)
+       if (strcmp(oaa->opb_name, cf->cf_driver->cd_name) == 0)
                return (1);
 
        return (0);
@@ -290,7 +289,7 @@
 static void
 emac_attach(struct device *parent, struct device *self, void *aux)
 {
-       struct mainbus_attach_args *maa = aux;
+       struct opb_attach_args *oaa = aux;
        struct emac_softc *sc = (struct emac_softc *)self;
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct mii_data *mii = &sc->sc_mii;
@@ -298,8 +297,8 @@
        int error, i, nseg;
 
        sc->sc_st = galaxy_make_bus_space_tag(0, 0);
-       sc->sc_sh = maa->mb_addr;
-       sc->sc_dmat = maa->mb_dmat;
+       sc->sc_sh = oaa->opb_addr;
+       sc->sc_dmat = oaa->opb_dmat;
 
        printf(": 405GP EMAC\n");
 
@@ -311,15 +310,15 @@
         */
        sc->sc_mr1 = MR1_RFS_4KB | MR1_TFS_2KB | MR1_TR0_MULTIPLE;
 
-       intr_establish(maa->mb_irq    , IST_LEVEL, IPL_NET, emac_wol_intr, sc);
-       intr_establish(maa->mb_irq + 1, IST_LEVEL, IPL_NET, emac_serr_intr, sc);



Home | Main Index | Thread Index | Old Index