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.
This commit is contained in:
simonb 2002-08-12 02:06:18 +00:00
parent 7d2b11a8b0
commit 6bf1aaf8eb
17 changed files with 609 additions and 352 deletions

View File

@ -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 @@ int cpufound = 0;
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: com_mainbus.c,v 1.4 2002/03/13 19:13:10 eeh Exp $ */
/* $NetBSD: com_opb.c,v 1.1 2002/08/12 02:06:20 simonb Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -42,33 +42,32 @@
#include <lib/libkern/libkern.h>
#include <machine/autoconf.h>
#include <machine/bus.h>
#include <powerpc/ibm4xx/dev/opbvar.h>
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
struct com_mainbus_softc {
struct com_opb_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 *);
static int com_opb_probe(struct device *, struct cfdata *, void *);
static void com_opb_attach(struct device *, struct device *, void *);
struct cfattach com_mainbus_ca = {
sizeof(struct com_mainbus_softc), com_mainbus_probe, com_mainbus_attach
struct cfattach com_opb_ca = {
sizeof(struct com_opb_softc), com_opb_probe, com_opb_attach
};
int comfound = 0;
int
com_mainbus_probe(struct device *parent, struct cfdata *cf, void *aux)
com_opb_probe(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_attach_args *maa = aux;
struct opb_attach_args *oaa = aux;
/* match only com devices */
if (strcmp(maa->mb_name, cf->cf_driver->cd_name) != 0)
if (strcmp(oaa->opb_name, cf->cf_driver->cd_name) != 0)
return 0;
return (comfound < 2);
@ -77,20 +76,20 @@ com_mainbus_probe(struct device *parent, struct cfdata *cf, void *aux)
struct com_softc *com0; /* XXX */
void
com_mainbus_attach(struct device *parent, struct device *self, void *aux)
com_opb_attach(struct device *parent, struct device *self, void *aux)
{
struct com_mainbus_softc *msc = (void *)self;
struct com_opb_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;
struct opb_attach_args *oaa = aux;
int addr = oaa->opb_addr;
int irq = oaa->opb_irq;
sc->sc_iot = galaxy_make_bus_space_tag(0, 0);
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 ++;
comfound++;
/* XXX console check */
/* XXX map */

View File

@ -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 @@ struct cfattach emac_ca = {
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 @@ emac_match(struct device *parent, struct cfdata *cf, void *aux)
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 @@ emac_attach(struct device *parent, struct device *self, void *aux)
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 @@ emac_attach(struct device *parent, struct device *self, void *aux)
*/
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);
intr_establish(maa->mb_irq + 2, IST_LEVEL, IPL_NET, emac_txeob_intr, sc);
intr_establish(maa->mb_irq + 3, IST_LEVEL, IPL_NET, emac_rxeob_intr, sc);
intr_establish(maa->mb_irq + 4, IST_LEVEL, IPL_NET, emac_txde_intr, sc);
intr_establish(maa->mb_irq + 5, IST_LEVEL, IPL_NET, emac_rxde_intr, sc);
intr_establish(maa->mb_irq + 6, IST_LEVEL, IPL_NET, emac_intr, sc);
intr_establish(oaa->opb_irq , IST_LEVEL, IPL_NET, emac_wol_intr, sc);
intr_establish(oaa->opb_irq + 1, IST_LEVEL, IPL_NET, emac_serr_intr, sc);
intr_establish(oaa->opb_irq + 2, IST_LEVEL, IPL_NET, emac_txeob_intr, sc);
intr_establish(oaa->opb_irq + 3, IST_LEVEL, IPL_NET, emac_rxeob_intr, sc);
intr_establish(oaa->opb_irq + 4, IST_LEVEL, IPL_NET, emac_txde_intr, sc);
intr_establish(oaa->opb_irq + 5, IST_LEVEL, IPL_NET, emac_rxde_intr, sc);
intr_establish(oaa->opb_irq + 6, IST_LEVEL, IPL_NET, emac_intr, sc);
printf("%s: interrupting at irqs %d .. %d\n", sc->sc_dev.dv_xname,
maa->mb_irq, maa->mb_irq + 6);
oaa->opb_irq, oaa->opb_irq + 6);
/*
* Allocate the control data structures, and create and load the

View File

@ -0,0 +1,172 @@
/* $NetBSD: opb.c,v 1.1 2002/08/12 02:06:20 simonb Exp $ */
/*
* Copyright 2001,2002 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.
*/
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
*
* 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 Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "locators.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/malloc.h>
#define _GALAXY_BUS_DMA_PRIVATE
#include <machine/walnut.h>
#include <powerpc/ibm4xx/dev/opbvar.h>
#include <powerpc/ibm4xx/ibm405gp.h>
/*
* The devices on the On-chip Peripheral Bus to the 405GP cpu.
*/
const struct opb_dev {
const char *name;
bus_addr_t addr;
int irq;
} opb_devs [] = {
{ "com", UART0_BASE, 0 },
{ "com", UART1_BASE, 1 },
{ "emac", EMAC0_BASE, 9 }, /* XXX: really irq 9..15 */
{ "gpio", GPIO0_BASE, -1 },
{ "iic", IIC0_BASE, 2 },
{ "wdog", -1, -1 },
{ NULL }
};
static int opb_match(struct device *, struct cfdata *, void *);
static void opb_attach(struct device *, struct device *, void *);
static int opb_submatch(struct device *, struct cfdata *, void *);
static int opb_print(void *, const char *);
struct cfattach opb_ca = {
sizeof(struct device), opb_match, opb_attach
};
/*
* Probe for the opb; always succeeds.
*/
static int
opb_match(struct device *parent, struct cfdata *cf, void *aux)
{
struct opb_attach_args *oaa = aux;
/* match only opb devices */
if (strcmp(oaa->opb_name, cf->cf_driver->cd_name) != 0)
return (0);
return (1);
}
static int
opb_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct opb_attach_args *oaa = aux;
if (cf->cf_loc[OPBCF_ADDR] != OPBCF_ADDR_DEFAULT &&
cf->cf_loc[OPBCF_ADDR] != oaa->opb_addr)
return (0);
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
}
/*
* Attach the on-chip peripheral bus.
*/
static void
opb_attach(struct device *parent, struct device *self, void *aux)
{
struct opb_attach_args oaa;
int i;
printf("\n");
for (i = 0; opb_devs[i].name != NULL; i++) {
oaa.opb_name = opb_devs[i].name;
oaa.opb_addr = opb_devs[i].addr;
oaa.opb_irq = opb_devs[i].irq;
oaa.opb_bt = galaxy_make_bus_space_tag(0, 0);
oaa.opb_dmat = &galaxy_default_bus_dma_tag;
(void) config_found_sm(self, &oaa, opb_print, opb_submatch);
}
}
static int
opb_print(void *aux, const char *pnp)
{
struct opb_attach_args *oaa = aux;
if (pnp)
printf("%s at %s", oaa->opb_name, pnp);
if (oaa->opb_addr != OPBCF_ADDR_DEFAULT)
printf(" addr 0x%08lx", oaa->opb_addr);
if (oaa->opb_irq != OPBCF_IRQ_DEFAULT)
printf(" irq %d", oaa->opb_irq);
return (UNCONF);
}

