diff options
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r-- | sys/arch/hp300/dev/dca.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/dev/dcm.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/dev/diofbvar.h | 8 | ||||
-rw-r--r-- | sys/arch/hp300/dev/dvbox.c | 95 | ||||
-rw-r--r-- | sys/arch/hp300/dev/gbox.c | 96 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hyper.c | 64 | ||||
-rw-r--r-- | sys/arch/hp300/dev/rbox.c | 95 | ||||
-rw-r--r-- | sys/arch/hp300/dev/sti_sgc.c | 108 | ||||
-rw-r--r-- | sys/arch/hp300/dev/topcat.c | 111 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/autoconf.c | 120 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/conf.c | 58 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/wscons_machdep.c | 250 | ||||
-rw-r--r-- | sys/arch/hp300/include/autoconf.h | 4 |
13 files changed, 337 insertions, 680 deletions
diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c index 69dfd03f2d5..12598c21fdc 100644 --- a/sys/arch/hp300/dev/dca.c +++ b/sys/arch/hp300/dev/dca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dca.c,v 1.29 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: dca.c,v 1.30 2005/12/31 18:13:41 miod Exp $ */ /* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */ /* @@ -1046,7 +1046,7 @@ dcacnprobe(cp) cp->cn_dev = makedev(dcamajor, 0); /* XXX */ cp->cn_pri = CN_DEAD; - console_scan(dca_console_scan, cp, HP300_BUS_DIO); + console_scan(dca_console_scan, cp); #ifdef KGDB /* XXX this needs to be fixed. */ diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c index 205bc3889e5..206f3da52e9 100644 --- a/sys/arch/hp300/dev/dcm.c +++ b/sys/arch/hp300/dev/dcm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dcm.c,v 1.26 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: dcm.c,v 1.27 2005/12/31 18:13:41 miod Exp $ */ /* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */ /* @@ -1557,7 +1557,7 @@ dcmcnprobe(cp) cp->cn_dev = makedev(dcmmajor, 0); /* XXX */ cp->cn_pri = CN_DEAD; - console_scan(dcm_console_scan, cp, HP300_BUS_DIO); + console_scan(dcm_console_scan, cp); #ifdef KGDB_CHEAT /* XXX this needs to be fixed. */ diff --git a/sys/arch/hp300/dev/diofbvar.h b/sys/arch/hp300/dev/diofbvar.h index 9017ed5c83a..eace8c24262 100644 --- a/sys/arch/hp300/dev/diofbvar.h +++ b/sys/arch/hp300/dev/diofbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diofbvar.h,v 1.4 2005/01/24 21:36:39 miod Exp $ */ +/* $OpenBSD: diofbvar.h,v 1.5 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -121,6 +121,12 @@ paddr_t diofb_mmap(void *, off_t, int); int diofb_show_screen(void *, void *, int, void (*)(void *, int, int), void *); +/* Console support */ +void dvboxcninit(void); +void gboxcninit(void); +void hypercninit(void); +void rboxcninit(void); +void topcatcninit(void); extern struct diofb diofb_cn; /* struct diofb for console device */ #endif diff --git a/sys/arch/hp300/dev/dvbox.c b/sys/arch/hp300/dev/dvbox.c index 3f31d0c4028..3d6d75e3d61 100644 --- a/sys/arch/hp300/dev/dvbox.c +++ b/sys/arch/hp300/dev/dvbox.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvbox.c,v 1.11 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: dvbox.c,v 1.12 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -83,8 +83,6 @@ #include <hp300/dev/diodevs.h> #include <hp300/dev/intiovar.h> -#include <dev/cons.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -420,97 +418,8 @@ dvbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, * DaVinci console support */ -int dvbox_console_scan(int, caddr_t, void *); -cons_decl(dvbox); - -int -dvbox_console_scan(int scode, caddr_t va, void *arg) -{ - struct diofbreg *fbr = (struct diofbreg *)va; - struct consdev *cp = arg; - u_int pri; - - if (fbr->id != GRFHWID || fbr->fbid != GID_DAVINCI) - return (0); - - pri = CN_NORMAL; - -#ifdef CONSCODE - /* - * Raise our priority, if appropriate. - */ - if (scode == CONSCODE) - pri = CN_FORCED; -#endif - - /* Only raise priority. */ - if (pri > cp->cn_pri) - cp->cn_pri = pri; - - /* - * If our priority is higher than the currently-remembered - * console, stash our priority. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - conscode = scode; - return (DIO_SIZE(scode, va)); - } - return (0); -} - -void -dvboxcnprobe(struct consdev *cp) -{ - int maj; - caddr_t va; - struct diofbreg *fbr; - - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } - - if (maj == nchrdev) - return; - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_DEAD; - - /* Look for "internal" framebuffer. */ - va = (caddr_t)IIOV(GRFIADDR); - fbr = (struct diofbreg *)va; - if (!badaddr(va) && - fbr->id == GRFHWID && fbr->fbid == GID_DAVINCI) { - cp->cn_pri = CN_INTERNAL; - -#ifdef CONSCODE - if (CONSCODE == CONSCODE_INTERNAL) - cp->cn_pri = CN_FORCED; -#endif - - /* - * If our priority is higher than the currently - * remembered console, stash our priority, and - * unmap whichever device might be currently mapped. - * Since we're internal, we set the saved size to 0 - * so they don't attempt to unmap our fixed VA later. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - if (convasize) - iounmap(conaddr, convasize); - conscode = CONSCODE_INTERNAL; - conaddr = va; - convasize = 0; - } - } - - console_scan(dvbox_console_scan, cp, HP300_BUS_DIO); -} - void -dvboxcninit(struct consdev *cp) +dvboxcninit() { dvbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); diofb_cnattach(&diofb_cn); diff --git a/sys/arch/hp300/dev/gbox.c b/sys/arch/hp300/dev/gbox.c index f954da36a6a..bb35fa3da72 100644 --- a/sys/arch/hp300/dev/gbox.c +++ b/sys/arch/hp300/dev/gbox.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gbox.c,v 1.12 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: gbox.c,v 1.13 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -87,8 +87,6 @@ #include <hp300/dev/diodevs.h> #include <hp300/dev/intiovar.h> -#include <dev/cons.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -440,98 +438,8 @@ gbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, * Gatorbox console support */ -int gbox_console_scan(int, caddr_t, void *); -cons_decl(gbox); - -int -gbox_console_scan(int scode, caddr_t va, void *arg) -{ - struct diofbreg *fbr = (struct diofbreg *)va; - struct consdev *cp = arg; - u_int pri; - - if (fbr->id != GRFHWID || fbr->fbid != GID_GATORBOX) - return (0); - - pri = CN_NORMAL; - -#ifdef CONSCODE - /* - * Raise our priority, if appropriate. - */ - if (scode == CONSCODE) - pri = CN_FORCED; -#endif - - /* Only raise priority. */ - if (pri > cp->cn_pri) - cp->cn_pri = pri; - - /* - * If our priority is higher than the currently-remembered - * console, stash our priority. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - conscode = scode; - return (DIO_SIZE(scode, va)); - } - return (0); -} - -void -gboxcnprobe(struct consdev *cp) -{ - int maj; - caddr_t va; - struct diofbreg *fbr; - - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } - - if (maj == nchrdev) - return; - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_DEAD; - - /* Look for "internal" framebuffer. */ - va = (caddr_t)IIOV(GRFIADDR); - fbr = (struct diofbreg *)va; - if (!badaddr(va) && - fbr->id == GRFHWID && fbr->fbid == GID_GATORBOX) { - cp->cn_pri = CN_INTERNAL; - -#ifdef CONSCODE - if (CONSCODE == CONSCODE_INTERNAL) - cp->cn_pri = CN_FORCED; -#endif - - /* - * If our priority is higher than the currently - * remembered console, stash our priority, and - * unmap whichever device might be currently mapped. - * Since we're internal, we set the saved size to 0 - * so they don't attempt to unmap our fixed VA later. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - if (convasize) - iounmap(conaddr, convasize); - conscode = CONSCODE_INTERNAL; - conaddr = va; - convasize = 0; - } - } - - console_scan(gbox_console_scan, cp, HP300_BUS_DIO); -} - void -gboxcninit(cp) - struct consdev *cp; +gboxcninit() { gbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); diofb_cnattach(&diofb_cn); diff --git a/sys/arch/hp300/dev/hyper.c b/sys/arch/hp300/dev/hyper.c index 5653e8b2a34..712a115cea4 100644 --- a/sys/arch/hp300/dev/hyper.c +++ b/sys/arch/hp300/dev/hyper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hyper.c,v 1.13 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: hyper.c,v 1.14 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -86,8 +86,6 @@ #include <hp300/dev/diodevs.h> #include <hp300/dev/intiovar.h> -#include <dev/cons.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -487,66 +485,8 @@ hyper_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, * Hyperion console support */ -int hyper_console_scan(int, caddr_t, void *); -cons_decl(hyper); - -int -hyper_console_scan(int scode, caddr_t va, void *arg) -{ - struct diofbreg *fbr = (struct diofbreg *)va; - struct consdev *cp = arg; - u_int pri; - - if (fbr->id != GRFHWID || fbr->fbid != GID_HYPERION) - return (0); - - pri = CN_NORMAL; - -#ifdef CONSCODE - /* - * Raise our prioity, if appropriate. - */ - if (scode == CONSCODE) - pri = CN_FORCED; -#endif - - /* Only raise priority. */ - if (pri > cp->cn_pri) - cp->cn_pri = pri; - - /* - * If our priority is higher than the currently-remembered - * console, stash our priority. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - conscode = scode; - return (DIO_SIZE(scode, va)); - } - return (0); -} - -void -hypercnprobe(struct consdev *cp) -{ - int maj; - - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } - - if (maj == nchrdev) - return; - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_DEAD; - - console_scan(hyper_console_scan, cp, HP300_BUS_DIO); -} - void -hypercninit(struct consdev *cp) +hypercninit() { hyper_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); diofb_cnattach(&diofb_cn); diff --git a/sys/arch/hp300/dev/rbox.c b/sys/arch/hp300/dev/rbox.c index 4d17431e8cd..92951682cbc 100644 --- a/sys/arch/hp300/dev/rbox.c +++ b/sys/arch/hp300/dev/rbox.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rbox.c,v 1.12 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: rbox.c,v 1.13 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -83,8 +83,6 @@ #include <hp300/dev/diodevs.h> #include <hp300/dev/intiovar.h> -#include <dev/cons.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -383,97 +381,8 @@ rbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, * Renaissance console support */ -int rbox_console_scan(int, caddr_t, void *); -cons_decl(rbox); - -int -rbox_console_scan(int scode, caddr_t va, void *arg) -{ - struct diofbreg *fbr = (struct diofbreg *)va; - struct consdev *cp = arg; - u_int pri; - - if (fbr->id != GRFHWID || fbr->fbid != GID_RENAISSANCE) - return (0); - - pri = CN_NORMAL; - -#ifdef CONSCODE - /* - * Raise our priority, if appropriate. - */ - if (scode == CONSCODE) - pri = CN_FORCED; -#endif - - /* Only raise priority. */ - if (pri > cp->cn_pri) - cp->cn_pri = pri; - - /* - * If our priority is higher than the currently-remembered - * console, stash our priority. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - conscode = scode; - return (DIO_SIZE(scode, va)); - } - return (0); -} - -void -rboxcnprobe(struct consdev *cp) -{ - int maj; - caddr_t va; - struct diofbreg *fbr; - - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } - - if (maj == nchrdev) - return; - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_DEAD; - - /* Look for "internal" framebuffer. */ - va = (caddr_t)IIOV(GRFIADDR); - fbr = (struct diofbreg *)va; - if (!badaddr(va) && - fbr->id == GRFHWID && fbr->fbid == GID_RENAISSANCE) { - cp->cn_pri = CN_INTERNAL; - -#ifdef CONSCODE - if (CONSCODE == CONSCODE_INTERNAL) - cp->cn_pri = CN_FORCED; -#endif - - /* - * If our priority is higher than the currently - * remembered console, stash our priority, and - * unmap whichever device might be currently mapped. - * Since we're internal, we set the saved size to 0 - * so they don't attempt to unmap our fixed VA later. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - if (convasize) - iounmap(conaddr, convasize); - conscode = CONSCODE_INTERNAL; - conaddr = va; - convasize = 0; - } - } - - console_scan(rbox_console_scan, cp, HP300_BUS_DIO); -} - void -rboxcninit(struct consdev *cp) +rboxcninit() { rbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); diofb_cnattach(&diofb_cn); diff --git a/sys/arch/hp300/dev/sti_sgc.c b/sys/arch/hp300/dev/sti_sgc.c index 7e57692ae77..06302a79196 100644 --- a/sys/arch/hp300/dev/sti_sgc.c +++ b/sys/arch/hp300/dev/sti_sgc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti_sgc.c,v 1.5 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: sti_sgc.c,v 1.6 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -35,8 +35,6 @@ #include <machine/bus.h> #include <machine/cpu.h> -#include <dev/cons.h> - #include <hp300/dev/sgcreg.h> #include <hp300/dev/sgcvar.h> @@ -48,8 +46,9 @@ #include <uvm/uvm_extern.h> -int sti_sgc_match(struct device *, void *, void *); -void sti_sgc_attach(struct device *, struct device *, void *); +void sti_sgc_attach(struct device *, struct device *, void *); +int sti_sgc_match(struct device *, void *, void *); +int sti_sgc_probe(bus_space_tag_t, int); struct cfattach sti_sgc_ca = { sizeof(struct sti_softc), sti_sgc_match, sti_sgc_attach @@ -60,8 +59,6 @@ sti_sgc_match(struct device *parent, void *match, void *aux) { struct sgc_attach_args *saa = aux; bus_space_tag_t iot; - bus_space_handle_t ioh; - int devtype; /* * If we already probed it succesfully as a console device, go ahead, @@ -72,24 +69,7 @@ sti_sgc_match(struct device *parent, void *match, void *aux) iot = HP300_BUS_TAG(HP300_BUS_SGC, saa->saa_slot); - if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(saa->saa_slot), - PAGE_SIZE, 0, &ioh)) - return (0); - - devtype = bus_space_read_1(iot, ioh, 3); - - bus_space_unmap(iot, ioh, PAGE_SIZE); - - /* - * This might not be reliable enough. On the other hand, non-STI - * SGC cards will apparently not initialize in an hp300, to the - * point of not even answering bus probes (checked with an - * Harmony/FDDI SGC card). - */ - if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4) - return (0); - - return (1); + return (sti_sgc_probe(iot, saa->saa_slot)); } void @@ -153,85 +133,51 @@ sti_sgc_attach(struct device *parent, struct device *self, void *aux) sti_end_attach(sc); } -/* - * Console code - */ - -int sti_console_scan(int, caddr_t, void *); -cons_decl(sti); - int -sti_console_scan(int slot, caddr_t va, void *arg) +sti_sgc_probe(bus_space_tag_t iot, int slot) { - struct consdev *cp = arg; - bus_space_tag_t iot; bus_space_handle_t ioh; int devtype; - u_int pri; - iot = HP300_BUS_TAG(HP300_BUS_SGC, slot); - - if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(slot), PAGE_SIZE, 0, - &ioh)) + if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(slot), + PAGE_SIZE, 0, &ioh)) return (0); devtype = bus_space_read_1(iot, ioh, 3); bus_space_unmap(iot, ioh, PAGE_SIZE); - /* XXX this is not reliable enough */ - if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4) - return (0); - - pri = CN_INTERNAL; - -#ifdef CONSCODE - /* - * Raise our priority, if appropriate. - */ - if (SGC_SLOT_TO_CONSCODE(slot) == CONSCODE) - pri = CN_FORCED; -#endif - - /* Only raise priority. */ - if (pri > cp->cn_pri) - cp->cn_pri = pri; - /* - * If our priority is higher than the currently-remembered - * console, stash our priority. + * This might not be reliable enough. On the other hand, non-STI + * SGC cards will apparently not initialize in an hp300, to the + * point of not even answering bus probes (checked with an + * Harmony/FDDI SGC card). */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - conscode = SGC_SLOT_TO_CONSCODE(slot); - return (1); - } + if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4) + return (0); - return (0); + return (1); } -void -sticnprobe(struct consdev *cp) -{ - int maj; +/* + * Console code + */ - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } +int sti_console_scan(int); +void sticninit(void); - if (maj == nchrdev) - return; +int +sti_console_scan(int slot) +{ + bus_space_tag_t iot; - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_DEAD; + iot = HP300_BUS_TAG(HP300_BUS_SGC, slot); - /* Search for an sti device */ - console_scan(sti_console_scan, cp, HP300_BUS_SGC); + return (sti_sgc_probe(iot, slot)); } void -sticninit(struct consdev *cp) +sticninit() { extern struct sti_screen stifb_cn; bus_space_tag_t iot; diff --git a/sys/arch/hp300/dev/topcat.c b/sys/arch/hp300/dev/topcat.c index 702bd35be2f..8ad9c6a8425 100644 --- a/sys/arch/hp300/dev/topcat.c +++ b/sys/arch/hp300/dev/topcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: topcat.c,v 1.13 2005/12/30 18:14:09 miod Exp $ */ +/* $OpenBSD: topcat.c,v 1.14 2005/12/31 18:13:41 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -85,8 +85,6 @@ #include <hp300/dev/diodevs.h> #include <hp300/dev/intiovar.h> -#include <dev/cons.h> - #include <dev/wscons/wsconsio.h> #include <dev/wscons/wsdisplayvar.h> #include <dev/rasops/rasops.h> @@ -501,113 +499,8 @@ topcat_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, * Topcat/catseye console support */ -int topcat_console_scan(int, caddr_t, void *); -cons_decl(topcat); - -int -topcat_console_scan(int scode, caddr_t va, void *arg) -{ - struct diofbreg *fbr = (struct diofbreg *)va; - struct consdev *cp = arg; - u_int pri; - - if (fbr->id != GRFHWID) - return (0); - - switch (fbr->fbid) { - case GID_TOPCAT: - case GID_LRCATSEYE: - case GID_HRCCATSEYE: - case GID_HRMCATSEYE: - break; - - default: - return (0); - } - - pri = CN_NORMAL; - -#ifdef CONSCODE - /* - * Raise our priority, if appropriate. - */ - if (scode == CONSCODE) - pri = CN_FORCED; -#endif - - /* Only raise priority. */ - if (pri > cp->cn_pri) - cp->cn_pri = pri; - - /* - * If our priority is higher than the currently-remembered - * console, stash our priority. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - conscode = scode; - return (DIO_SIZE(scode, va)); - } - return (0); -} - -void -topcatcnprobe(struct consdev *cp) -{ - int maj; - caddr_t va; - struct diofbreg *fbr; - - for (maj = 0; maj < nchrdev; maj++) { - if (cdevsw[maj].d_open == wsdisplayopen) - break; - } - - if (maj == nchrdev) - return; - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_DEAD; - - /* Look for "internal" framebuffer. */ - va = (caddr_t)IIOV(GRFIADDR); - fbr = (struct diofbreg *)va; - if (!badaddr(va) && (fbr->id == GRFHWID)) { - switch (fbr->fbid) { - case GID_TOPCAT: - case GID_LRCATSEYE: - case GID_HRCCATSEYE: - case GID_HRMCATSEYE: - cp->cn_pri = CN_INTERNAL; - -#ifdef CONSCODE - if (CONSCODE == CONSCODE_INTERNAL) - cp->cn_pri = CN_FORCED; -#endif - - /* - * If our priority is higher than the currently - * remembered console, stash our priority, and unmap - * whichever device might be currently mapped. - * Since we're internal, we set the saved size to 0 - * so they don't attempt to unmap our fixed VA later. - */ - if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { - cn_tab = cp; - if (convasize) - iounmap(conaddr, convasize); - conscode = CONSCODE_INTERNAL; - conaddr = va; - convasize = 0; - } - } - } - - console_scan(topcat_console_scan, cp, HP300_BUS_DIO); -} - void -topcatcninit(struct consdev *cp) +topcatcninit() { topcat_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); diofb_cnattach(&diofb_cn); diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c index 41306ea7477..fa1fe055ed9 100644 --- a/sys/arch/hp300/hp300/autoconf.c +++ b/sys/arch/hp300/hp300/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.36 2005/12/30 18:14:12 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.37 2005/12/31 18:13:44 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */ /* @@ -1098,105 +1098,61 @@ dev_data_insert(dd, ddlist) * hardware. */ void -console_scan(func, arg, bus) +console_scan(func, arg) int (*func)(int, caddr_t, void *); void *arg; - int bus; { int size, scode, sctop; caddr_t pa, va; - switch (bus) { - case HP300_BUS_DIO: + /* + * Scan all select codes. Check each location for some + * hardware. If there's something there, call (*func)(). + */ + sctop = DIO_SCMAX(machineid); + for (scode = 0; scode < sctop; ++scode) { /* - * Scan all select codes. Check each location for some - * hardware. If there's something there, call (*func)(). + * Skip over the select code hole and + * the internal HP-IB controller. */ - sctop = DIO_SCMAX(machineid); - for (scode = 0; scode < sctop; ++scode) { - /* - * Skip over the select code hole and - * the internal HP-IB controller. - */ - if (DIO_INHOLE(scode) || - ((scode == 7) && internalhpib)) - continue; - - /* Map current PA. */ - pa = dio_scodetopa(scode); - va = iomap(pa, PAGE_SIZE); - if (va == NULL) - continue; + if (DIO_INHOLE(scode) || + ((scode == 7) && internalhpib)) + continue; - /* Check to see if hardware exists. */ - if (badaddr(va)) { - iounmap(va, PAGE_SIZE); - continue; - } + /* Map current PA. */ + pa = dio_scodetopa(scode); + va = iomap(pa, PAGE_SIZE); + if (va == NULL) + continue; - /* - * Hardware present, call callback. Driver returns - * size of region to map if console probe successful - * and worthwhile. - */ - size = (*func)(scode, va, arg); + /* Check to see if hardware exists. */ + if (badaddr(va)) { iounmap(va, PAGE_SIZE); - if (size != 0 && conscode == scode) { - /* Free last mapping. */ - if (convasize) - iounmap(conaddr, convasize); - convasize = 0; - - /* Remap to correct size. */ - va = iomap(pa, size); - if (va == NULL) - continue; - - /* Save this state for next time. */ - conaddr = va; - convasize = size; - } + continue; } - break; -#if NSGC > 0 - case HP300_BUS_SGC: + /* - * Scan all slots. Check each location for some - * hardware. If there's something there, call (*func)(). + * Hardware present, call callback. Driver returns + * size of region to map if console probe successful + * and worthwhile. */ - for (scode = 0; scode < SGC_NSLOTS; ++scode) { - int rv; - - /* Map current PA. */ - pa = sgc_slottopa(scode); - va = iomap(pa, PAGE_SIZE); + size = (*func)(scode, va, arg); + iounmap(va, PAGE_SIZE); + if (size != 0 && conscode == scode) { + /* Free last mapping. */ + if (convasize) + iounmap(conaddr, convasize); + convasize = 0; + + /* Remap to correct size. */ + va = iomap(pa, size); if (va == NULL) continue; - /* Check for hardware. */ - rv = badaddr(va); - iounmap(va, PAGE_SIZE); - if (rv != 0) - continue; - - /* - * Invoke the callback. Driver will return - * non-zero if console probe successfull - * and worthwhile. - */ - if ((*func)(scode, NULL, arg) != 0 && - conscode == SGC_SLOT_TO_CONSCODE(scode)) { - /* Free last mapping. */ - if (convasize) - iounmap(conaddr, convasize); - - /* Save this state for next time. */ - conaddr = NULL; - convasize = 0; - } + /* Save this state for next time. */ + conaddr = va; + convasize = size; } - break; -#endif } } diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c index 73e65cbeb1c..6a388958fd0 100644 --- a/sys/arch/hp300/hp300/conf.c +++ b/sys/arch/hp300/hp300/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.37 2005/01/14 22:39:27 miod Exp $ */ +/* $OpenBSD: conf.c,v 1.38 2005/12/31 18:13:44 miod Exp $ */ /* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej Exp $ */ /*- @@ -266,35 +266,7 @@ int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]); */ #include <dev/cons.h> -#define dvboxcngetc wscngetc -#define dvboxcnputc wscnputc -#define dvboxcnpollc wscnpollc -cons_decl(dvbox); - -#define gboxcngetc wscngetc -#define gboxcnputc wscnputc -#define gboxcnpollc wscnpollc -cons_decl(gbox); - -#define hypercngetc wscngetc -#define hypercnputc wscnputc -#define hypercnpollc wscnpollc -cons_decl(hyper); - -#define rboxcngetc wscngetc -#define rboxcnputc wscnputc -#define rboxcnpollc wscnpollc -cons_decl(rbox); - -#define sticngetc wscngetc -#define sticnputc wscnputc -#define sticnpollc wscnpollc -cons_decl(sti); - -#define topcatcngetc wscngetc -#define topcatcnputc wscnputc -#define topcatcnpollc wscnpollc -cons_decl(topcat); +cons_decl(ws); #define dcacnpollc nullcnpollc cons_decl(dca); @@ -305,34 +277,10 @@ cons_decl(apci); #define dcmcnpollc nullcnpollc cons_decl(dcm); -#include "dvbox.h" -#include "gbox.h" -#include "hyper.h" -#include "rbox.h" -#include "sti.h" -#include "topcat.h" - struct consdev constab[] = { #if NWSDISPLAY > 0 -#if NDVBOX > 0 - cons_init(dvbox), -#endif -#if NGBOX > 0 - cons_init(gbox), -#endif -#if NHYPER > 0 - cons_init(hyper), -#endif -#if NRBOX > 0 - cons_init(rbox), -#endif -#if NSTI > 0 - cons_init(sti), -#endif -#if NTOPCAT > 0 - cons_init(topcat), + cons_init(ws), #endif -#endif /* NWSDISPLAY > 0 */ #if NDCA > 0 cons_init(dca), #endif diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c index ef5df6d900e..4300eda7173 100644 --- a/sys/arch/hp300/hp300/wscons_machdep.c +++ b/sys/arch/hp300/hp300/wscons_machdep.c @@ -1,6 +1,30 @@ -/* $OpenBSD: wscons_machdep.c,v 1.4 2005/12/13 23:13:45 mickey Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.5 2005/12/31 18:13:44 miod Exp $ */ /* + * Copyright (c) 2005, Miodrag Vallat + * + * 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. + * + * 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. + */ +/* * Copyright (c) 2002 Michael Shalayeff * All rights reserved. * @@ -34,6 +58,10 @@ #include <sys/conf.h> #include <sys/device.h> +#include <machine/autoconf.h> +#include <machine/cpu.h> +#include <machine/hp300spu.h> + #include <dev/cons.h> #include <dev/wscons/wsconsio.h> @@ -46,22 +74,236 @@ #include <dev/wscons/wskbdvar.h> #endif +#include "dvbox.h" +#include "gbox.h" +#include "hyper.h" +#include "rbox.h" +#include "topcat.h" +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 +#include <hp300/dev/dioreg.h> +#include <hp300/dev/diovar.h> #include <hp300/dev/diofbreg.h> #include <hp300/dev/diofbvar.h> +struct diofb diofb_cn; +#endif #include "sti.h" #if NSTI > 0 #include <machine/bus.h> +#include <hp300/dev/sgcreg.h> +#include <hp300/dev/sgcvar.h> #include <dev/ic/stireg.h> #include <dev/ic/stivar.h> +extern int sti_console_scan(int); +extern void sticninit(void); +struct sti_screen stifb_cn; +#endif + +extern caddr_t internalhpib; + +cons_decl(ws); + +void (*wsfbcninit)(void) = NULL; + +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 +int dio_fbidentify(struct diofbreg *); + +/* + * Identify a DIO frame buffer and set up wsfbcninit accordingly. + */ +int +dio_fbidentify(struct diofbreg *fbr) +{ + if (fbr->id == GRFHWID) + switch (fbr->fbid) { +#if NDVBOX > 0 + case GID_DAVINCI: + wsfbcninit = dvboxcninit; + return (1); +#endif +#if NGBOX > 0 + case GID_GATORBOX: + wsfbcninit = gboxcninit; + return (1); +#endif +#if NHYPER > 0 + case GID_HYPERION: + wsfbcninit = hypercninit; + return (1); +#endif +#if NRBOX > 0 + case GID_RENAISSANCE: + wsfbcninit = rboxcninit; + return (1); +#endif +#if NTOPCAT > 0 + case GID_TOPCAT: + case GID_LRCATSEYE: + case GID_HRCCATSEYE: + case GID_HRMCATSEYE: + wsfbcninit = topcatcninit; + return (1); +#endif + default: + break; + } + + return (0); +} +#endif + +/* + * This routine handles the dirty work of picking the best frame buffer + * suitable for the console. + * We try to behave as close as possible to the PROM's logic, by preferring + * devices for which we have drivers, in that order: + * - internal video. + * - lowest select code on DIO bus. + * - lowest slot on SGC bus. + */ +void +wscnprobe(struct consdev *cp) +{ + int maj, tmpconscode; + vsize_t mapsize; + vaddr_t va; +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 + paddr_t pa; + u_int scode, sctop; + struct diofbreg *fbr; +#endif + + for (maj = 0; maj < nchrdev; maj++) { + if (cdevsw[maj].d_open == wsdisplayopen) + break; + } + + cp->cn_dev = makedev(maj, 0); + cp->cn_pri = CN_DEAD; + wsfbcninit = NULL; + +#if NDVBOX > 0 || NGBOX > 0 || NRBOX > 0 || NTOPCAT > 0 + /* + * Look for an ``internal'' frame buffer. + */ + va = IIOV(GRFIADDR); + fbr = (struct diofbreg *)va; + if (!badaddr((caddr_t)va)) { + if (dio_fbidentify(fbr)) { + tmpconscode = CONSCODE_INTERNAL; + mapsize = 0; + goto found; + } + } +#endif + +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 + /* + * Scan the DIO bus. + */ + sctop = DIO_SCMAX(machineid); + for (scode = 0; scode < sctop; scode++) { + /* + * Skip over the select code hole and the internal + * HP-IB controller. + */ + if (DIO_INHOLE(scode) || (scode == 7 && internalhpib)) + continue; + + /* Map current PA. */ + pa = (paddr_t)dio_scodetopa(scode); + va = (vaddr_t)iomap((caddr_t)pa, PAGE_SIZE); + if (va == NULL) + continue; + + /* Check to see if hardware exists. */ + if (badaddr((caddr_t)va)) { + iounmap((caddr_t)va, PAGE_SIZE); + continue; + } + + /* Check hardware. */ + fbr = (struct diofbreg *)va; + if (dio_fbidentify(fbr)) { + tmpconscode = scode; + mapsize = DIO_SIZE(scode, va); + iounmap((caddr_t)va, PAGE_SIZE); + va = (vaddr_t)iomap((caddr_t)pa, mapsize); + if (va == NULL) + continue; + goto found; + } else + iounmap((caddr_t)va, PAGE_SIZE); + } #endif -struct diofb diofb_cn; #if NSTI > 0 -struct sti_screen stifb_cn; + /* + * Scan the SGC bus. + */ + for (scode = 0; scode < SGC_NSLOTS; scode++) { + int rv; + + /* Map current PA. */ + pa = (paddr_t)sgc_slottopa(scode); + va = (vaddr_t)iomap((caddr_t)pa, PAGE_SIZE); + if (va == NULL) + continue; + + /* Check to see if hardware exists. */ + rv = badaddr((caddr_t)va); + iounmap((caddr_t)va, PAGE_SIZE); + if (rv != 0) + continue; + + /* Check hardware. */ + if (sti_console_scan(scode) != 0) { + wsfbcninit = sticninit; + tmpconscode = SGC_SLOT_TO_CONSCODE(scode); + mapsize = 0; + va = 0; + goto found; + } + } #endif -cons_decl(ws); + return; + +found: + cp->cn_pri = CN_INTERNAL; +#ifdef CONSCODE + if (CONSCODE == tmpconscode) + cp->cn_pri = CN_FORCED; +#endif + + /* + * If our priority is higher than the currently remembered console, + * install ourselves, and unmap whichever device might be currently + * mapped. + */ + if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) { + cn_tab = cp; + /* Free last mapping. */ + if (convasize) + iounmap(conaddr, convasize); + conscode = tmpconscode; + conaddr = (caddr_t)va; + convasize = mapsize; + + } +} + +void +wscninit(struct consdev *cp) +{ + /* + * Note that this relies on the fact that DIO frame buffers will cause + * cn_tab to switch to wsdisplaycons, so their cninit function will + * never get invoked a second time during the second console pass. + */ + if (wsfbcninit != NULL) + (*wsfbcninit)(); +} void wscnputc(dev_t dev, int i) diff --git a/sys/arch/hp300/include/autoconf.h b/sys/arch/hp300/include/autoconf.h index d9fa65f15bf..261066bfdf8 100644 --- a/sys/arch/hp300/include/autoconf.h +++ b/sys/arch/hp300/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.13 2005/12/30 18:14:12 miod Exp $ */ +/* $OpenBSD: autoconf.h,v 1.14 2005/12/31 18:13:45 miod Exp $ */ /* $NetBSD: autoconf.h,v 1.4 1997/04/01 03:03:56 scottr Exp $ */ /*- @@ -46,7 +46,7 @@ extern int convasize; /* size of mapping at conaddr */ extern int consolepass; /* console initialization pass */ void hp300_cninit(void); -void console_scan(int (*)(int, caddr_t, void *), void *, int); +void console_scan(int (*)(int, caddr_t, void *), void *); caddr_t iomap(caddr_t, int); void iounmap(caddr_t, int); #endif /* _KERNEL */ |