diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2002-06-11 09:36:25 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2002-06-11 09:36:25 +0000 |
commit | 10ca5e5818bb80e596db244327a2663b6703bb18 (patch) | |
tree | c7ac330b34d73ea4e0c78d17a9eed0a3b6df63aa /sys/arch/vax/bi/bi.c | |
parent | 180b34af9885b092bee0f67c5b2ac8577d972cfe (diff) |
New boot code, mostly from ragge's work in NetBSD.
Some header syncing and a couple network drivers came along for the ride.
Assembly files have been renamed from .s to .S to facilitate diffs.
Kernel is backwards compat - with manual interaction.
OpenBSD features have been preserved.
Diffstat (limited to 'sys/arch/vax/bi/bi.c')
-rw-r--r-- | sys/arch/vax/bi/bi.c | 143 |
1 files changed, 72 insertions, 71 deletions
diff --git a/sys/arch/vax/bi/bi.c b/sys/arch/vax/bi/bi.c index 11b69b12087..8c49ceaf503 100644 --- a/sys/arch/vax/bi/bi.c +++ b/sys/arch/vax/bi/bi.c @@ -1,5 +1,5 @@ -/* $OpenBSD: bi.c,v 1.4 2002/03/14 03:16:02 millert Exp $ */ -/* $NetBSD: bi.c,v 1.4 1996/10/13 03:34:44 christos Exp $ */ +/* $OpenBSD: bi.c,v 1.5 2002/06/11 09:36:23 hugh Exp $ */ +/* $NetBSD: bi.c,v 1.17 2001/11/13 12:51:34 lukem Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -41,44 +41,36 @@ * handle BIbus errors more gracefully. */ +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: bi.c,v 1.17 2001/11/13 12:51:34 lukem Exp $"); + #include <sys/param.h> -#include <sys/device.h> +#include <sys/systm.h> -#include <machine/mtpr.h> -#include <machine/nexus.h> +#include <machine/bus.h> #include <machine/cpu.h> -#include <arch/vax/bi/bireg.h> -#include <arch/vax/bi/bivar.h> - -static int bi_match(struct device *, void *, void *); -static void bi_attach(struct device *, struct device *, void *); -static int bi_print(void *, const char *); +#include <dev/bi/bireg.h> +#include <dev/bi/bivar.h> -struct cfdriver bi_cd = { - NULL, "bi", DV_DULL -}; - -struct cfattach bi_ca = { - sizeof(struct bi_softc), bi_match, bi_attach -}; +static int bi_print __P((void *, const char *)); struct bi_list bi_list[] = { - {BIDT_MS820, 1, "ms820"}, - {BIDT_DRB32, 0, "drb32"}, - {BIDT_DWBUA, 0, "dwbua"}, - {BIDT_KLESI, 0, "klesi"}, - {BIDT_KA820, 1, "ka820"}, - {BIDT_DB88, 0, "db88"}, - {BIDT_CIBCA, 0, "cibca"}, - {BIDT_DMB32, 0, "dmb32"}, - {BIDT_CIBCI, 0, "cibci"}, - {BIDT_KA800, 0, "ka800"}, - {BIDT_KDB50, 0, "kdb50"}, - {BIDT_DWMBA, 0, "dwmba"}, - {BIDT_KFBTA, 0, "kfbta"}, - {BIDT_DEBNK, 0, "debnk"}, - {BIDT_DEBNA, 0, "debna"}, + {BIDT_MS820, DT_HAVDRV, "ms820"}, + {BIDT_DRB32, DT_UNSUPP, "drb32"}, + {BIDT_DWBUA, DT_HAVDRV|DT_ADAPT, "dwbua"}, + {BIDT_KLESI, DT_HAVDRV|DT_ADAPT, "klesi"}, + {BIDT_KA820, DT_HAVDRV, "ka820"}, + {BIDT_DB88, DT_HAVDRV|DT_QUIET, "db88"}, + {BIDT_CIBCA, DT_UNSUPP, "cibca"}, + {BIDT_DMB32, DT_UNSUPP, "dmb32"}, + {BIDT_CIBCI, DT_UNSUPP, "cibci"}, + {BIDT_KA800, DT_UNSUPP, "ka800"}, + {BIDT_KDB50, DT_HAVDRV|DT_VEC, "kdb50"}, + {BIDT_DWMBA, DT_HAVDRV|DT_QUIET, "dwmba"}, + {BIDT_KFBTA, DT_UNSUPP, "kfbta"}, + {BIDT_DEBNK, DT_HAVDRV|DT_VEC, "debnk"}, + {BIDT_DEBNA, DT_HAVDRV|DT_VEC, "debna"}, {0,0,0} }; @@ -89,61 +81,70 @@ bi_print(aux, name) { struct bi_attach_args *ba = aux; struct bi_list *bl; + u_int16_t nr; + + nr = bus_space_read_2(ba->ba_iot, ba->ba_ioh, 0); + for (bl = &bi_list[0]; bl->bl_nr; bl++) + if (bl->bl_nr == nr) + break; if (name) { - for (bl = &bi_list[0]; bl->bl_nr; bl++) - if (bl->bl_nr == ba->ba_node->biic.bi_dtype) { - printf(bl->bl_name); - break; - } if (bl->bl_nr == 0) - printf("unknown device 0x%x", - ba->ba_node->biic.bi_dtype); + printf("unknown device 0x%x", nr); + else + printf(bl->bl_name); printf(" at %s", name); } printf(" node %d", ba->ba_nodenr); - return bl->bl_havedriver ? UNCONF : UNSUPP; -} - -int -bi_match(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - struct bp_conf *bp = aux; - - if (strcmp(bp->type, "bi")) - return 0; - return 1; + if (bl->bl_havedriver & DT_VEC) + printf(" vec %o", ba->ba_ivec & 511); +#ifdef DEBUG + if (bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_SADR) && + bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_EADR)) + printf(" [sadr %x eadr %x]", + bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_SADR), + bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_EADR)); +#endif + if (bl->bl_havedriver & DT_QUIET) + printf("\n"); + return bl->bl_havedriver & DT_QUIET ? QUIET : + bl->bl_havedriver & DT_HAVDRV ? UNCONF : UNSUPP; } void -bi_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +bi_attach(sc) + struct bi_softc *sc; { - struct bp_conf *bp = aux; - struct bi_softc *bi = (void *)self; - struct bi_node *binode; struct bi_attach_args ba; int nodenr; printf("\n"); - binode = bi->bi_base = (struct bi_node *)bp->bp_addr; - ba.ba_intcpu = 1 << mastercpu; + ba.ba_iot = sc->sc_iot; + ba.ba_busnr = sc->sc_busnr; + ba.ba_dmat = sc->sc_dmat; + ba.ba_intcpu = sc->sc_intcpu; + ba.ba_icookie = sc; + /* + * Interrupt numbers. Assign them as described in + * VAX 8800 system maintenance manual; this means like nexus + * adapters have them assigned. + * XXX - must address Unibus adapters. + */ for (nodenr = 0; nodenr < NNODEBI; nodenr++) { - if (badaddr((caddr_t)&binode[nodenr], 4)) + if (bus_space_map(sc->sc_iot, sc->sc_addr + BI_NODE(nodenr), + BI_NODESIZE, 0, &ba.ba_ioh)) { + printf("bi_attach: bus_space_map failed, node %d\n", + nodenr); + return; + } + if (badaddr((caddr_t)ba.ba_ioh, 4) || + (bus_space_read_2(ba.ba_iot, ba.ba_ioh, 0) == 0)) { + bus_space_unmap(ba.ba_iot, ba.ba_ioh, BI_NODESIZE); continue; - - ba.ba_node = &binode[nodenr]; + } ba.ba_nodenr = nodenr; - config_found(self, &ba, bi_print); + ba.ba_ivec = sc->sc_lastiv + 64 + 4 * nodenr; /* all on spl5 */ + config_found(&sc->sc_dev, &ba, bi_print); } } - -void -bi_buserr() -{ - panic("bi_buserr"); -} |