View File

@ -0,0 +1,46 @@
/* $NetBSD: opbvar.h,v 1.1 2002/08/12 02:06:20 simonb Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by 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 <machine/bus.h>
struct opb_attach_args {
const char *opb_name;
u_long opb_addr;
int opb_irq;
bus_space_tag_t opb_bt; /* Bus space tag */
bus_dma_tag_t opb_dmat; /* DMA tag */
};

View File

@ -0,0 +1,156 @@
/* $NetBSD: plb.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.
*/
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
*
* 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 Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "locators.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/malloc.h>
#define _GALAXY_BUS_DMA_PRIVATE
#include <powerpc/ibm4xx/dev/plbvar.h>
#include <powerpc/ibm4xx/ibm405gp.h>
/*
* The devices that attach to the processor local bus on the 405GP cpu.
*/
const struct plb_dev plb_devs [] = {
{ "cpu", },
{ "opb", },
{ "pchb", },
{ NULL }
};
static int plb_match(struct device *, struct cfdata *, void *);
static void plb_attach(struct device *, struct device *, void *);
static int plb_submatch(struct device *, struct cfdata *, void *);
static int plb_print(void *, const char *);
struct cfattach plb_ca = {
sizeof(struct device), plb_match, plb_attach
};
/*
* Probe for the plb; always succeeds.
*/
static int
plb_match(struct device *parent, struct cfdata *cf, void *aux)
{
return (1);
}
static int
plb_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
}
/*
* Attach the processor local bus.
*/
static void
plb_attach(struct device *parent, struct device *self, void *aux)
{
struct plb_attach_args paa;
struct plb_dev *local_plb_devs = aux;
int i;
printf("\n");
for (i = 0; plb_devs[i].plb_name != NULL; i++) {
paa.plb_name = plb_devs[i].plb_name;
paa.plb_bt = galaxy_make_bus_space_tag(0, 0);
paa.plb_dmat = &galaxy_default_bus_dma_tag;
(void) config_found_sm(self, &paa, plb_print, plb_submatch);
}
while (local_plb_devs && local_plb_devs->plb_name != NULL) {
paa.plb_name = local_plb_devs->plb_name;
paa.plb_bt = galaxy_make_bus_space_tag(0, 0);
paa.plb_dmat = &galaxy_default_bus_dma_tag;
(void) config_found_sm(self, &paa, plb_print, plb_submatch);
local_plb_devs++;
}
}
static int
plb_print(void *aux, const char *pnp)
{
struct plb_attach_args *paa = aux;
if (pnp)
printf("%s at %s", paa->plb_name, pnp);
return (UNCONF);
}

