From 298f4b27f491fe293a55e68f6ddf498ec83102c4 Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 24 Nov 1999 00:04:06 +0000 Subject: [PATCH] Make separate device lists for the 3100 and 5100, and add a way to probe for optional `dc' devices on the 5100. --- sys/arch/pmax/ibus/ibus.c | 20 ++++++++++---- sys/arch/pmax/ibus/ibus_3max.c | 13 ++++----- sys/arch/pmax/ibus/ibus_pmax.c | 49 ++++++++++++++++++++++------------ sys/arch/pmax/ibus/ibusvar.h | 3 ++- 4 files changed, 56 insertions(+), 29 deletions(-) diff --git a/sys/arch/pmax/ibus/ibus.c b/sys/arch/pmax/ibus/ibus.c index 03a74d765a4e..009404d952e9 100644 --- a/sys/arch/pmax/ibus/ibus.c +++ b/sys/arch/pmax/ibus/ibus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibus.c,v 1.3 1999/11/23 20:07:40 thorpej Exp $ */ +/* $NetBSD: ibus.c,v 1.4 1999/11/24 00:04:06 thorpej Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ibus.c,v 1.3 1999/11/23 20:07:40 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibus.c,v 1.4 1999/11/24 00:04:06 thorpej Exp $"); #include #include @@ -53,6 +53,7 @@ ibusattach(parent, self, aux) { struct ibus_softc *sc = (struct ibus_softc *)self; struct ibus_dev_attach_args *ida = aux; + struct ibus_attach_args *ia; int i; printf("\n"); @@ -60,9 +61,18 @@ ibusattach(parent, self, aux) sc->sc_intr_establish = ida->ida_establish; sc->sc_intr_disestablish = ida->ida_disestablish; - for (i = 0; i < ida->ida_ndevs; i++) - (void) config_found_sm(self, &ida->ida_devs[i], ibusprint, - ibussubmatch); + /* + * Loop through the devices and attach them. If a probe-size + * is specified, it's an optional item on the platform and + * do a badaddr() test to make sure it's there. + */ + for (i = 0; i < ida->ida_ndevs; i++) { + ia = &ida->ida_devs[i]; + if (ia->ia_basz != 0 && + badaddr((caddr_t)ia->ia_addr, ia->ia_basz) != 0) + continue; + (void) config_found_sm(self, ia, ibusprint, ibussubmatch); + } } int diff --git a/sys/arch/pmax/ibus/ibus_3max.c b/sys/arch/pmax/ibus/ibus_3max.c index 86b325eba82a..1640b2c43b99 100644 --- a/sys/arch/pmax/ibus/ibus_3max.c +++ b/sys/arch/pmax/ibus/ibus_3max.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibus_3max.c,v 1.1 1999/11/15 09:50:30 nisimura Exp $ */ +/* $NetBSD: ibus_3max.c,v 1.2 1999/11/24 00:04:06 thorpej Exp $ */ /* * Copyright (c) 1999 Tohru Nishimura. All rights reserved. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ibus_3max.c,v 1.1 1999/11/15 09:50:30 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibus_3max.c,v 1.2 1999/11/24 00:04:06 thorpej Exp $"); #include #include @@ -46,10 +46,11 @@ __KERNEL_RCSID(0, "$NetBSD: ibus_3max.c,v 1.1 1999/11/15 09:50:30 nisimura Exp $ #define KV(x) MIPS_PHYS_TO_KSEG1(x) -static struct ibus_attach_args kn02sys_devs[] = { - { "mc146818", 0, KV(KN02_SYS_CLOCK), }, - { "dc", 1, KV(KN02_SYS_DZ), }, +struct ibus_attach_args kn02sys_devs[] = { + { "mc146818", 0, KV(KN02_SYS_CLOCK), 0, }, + { "dc", 1, KV(KN02_SYS_DZ), 0, }, }; +const int kn02sys_ndevs = sizeof(kn02sys_devs) / sizeof(kn02sys_devs[0]); static int kn02sys_match __P((struct device *, struct cfdata *, void *)); static void kn02sys_attach __P((struct device *, struct device *, void *)); @@ -83,7 +84,7 @@ kn02sys_attach(parent, self, aux) ida.ida_busname = "ibus"; ida.ida_devs = kn02sys_devs; - ida.ida_ndevs = sizeof(kn02sys_devs) / sizeof(kn02sys_devs[0]); + ida.ida_ndevs = kn02sys_ndevs; ida.ida_establish = sc->sc_intr_establish; ida.ida_disestablish = sc->sc_intr_disestablish; diff --git a/sys/arch/pmax/ibus/ibus_pmax.c b/sys/arch/pmax/ibus/ibus_pmax.c index 4389e138b66e..9abbe68a1503 100644 --- a/sys/arch/pmax/ibus/ibus_pmax.c +++ b/sys/arch/pmax/ibus/ibus_pmax.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibus_pmax.c,v 1.6 1999/11/19 03:15:28 nisimura Exp $ */ +/* $NetBSD: ibus_pmax.c,v 1.7 1999/11/24 00:04:06 thorpej Exp $ */ /* * Copyright (c) 1998 Jonathan Stone. All rights reserved. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ibus_pmax.c,v 1.6 1999/11/19 03:15:28 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibus_pmax.c,v 1.7 1999/11/24 00:04:06 thorpej Exp $"); #include "opt_dec_3100.h" #include "opt_dec_5100.h" @@ -58,23 +58,36 @@ struct cfattach ibus_pmax_ca = { #define KV(x) MIPS_PHYS_TO_KSEG1(x) -static struct ibus_attach_args kn01_devs[] = { - /* name cookie addr */ - { "pm", 0, KV(KN01_PHYS_FBUF_START) }, - { "dc", 1, KV(KN01_SYS_DZ) }, - { "lance", 2, KV(KN01_SYS_LANCE) }, - { "sii", 3, KV(KN01_SYS_SII) }, - { "mc146818", 4, KV(KN01_SYS_CLOCK) }, -#ifdef notyet - { "dc", 5, KV(0x15000000), }, - { "dc", 6, KV(0x15200000), }, +#ifdef DEC_3100 +struct ibus_attach_args ibus_pmax_devs[] = { + { "pm", 0, KV(KN01_PHYS_FBUF_START), 0 }, + { "dc", 1, KV(KN01_SYS_DZ), 0 }, + { "lance", 2, KV(KN01_SYS_LANCE), 0 }, + { "sii", 3, KV(KN01_SYS_SII), 0 }, + { "mc146818", 4, KV(KN01_SYS_CLOCK), 0 }, +}; +const int ibus_pmax_ndevs = sizeof(ibus_pmax_devs) / sizeof(ibus_pmax_devs[0]); +#endif /* DEC_3100 */ + +#ifdef DEC_5100 +struct ibus_attach_args ibus_mipsmate_devs[] = { + { "dc", 1, KV(KN01_SYS_DZ), 0 }, + { "lance", 2, KV(KN01_SYS_LANCE), 0 }, + { "sii", 3, KV(KN01_SYS_SII), 0 }, + { "mc146818", 4, KV(KN01_SYS_CLOCK), 0 }, + { "dc", 5, KV(0x15000000), 2 }, + { "dc", 6, KV(0x15200000), 2 }, +#if 0 /* - * XXX Ultrix configures at 0x86400400. the first 0x400 byte are - * used for NVRAM state?? + * Ultrix configures it at 0x86400400. The first 0x400 bytes + * used for VMRAM state?? */ - { "nvram", 7, KV(0x86400000), }, + { "nvram", 7, KV(0x86400000), 0 }, #endif }; +const int ibus_mipsmate_ndevs = + sizeof(ibus_mipsmate_devs) / sizeof(ibus_mipsmate_devs[0]); +#endif /* DEC_5100 */ static int ibus_attached; @@ -106,17 +119,19 @@ ibus_pmax_attach(parent, self, aux) ibus_attached = 1; ida.ida_busname = "ibus"; - ida.ida_devs = kn01_devs; - ida.ida_ndevs = sizeof(kn01_devs) / sizeof(kn01_devs[0]); switch (systype) { #ifdef DEC_3100 case DS_PMAX: + ida.ida_devs = ibus_pmax_devs; + ida.ida_ndevs = ibus_pmax_ndevs; ida.ida_establish = dec_3100_intr_establish; ida.ida_disestablish = dec_3100_intr_disestablish; break; #endif #ifdef DEC_5100 case DS_MIPSMATE: + ida.ida_devs = ibus_mipsmate_devs; + ida.ida_ndevs = ibus_mipsmate_ndevs; ida.ida_establish = dec_5100_intr_establish; ida.ida_disestablish = dec_5100_intr_disestablish; break; diff --git a/sys/arch/pmax/ibus/ibusvar.h b/sys/arch/pmax/ibus/ibusvar.h index c8be8e16f374..ec7987a67eaf 100644 --- a/sys/arch/pmax/ibus/ibusvar.h +++ b/sys/arch/pmax/ibus/ibusvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ibusvar.h,v 1.10 1999/11/23 20:07:40 thorpej Exp $ */ +/* $NetBSD: ibusvar.h,v 1.11 1999/11/24 00:04:06 thorpej Exp $ */ #ifndef _IBUSVAR_H_ #define _IBUSVAR_H_ 1 @@ -36,6 +36,7 @@ struct ibus_attach_args { const char *ia_name; /* Device name. */ int ia_cookie; /* Device slot (table entry). */ u_int32_t ia_addr; /* Device address (KSEG1). */ + int ia_basz; /* badaddr() size */ }; void ibusattach __P((struct device *, struct device *, void *));