Attach ibus to mainbus.

Commit updated dec_3100.c with  interrupt-enable code for ibus.
This commit is contained in:
jonathan 1998-04-19 10:54:54 +00:00
parent 1a283ae18b
commit cf6765a49c
2 changed files with 36 additions and 172 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_3100.c,v 1.3 1998/03/26 12:46:34 jonathan Exp $ */
/* $NetBSD: dec_3100.c,v 1.4 1998/04/19 10:54:55 jonathan Exp $ */
/*
* Copyright (c) 1998 Jonathan Stone. All rights reserved.
@ -91,7 +91,6 @@
#include <pmax/pmax/pmaxtype.h>
#include <pmax/pmax/machdep.h> /* XXXjrs replace with vectors */
#include <pmax/pmax/kn01var.h>
#include <pmax/pmax/kn01.h>
@ -106,6 +105,8 @@ struct ifnet;
#include <net/if_media.h> /* ifmedia requests for am7990 */
#include <dev/ic/am7990var.h> /* all this to get lance intr */
#include <pmax/ibus/ibusvar.h>
#include "dc_ds.h"
#include "le_pmax.h"
#include "sii.h"
@ -126,6 +127,12 @@ void dec_3100_device_register __P((struct device *, void *));
static void dec_3100_errintr __P((void));
void
dec_3100_intr_establish __P((void* cookie, int level,
int (*handler) __P((intr_arg_t)), intr_arg_t arg));
void dec_3100_intr_disestablish __P((struct ibus_attach_args *ia));
/*
* Fill in platform struct.
*/
@ -302,6 +309,24 @@ dec_3100_intr(mask, pc, statusReg, causeReg)
MIPS_SR_INT_ENA_CUR);
}
void
dec_3100_intr_establish(cookie, level, handler, arg)
void * cookie;
int level;
int (*handler) __P((intr_arg_t));
intr_arg_t arg;
{
dec_3100_enable_intr((u_int)cookie, handler, arg, 1);
}
void
dec_3100_intr_disestablish(struct ibus_attach_args *ia)
{
printf("dec_3100_intr_distestablish: not implemented\n");
}
/*
* Handle memory errors.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.23 1998/03/25 06:22:20 jonathan Exp $ */
/* $NetBSD: mainbus.c,v 1.24 1998/04/19 10:54:54 jonathan Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -38,14 +38,15 @@
#include <dev/tc/tcvar.h>
#include <dev/tc/ioasicvar.h>
#include <pmax/ibus/ibusvar.h>
#include "pmaxtype.h"
#include "nameglue.h"
#include "kn01.h"
#include <pmax/pmax/kn01var.h>
#include "tc.h" /* Is Turbochannel configured? */
#include "opt_dec_3100.h" /* XXX ibus */
#include "opt_dec_5100.h" /* XXX ibus */
struct mainbus_softc {
@ -62,28 +63,12 @@ struct cfattach mainbus_ca = {
};
extern struct cfdriver mainbus_cd; /* XXX XXX XXX */
extern struct cfdriver tc_cd; /* XXX XXX XXX */
extern struct cfdriver ioasic_cd; /* XXX XXX XXX */
void mb_intr_establish __P((struct confargs *ca,
int (*handler)(intr_arg_t),
intr_arg_t val ));
void mb_intr_disestablish __P((struct confargs *));
/*
* Declarations of Potential child busses and how to configure them.
*/
/*
* XXX KN01 has devices directly on the system bus,
* XXX but it should be redone as an "ibus"
*/
static void kn01_attach __P((struct device *, struct device *, void *));
void dec_3100_enable_intr
__P ((u_int slotno, int (*handler) __P((intr_arg_t sc)),
intr_arg_t sc, int onoff));
static int
mbmatch(parent, cf, aux)
struct device *parent;
@ -114,7 +99,7 @@ mbattach(parent, self, aux)
register struct device *mb = self;
struct confargs nca;
extern int systype, ncpus;
extern int ncpus;
printf("\n");
@ -139,100 +124,18 @@ mbattach(parent, self, aux)
* Call the TC subr code to look for one
* and if found, to configure it.
*/
config_tcbus(mb, 0 /* XXX */, mbprint);
config_tcbus(mb, systype /* XXX */, mbprint);
}
#endif /* NTC */
/*
* We haven't yet decided how to handle the PMAX (KN01)
* which really only has a mainbus, baseboard devices, and an
* optional framebuffer.
*/
#if 1 /*defined(DEC_3100)*/
/* XXX mipsmate: just a guess */
if (systype == DS_PMAX || systype == DS_MIPSMATE) {
kn01_attach(mb, (void*)0, aux);
nca.ca_name = "baseboard";
config_found(mb, &nca, mbprint);
}
#endif /*DEC_3100*/
}
#define KN01_MAXDEVS 8
struct confargs kn01_devs[KN01_MAXDEVS] = {
/* name slot offset addr intpri */
{ "pm", 0, 0, (u_int)KV(KN01_PHYS_FBUF_START), 3, },
{ "dc", 1, 0, (u_int)KV(KN01_SYS_DZ), 2, },
{ "lance", 2, 0, (u_int)KV(KN01_SYS_LANCE), 1, },
{ "sii", 3, 0, (u_int)KV(KN01_SYS_SII), 0, },
{ "mc146818", 4, 0, (u_int)KV(KN01_SYS_CLOCK), 16, },
{ "dc", 5, 0, (u_int)KV(0x15000000), 4, },
{ "dc", 6, 0, (u_int)KV(0x15200000), 5, },
#ifdef notyet
/*
* XXX Ultrix configures at 0x86400400. the first 0x400 byte are
* used for NVRAM state??
*/
{ "nvram", 6, 0, (u_int)KV(0x86400000), -1, },
#endif
{ "", 0, 0 }
};
/*
* Configure baseboard devices on KN01 attached directly to mainbus
*/
void
kn01_attach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
{
struct confargs *nca;
register int i;
#ifdef DEBUG
/*XXX*/ printf("(configuring kn01/5100 baseboard devices)\n");
#endif
/* Try to configure each KN01 mainbus device */
for (i = 0; i < KN01_MAXDEVS; i++) {
nca = &kn01_devs[i];
if (nca == NULL) {
printf("mbattach: bad config for slot %d\n", i);
break;
}
if (nca->ca_name == NULL) {
panic("No name for mainbus device\n");
}
#if defined(DIAGNOSTIC) || defined(DEBUG)
if (nca->ca_slot > KN01_MAXDEVS)
panic("kn01 mbattach: \
dev slot > number of slots for %s",
nca->ca_name);
#endif
#ifdef DEBUG
printf("configuring %s at %x interrupt number %d\n",
nca->ca_name, nca->ca_addr, (u_int)nca->ca_slotpri);
#endif
/* Tell the autoconfig machinery we've found the hardware. */
config_found(parent, nca, mbprint);
}
/*
* The Decstation 5100, like the 3100, has an sii, clock, ethernet,
* and dc, presumably at the same addresses. If so, the
* code above will configure them. The 5100 also
* has a slot for PrestoServe NVRAM and for an additional
* `mdc' dc-like, eigh-port serial option. If we supported
* those devices, this is the right place to configure them.
*/
}
static int
mbprint(aux, pnp)
void *aux;
@ -261,67 +164,3 @@ mb_intr_disestablish(ca)
panic("can never mb_intr_disestablish");
}
#ifdef DEC_3100
void
ibus_intr_establish(parent, cookie, level, handler, arg)
struct device *parent;
void * cookie;
int level;
int (*handler) __P((intr_arg_t));
intr_arg_t arg;
{
/* Interrupts on the KN01 are currently hardcoded. */
printf(" (kn01: intr_establish hardcoded) ");
dec_3100_enable_intr((u_int) cookie, handler, arg, 1);
}
void
ibus_intr_disestablish(ca)
struct confargs *ca;
{
printf("(kn01: ignoring intr_disestablish) ");
}
#endif /* DEC_3100 */
/*
* An interrupt-establish method. This should somehow be folded
* back into the autoconfiguration machinery. Until the TC machine
* portmasters agree on how to do that, it's a separate function.
*
* XXX since all drivers should be passign a softc for "arg",
* why not make that explicit and use (struct device*)arg->dv_parent,
* instead of explicitly passign the parent?
*/
void
generic_intr_establish(parent, cookie, level, handler, arg)
void * parent;
void * cookie;
int level;
intr_handler_t handler;
intr_arg_t arg;
{
struct device *dev = arg;
#if NTC>0
if (dev->dv_parent->dv_cfdata->cf_driver == &ioasic_cd) {
/*XXX*/ printf("ioasic interrupt for %d\n", (u_int)cookie);
ioasic_intr_establish(parent, cookie, level, handler, arg);
} else
if (dev->dv_parent->dv_cfdata->cf_driver == &tc_cd) {
tc_intr_establish(parent, cookie, level, handler, arg);
} else
#endif
#ifdef DEC_3100
if (dev->dv_parent->dv_cfdata->cf_driver == &mainbus_cd) {
ibus_intr_establish(parent, cookie, level, handler, arg);
}
else {
#else
{
#endif
printf("intr_establish: unknown parent bustype for %s\n",
dev->dv_xname);
}
}