diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-12-31 18:13:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-12-31 18:13:46 +0000 |
commit | 8a011db3a5d0218e0445148b33c93c13d7f4cbde (patch) | |
tree | 43b5dfd2edfb075933fda930f68b6e14667f0cff /sys/arch/hp300/dev/rbox.c | |
parent | 831af64476ec7008c4fa79754f4f56bcc4fa6124 (diff) |
Rework (once again) the console code, in order to match the PROM's logic better.
When not running on serial console, the PROM will pick the ``internal''
graphics device, and if it does not exist, the DIO device with the lowest
select code, and will resort to SGC devices if no internal or DIO device
was found.
However, the current logic would search for a certain frame buffer type first,
then for its best hardware location, following the order they are listed
in conf.c.
By replacing gazillions of almost-exactly-duplicated frame buffer code with
one single instance, which is device type-agnostic, we can match the PROM
(and the bootblocks) logic again. Plus this saves a few KB of code!
Diffstat (limited to 'sys/arch/hp300/dev/rbox.c')
-rw-r--r-- | sys/arch/hp300/dev/rbox.c | 95 |
1 files changed, 2 insertions, 93 deletions
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); |