View File

@ -1,10 +1,10 @@
/* $NetBSD: autoconf.h,v 1.2 2002/03/13 19:19:49 eeh Exp $ */
/* $NetBSD: plbvar.h,v 1.1 2002/08/12 02:06:21 simonb Exp $ */
/*
* Copyright 2001-2002 Wasabi Systems, Inc.
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
* Written by 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
@ -37,12 +37,12 @@
#include <machine/bus.h>
struct mainbus_attach_args {
const char *mb_name;
u_long mb_addr;
int mb_irq;
bus_space_tag_t mb_bt; /* Bus space tag */
bus_dma_tag_t mb_dmat; /* DMA tag */
struct plb_dev {
const char *plb_name;
};
void *mapiodev(paddr_t, psize_t);
struct plb_attach_args {
const char *plb_name;
bus_space_tag_t plb_bt; /* Bus space tag */
bus_dma_tag_t plb_dmat; /* DMA tag */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdog.c,v 1.1 2002/08/01 23:15:37 simonb Exp $ */
/* $NetBSD: wdog.c,v 1.2 2002/08/12 02:06:21 simonb Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@ -45,9 +45,8 @@
#include <sys/properties.h>
#include <sys/wdog.h>
#include <machine/autoconf.h>
#include <powerpc/spr.h>
#include <powerpc/ibm4xx/dev/opbvar.h>
#include <dev/sysmon/sysmonvar.h>
@ -70,10 +69,10 @@ struct cfattach wdog_ca = {
static int
wdog_match(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_attach_args *maa = aux;
struct opb_attach_args *oaa = aux;
/* match only watchdog devices */
if (strcmp(maa->mb_name, cf->cf_driver->cd_name) != 0)
if (strcmp(oaa->opb_name, cf->cf_driver->cd_name) != 0)
return (0);
return (1);

View File

@ -1,148 +0,0 @@
/* $NetBSD: mainbus.c,v 1.2 2002/07/11 01:38:48 simonb Exp $ */
/*
* Copyright 2002 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 "locators.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/malloc.h>
#define _GALAXY_BUS_DMA_PRIVATE
#include <machine/autoconf.h>
#include <machine/bus.h>
static int mainbus_match(struct device *, struct cfdata *, void *);
static void mainbus_attach(struct device *, struct device *, void *);
static int mainbus_submatch(struct device *, struct cfdata *, void *);
static int mainbus_print(void *, const char *);
struct mainbus_softc {
struct device sc_dev;
bus_space_tag_t sc_bt;
bus_dma_tag_t sc_dmat;
}
struct cfattach mainbus_ca = {
sizeof(struct device), mainbus_match, mainbus_attach
};
/*
* Probe for the mainbus; always succeeds.
*/
static int
mainbus_match(struct device *parent, struct cfdata *match, void *aux)
{
return 1;
}
static int
mainbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
union mainbus_attach_args *maa = aux;
if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT &&
cf->cf_loc[MAINBUSCF_ADDR] != maa->mba_rmb.rmb_addr)
return (0);
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
}
static int
mainbus_search(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_softc *sc = (struct mainbus_softc *)parent;
struct mainbus_attach_args mba;
int tryagain;
do {
mba.mba_name = cf->cf_driver->name;
mba.mba_addr = cf->cf_loc[MAINBUSCF_ADDR];
mba.mba_irq = cf->cf_loc[MAINBUSCF_INTR];
tryagain = 0;
if ((*cf->cf_attach->ca_match)(parent, cf, &mba) > 0) {
config_attach(parent, cf, &mba, mainbus_print);
tryagain = (cf->cf_fstate == FSTATE_STAR);
}
} while (tryagain);
return (0);
}
/*
* Attach the mainbus.
*/
static void
mainbus_attach(struct device *parent, struct device *self, void *aux)
{
struct mainbus_softc *sc = (struct mainbus_softc *)self;
union mainbus_attach_args mba;
/* Create a bustag and dmatag */
sc->sc_bt = galaxy_make_bus_space_tag(0, 0);
sc->sc_dmat = &galaxy_default_bus_dma_tag;
/* Attach the CPU first */
mba.mba_name = "cpu";
mba.mba_addr = MAINBUSCF_ADDR_DEFAULT;
mba.mba_irq = MAINBUSCF_IRQ_DEFAULT;
mba.mba_bt = sc->bt;
mba.mba_dmat = sc->dmat;
config_found(self, &mba, mainbus_print);
/* Attach all other devices. */
config_search(mainbus_search, self, NULL);
}
static int
mainbus_print(void *aux, const char *pnp)
{
union mainbus_attach_args *mba = aux;
if (pnp)
printf("%s at %s", mba->mba_busname, pnp);
if (mba->mba_rmb.rmb_addr != MAINBUSCF_ADDR_DEFAULT)
printf(" addr 0x%08lx", mba->mba_rmb.rmb_addr);
if (mba->mba_rmb.rmb_irq != MAINBUSCF_IRQ_DEFAULT)
printf(" irq %d", mba->mba_rmb.rmb_irq);
return (UNCONF);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: WALNUT,v 1.22 2002/08/01 23:17:04 simonb Exp $
# $NetBSD: WALNUT,v 1.23 2002/08/12 02:06:21 simonb Exp $
#
# GENERIC -- everything that's currently supported
#
@ -127,20 +127,20 @@ config netbsd root on ? type ?
# Device configuration
#
mainbus0 at root
plb0 at root # Processor Local Bus
cpu0 at mainbus0
cpu0 at plb?
com0 at mainbus? addr 0xef600300 irq 0 # UARTs
com1 at mainbus? addr 0xef600400 irq 1
opb* at plb? # On-chip Peripheral Bus
emac0 at mainbus? addr 0xef600800 irq 15 # Ethernet Media Access Controller
wdog* at mainbus? # Watchdog timer
wdog* at opb? # Watchdog timer
dsrtc0 at mainbus? addr 0xf0000000 # RTC
todclock0 at dsrtc? # time-of-day device via rtc device
com* at opb? addr ? irq ? # UARTs
pchb0 at mainbus? # PCI-Host bridges
emac0 at opb? addr ? irq ? # Ethernet Media Access Controller
options EMAC_EVENT_COUNTERS
pchb0 at plb? # PCI-Host bridges
pci* at pchb?
ppb* at pci? dev ? function ? # PCI-PCI bridges
@ -217,14 +217,19 @@ cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
pckbc0 at mainbus?
pckbd* at pckbc?
wskbd* at pckbd? console ?
pms* at pckbc?
wsmouse* at pms? mux 0
pbus* at plb? # off-chip Peripheral BUS
vga* at pci? dev ? function ?
wsdisplay* at vga? console ?
dsrtc0 at pbus? addr ? # RTC
todclock0 at dsrtc? # time-of-day device via rtc device
pckbc0 at pbus?
pckbd* at pckbc?
wskbd* at pckbd? console ?
pms* at pckbc?
wsmouse* at pms? mux 0
vga* at pci? dev ? function ?
wsdisplay* at vga? console ?
pseudo-device vnd 4 # disk-like interface to files
pseudo-device ccd 4 # concatenated/striped disk devices

View File

@ -1,4 +1,4 @@
# $NetBSD: files.walnut,v 1.7 2002/08/01 23:15:38 simonb Exp $
# $NetBSD: files.walnut,v 1.8 2002/08/12 02:06:21 simonb Exp $
#
# walnut-specific configuration info
@ -45,28 +45,34 @@ include "dev/wscons/files.wscons"
include "dev/rasops/files.rasops"
include "dev/wsfont/files.wsfont"
# System bus
define mainbus {[addr=-1], [irq=-1]}
device mainbus : mainbus
attach mainbus at root
file arch/walnut/walnut/mainbus.c mainbus
# Processor Local Bus
define plb {}
device plb : plb
attach plb at root
file arch/powerpc/ibm4xx/dev/plb.c plb
device cpu
attach cpu at mainbus
# On-chip Peripheral Bus
define opb {[addr=-1], [irq=-1]}
device opb : plb
attach opb at plb
file arch/powerpc/ibm4xx/dev/opb.c opb
device cpu {}
attach cpu at plb
file arch/powerpc/ibm4xx/cpu.c
# On-chip com device(s)
attach com at mainbus with com_mainbus
file arch/powerpc/ibm4xx/dev/com_mainbus.c com_mainbus
attach com at opb with com_opb
file arch/powerpc/ibm4xx/dev/com_opb.c com_opb
# On-chip ethernet device(s)
device emac: ether, ifnet, arp, mii
attach emac at mainbus
attach emac at opb
file arch/powerpc/ibm4xx/dev/if_emac.c emac
# Watchdog timer
device wdog: sysmon_wdog
attach wdog at mainbus
attach wdog at opb
file arch/powerpc/ibm4xx/dev/wdog.c wdog
# PCI bus support
@ -74,11 +80,16 @@ include "dev/pci/files.pci"
# On-chip PCI bridge
device pchb : pcibus
attach pchb at mainbus
attach pchb at plb
file arch/walnut/pci/pchb.c pchb
file arch/walnut/pci/pci_machdep.c pci
# Off-chip peripheral bus
device pbus {[addr=-1], [irq=-1]}
attach pbus at plb
file arch/walnut/dev/pbus.c pbus
define todservice {}
device todclock
@ -86,12 +97,12 @@ attach todclock at todservice
file arch/walnut/dev/todclock.c todclock needs-count
device dsrtc: todservice
attach dsrtc at mainbus
attach dsrtc at pbus
file arch/walnut/dev/ds1743.c dsrtc
include "dev/pckbc/files.pckbc"
attach pckbc at mainbus with pckbc_mainbus
file arch/walnut/dev/pckbc_mainbus.c pckbc_mainbus
attach pckbc at pbus with pckbc_pbus
file arch/walnut/dev/pckbc_pbus.c pckbc_pbus
#
# Machine-independent CardBus drivers

View File

@ -1,4 +1,4 @@
/* $NetBSD: ds1743.c,v 1.2 2002/03/13 19:18:07 eeh Exp $ */
/* $NetBSD: ds1743.c,v 1.3 2002/08/12 02:06:21 simonb Exp $ */
/*
* Copyright (c) 2001-2002 Wasabi Sysetms, Inc.
@ -41,12 +41,12 @@
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/rtc.h>
#include <machine/bus.h>
#include <walnut/dev/ds1743reg.h>
#include <walnut/dev/todclockvar.h>
#include <walnut/dev/pbusvar.h>
struct dsrtc_softc {
struct device sc_dev;
@ -85,17 +85,17 @@ int ds1743found = 0;
static int
dsrtcmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_attach_args *maa = aux;
struct pbus_attach_args *paa = aux;
int retval = !ds1743found;
bus_space_handle_t h;
u_int8_t x;
/* match only RTC devices */
if (strcmp(maa->mb_name, cf->cf_driver->cd_name) != 0)
if (strcmp(paa->pb_name, cf->cf_driver->cd_name) != 0)
return 0;
if (bus_space_map(0, maa->mb_addr, DS_SIZE, 0, &h)) {
printf("%s: can't map i/o space\n", maa->mb_name);
if (bus_space_map(0, paa->pb_addr, DS_SIZE, 0, &h)) {
printf("%s: can't map i/o space\n", paa->pb_name);
return 0;
}
@ -131,14 +131,14 @@ static void
dsrtcattach(struct device *parent, struct device *self, void *aux)
{
struct dsrtc_softc *sc = (struct dsrtc_softc *)self;
struct mainbus_attach_args *maa = aux;
struct pbus_attach_args *paa = aux;
struct todclock_attach_args ta;
ds1743found = 1;
sc->sc_iot = 0;
sc->sc_ioh = maa->mb_addr;
if (bus_space_map(sc->sc_iot, maa->mb_addr, DS_SIZE, 0, &sc->sc_ioh)) {
sc->sc_ioh = paa->pb_addr;
if (bus_space_map(sc->sc_iot, paa->pb_addr, DS_SIZE, 0, &sc->sc_ioh)) {
printf(": can't map i/o space\n");
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.10 2002/07/09 23:34:28 simonb Exp $ */
/* $NetBSD: pbus.c,v 1.1 2002/08/12 02:06:22 simonb Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -75,7 +75,7 @@
#include <sys/malloc.h>
#define _GALAXY_BUS_DMA_PRIVATE
#include <machine/autoconf.h>
#include <arch/walnut/dev/pbusvar.h>
#include <machine/bus.h>
#include <machine/walnut.h>
@ -84,62 +84,60 @@
/*
* The devices built in to the 405GP cpu.
*/
const struct ppc405gp_dev {
const struct pbus_dev {
const char *name;
bus_addr_t addr;
int irq;
} ppc405gp_devs [] = {
{ "com", UART0_BASE, 0 },
{ "com", UART1_BASE, 1 },
} pbus_devs [] = {
{ "dsrtc", NVRAM_BASE, -1 },
{ "emac", EMAC0_BASE, 9 }, /* XXX: really irq 9..15 */
{ "gpio", GPIO0_BASE, -1 },
{ "iic", IIC0_BASE, 2 },
{ "wdog", -1, -1 },
{ "pckbc", KEY_MOUSE_BASE, 25 }, /* XXX: really irq x..x+1 */
{ "pchb", PCIC0_BASE, -1 },
{ NULL }
};
static int mainbus_match(struct device *, struct cfdata *, void *);
static void mainbus_attach(struct device *, struct device *, void *);
static int mainbus_submatch(struct device *, struct cfdata *, void *);
static int mainbus_print(void *, const char *);
static int pbus_match(struct device *, struct cfdata *, void *);
static void pbus_attach(struct device *, struct device *, void *);
static int pbus_submatch(struct device *, struct cfdata *, void *);
static int pbus_print(void *, const char *);
struct cfattach mainbus_ca = {
sizeof(struct device), mainbus_match, mainbus_attach
struct cfattach pbus_ca = {
sizeof(struct device), pbus_match, pbus_attach
};
/*
* Probe for the mainbus; always succeeds.
* Probe for the peripheral bus.
*/
static int
mainbus_match(struct device *parent, struct cfdata *match, void *aux)
pbus_match(struct device *parent, struct cfdata *cf, void *aux)
{
struct pbus_attach_args *pba = aux;
return 1;
/* match only pbus devices */
if (strcmp(pba->pb_name, cf->cf_driver->cd_name) != 0)
return (0);
return (1);
}
static int
mainbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
pbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_attach_args *maa = aux;
struct pbus_attach_args *pba = aux;
if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT &&
cf->cf_loc[MAINBUSCF_ADDR] != maa->mb_addr)
if (cf->cf_loc[PBUSCF_ADDR] != PBUSCF_ADDR_DEFAULT &&
cf->cf_loc[PBUSCF_ADDR] != pba->pb_addr)
return (0);
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
}
/*
* Attach the mainbus.
* Attach the peripheral bus.
*/
static void
mainbus_attach(struct device *parent, struct device *self, void *aux)
pbus_attach(struct device *parent, struct device *self, void *aux)
{
struct mainbus_attach_args mba;
struct pbus_attach_args pba;
int i;
#if NPCKBC > 0
bus_space_handle_t ioh_fpga;
@ -149,28 +147,20 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
/* Attach the CPU first */
mba.mb_name = "cpu";
mba.mb_addr = MAINBUSCF_ADDR_DEFAULT;
mba.mb_irq = MAINBUSCF_IRQ_DEFAULT;
mba.mb_bt = galaxy_make_bus_space_tag(0, 0);
config_found(self, &mba, mainbus_print);
for (i = 0; ppc405gp_devs[i].name != NULL; i++) {
mba.mb_name = ppc405gp_devs[i].name;
mba.mb_addr = ppc405gp_devs[i].addr;
mba.mb_irq = ppc405gp_devs[i].irq;
mba.mb_bt = galaxy_make_bus_space_tag(0, 0);
mba.mb_dmat = &galaxy_default_bus_dma_tag;
for (i = 0; pbus_devs[i].name != NULL; i++) {
pba.pb_name = pbus_devs[i].name;
pba.pb_addr = pbus_devs[i].addr;
pba.pb_irq = pbus_devs[i].irq;
pba.pb_bt = galaxy_make_bus_space_tag(0, 0);
pba.pb_dmat = &galaxy_default_bus_dma_tag;
(void) config_found_sm(self, &mba, mainbus_print,
mainbus_submatch);
(void) config_found_sm(self, &pba, pbus_print, pbus_submatch);
}
#if NPCKBC > 0
/* Configure FPGA */
if (bus_space_map(iot_fpga, FPGA_BASE, FPGA_SIZE, 0, &ioh_fpga)) {
printf("mainbus_attach: can't map FPGA\n");
printf("pbus_attach: can't map FPGA\n");
/* XXX - disable keyboard probe? */
} else {
/* Use separate interrupts for keyboard and mouse */
@ -200,18 +190,17 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
}
static int
mainbus_print(void *aux, const char *pnp)
pbus_print(void *aux, const char *pnp)
{
struct mainbus_attach_args *mba = aux;
struct pbus_attach_args *pba = aux;
if (pnp)
printf("%s at %s", mba->mb_name, pnp);
printf("%s at %s", pba->pb_name, pnp);
if (mba->mb_addr != MAINBUSCF_ADDR_DEFAULT)
printf(" addr 0x%08lx", mba->mb_addr);
if (mba->mb_irq != MAINBUSCF_IRQ_DEFAULT)
printf(" irq %d", mba->mb_irq);
if (pba->pb_addr != PBUSCF_ADDR_DEFAULT)
printf(" addr 0x%08lx", pba->pb_addr);
if (pba->pb_irq != PBUSCF_IRQ_DEFAULT)
printf(" irq %d", pba->pb_irq);
return (UNCONF);
}

View File

@ -0,0 +1,46 @@
/* $NetBSD: pbusvar.h,v 1.1 2002/08/12 02:06:22 simonb Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by 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 <machine/bus.h>
struct pbus_attach_args {
const char *pb_name;
u_long pb_addr;
int pb_irq;
bus_space_tag_t pb_bt; /* Bus space tag */
bus_dma_tag_t pb_dmat; /* DMA tag */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: pckbc_mainbus.c,v 1.4 2002/03/13 19:18:55 eeh Exp $ */
/* $NetBSD: pckbc_pbus.c,v 1.1 2002/08/12 02:06:22 simonb Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -44,15 +44,14 @@
#include <sys/errno.h>
#include <sys/queue.h>
#include <machine/autoconf.h>
#include <arch/walnut/dev/pbusvar.h>
#include <machine/intr.h>
#include <machine/bus.h>
#include <machine/walnut.h>
#include <dev/ic/i8042reg.h>
#include <dev/ic/pckbcvar.h>
struct pckbc_mainbus_softc {
struct pckbc_pbus_softc {
struct pckbc_softc sc_pckbc;
// XXX void *sc_ih[PCKBC_NSLOTS];
@ -60,23 +59,24 @@ struct pckbc_mainbus_softc {
};
static int pckbc_mainbus_probe(struct device *, struct cfdata *, void *);
static void pckbc_mainbus_attach(struct device *, struct device *, void *);
static void pckbc_mainbus_intr_establish(struct pckbc_softc *, pckbc_slot_t);
struct cfattach pckbc_mainbus_ca = {
sizeof(struct pckbc_mainbus_softc), pckbc_mainbus_probe, pckbc_mainbus_attach
static int pckbc_pbus_probe(struct device *, struct cfdata *, void *);
static void pckbc_pbus_attach(struct device *, struct device *, void *);
static void pckbc_pbus_intr_establish(struct pckbc_softc *, pckbc_slot_t);
struct cfattach pckbc_pbus_ca = {
sizeof(struct pckbc_pbus_softc), pckbc_pbus_probe, pckbc_pbus_attach
};
int pckbcfound = 0;
int
pckbc_mainbus_probe(struct device *parent, struct cfdata *cf, void *aux)
pckbc_pbus_probe(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_attach_args *maa = aux;
struct pbus_attach_args *paa = aux;
/* match only pckbc devices */
if (strcmp(maa->mb_name, cf->cf_driver->cd_name) != 0)
if (strcmp(paa->pb_name, cf->cf_driver->cd_name) != 0)
return 0;
return (pckbcfound < 1);
@ -85,23 +85,23 @@ pckbc_mainbus_probe(struct device *parent, struct cfdata *cf, void *aux)
struct pckbc_softc *pckbc0; /* XXX */
void
pckbc_mainbus_attach(struct device *parent, struct device *self, void *aux)
pckbc_pbus_attach(struct device *parent, struct device *self, void *aux)
{
struct pckbc_mainbus_softc *msc = (void *)self;
struct pckbc_pbus_softc *msc = (void *)self;
struct pckbc_softc *sc = &msc->sc_pckbc;
struct mainbus_attach_args *maa = aux;
struct pbus_attach_args *paa = aux;
struct pckbc_internal *t;
bus_space_handle_t ioh_d, ioh_c;
bus_space_tag_t iot = galaxy_make_bus_space_tag(0, 0);
u_long addr = maa->mb_addr;
u_long addr = paa->pb_addr;
/*
* Set up IRQs
*/
msc->sc_irq[PCKBC_KBD_SLOT] = maa->mb_irq;
msc->sc_irq[PCKBC_AUX_SLOT] = maa->mb_irq + 1; /* XXX */
msc->sc_irq[PCKBC_KBD_SLOT] = paa->pb_irq;
msc->sc_irq[PCKBC_AUX_SLOT] = paa->pb_irq + 1; /* XXX */
sc->intr_establish = pckbc_mainbus_intr_establish;
sc->intr_establish = pckbc_pbus_intr_establish;
if (pckbc_is_console(iot, addr)) {
t = &pckbc_consdata;
@ -135,13 +135,13 @@ pckbc_mainbus_attach(struct device *parent, struct device *self, void *aux)
}
static void
pckbc_mainbus_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
pckbc_pbus_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
{
struct pckbc_mainbus_softc *msc = (void *)sc;
struct pckbc_pbus_softc *msc = (void *)sc;
int irq = msc->sc_irq[slot];
if (slot > PCKBC_NSLOTS) {
printf("pckbc_mainbus_intr_establish: attempt to establish "
printf("pckbc_pbus_intr_establish: attempt to establish "
"interrupt at slot %d\n", slot);
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb.c,v 1.3 2002/05/16 01:01:42 thorpej Exp $ */
/* $NetBSD: pchb.c,v 1.4 2002/08/12 02:06:23 simonb Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,8 +46,7 @@
#include <sys/malloc.h>
#define _GALAXY_BUS_DMA_PRIVATE
#include <machine/autoconf.h>
#include <machine/bus.h>
#include <walnut/dev/pbusvar.h>
#include <machine/walnut.h>
#include <powerpc/ibm4xx/ibm405gp.h>
@ -70,14 +69,14 @@ int pcifound = 0;
static int
pchbmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct mainbus_attach_args *mba = (struct mainbus_attach_args *)aux;
struct pbus_attach_args *paa = aux;
/* XXX chipset tag unused by walnut, so just pass 0 */
pci_chipset_tag_t pc = 0;
pcitag_t tag;
int class, id;
/* match only pchb devices */
if (strcmp(mba->mb_name, cf->cf_driver->cd_name) != 0)
if (strcmp(paa->pb_name, cf->cf_driver->cd_name) != 0)
return 0;
pci_machdep_init();
@ -106,7 +105,6 @@ pchbmatch(struct device *parent, struct cfdata *cf, void *aux)
static void
pchbattach(struct device *parent, struct device *self, void *aux)
{
/* struct mainbus_attach_args *mba = (struct mainbus_attach_args *)aux; */
struct pcibus_attach_args pba;
char devinfo[256];
#ifdef PCI_NETBSD_CONFIGURE

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.3 2001/11/06 01:26:48 simonb Exp $ */
/* $NetBSD: autoconf.c,v 1.4 2002/08/12 02:06:23 simonb Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -34,31 +34,20 @@
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/reboot.h>
#include <sys/systm.h>
#include <machine/autoconf.h>
#include <machine/bus.h>
#include <machine/pio.h>
#include <machine/stdarg.h>
#include <powerpc/ibm4xx/dev/plbvar.h>
#include <dev/ofw/openfirm.h>
#include <dev/pci/pcivar.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/ata/atavar.h>
#include <dev/ic/wdcvar.h>
struct device *booted_device;
int booted_partition;
void canonicalize_bootpath(void);
int OF_interpret(char *cmd, int nreturns, ...);
extern char bootpath[256];
char cbootpath[256];
struct device *booted_device; /* boot device */
int booted_partition; /* ...and partition on that device */
u_int *heathrow_FCR = NULL;
/*
* List of port-specific devices to attach to the processor local bus.
*/
static const struct plb_dev local_plb_devs [] = {
{ "pbus", },
{ NULL }
};
/*
* Determine device configuration for a machine.
@ -70,12 +59,11 @@ cpu_configure(void)
intr_init();
calc_delayconst();
if (config_rootfound("mainbus", NULL) == NULL)
panic("configure: mainbus not configured");
if (config_rootfound("plb", &local_plb_devs) == NULL)
panic("configure: plb 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]);
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();
@ -92,9 +80,6 @@ cpu_configure(void)
void
cpu_rootconf(void)
{
printf("boot device: %s\n",
booted_device ? booted_device->dv_xname : "<unknown>");
setroot(booted_device, booted_partition);
}