diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-02-15 23:42:49 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-02-15 23:42:49 +0000 |
commit | 6434bd21eaa615beaa194cf38016480670e6592f (patch) | |
tree | 41eaaa63aba734737ac75486f635f6596a1de0d8 /sys/arch/hppa | |
parent | 8a5b523cbdbf5fea0561720803f3f507147688a9 (diff) |
Rework the console management on hppa:
- only attach a keyboard as a console if it matches the PDC keyboard path
- on hil, as there can be multiple keyboards on the loop, attach only the
first hilkbd device configured as console keyboard. Right now this means
the one with the lowest hil code, which was the existing behaviour so far.
- do not try to switch to the wscons consdev structure early at all in
wscons_machdep, but rather wait for the console to be completely
configured (i.e. both wskbd and wsdisplay are attached) to switch.
With feedback and help from mickey@
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r-- | sys/arch/hppa/gsc/gsckbc.c | 11 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/gsckbd.c | 6 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/hil_gsc.c | 8 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/wscons_machdep.c | 70 |
4 files changed, 34 insertions, 61 deletions
diff --git a/sys/arch/hppa/gsc/gsckbc.c b/sys/arch/hppa/gsc/gsckbc.c index f598a3e8427..1e145b2760c 100644 --- a/sys/arch/hppa/gsc/gsckbc.c +++ b/sys/arch/hppa/gsc/gsckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gsckbc.c,v 1.1 2003/01/31 22:50:19 miod Exp $ */ +/* $OpenBSD: gsckbc.c,v 1.2 2003/02/15 23:42:45 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -76,9 +76,10 @@ #include <sys/malloc.h> #include <sys/proc.h> +#include <machine/autoconf.h> #include <machine/bus.h> #include <machine/intr.h> -#include <machine/autoconf.h> +#include <machine/iomod.h> #include <hppa/dev/cpudevs.h> #include <hppa/gsc/gscbusvar.h> @@ -268,7 +269,7 @@ probe_sendtmo(bus_space_tag_t iot, bus_space_handle_t ioh, int cmdbyte) DELAY(500); } - if (bus_space_read_1(iot, ioh, KBSTATP) & KBS_OCMD) + if (numtries <= 0) return (1); bus_space_write_1(iot, ioh, KBDATAP, cmdbyte); @@ -407,7 +408,9 @@ gsckbc_attach(struct device *parent, struct device *self, void *aux) sc->sc_dv.dv_xname, gsc->sc_type, ident); } else { #if (NGSCKBD > 0) - if (gsc->sc_type == PCKBC_KBD_SLOT) + if (gsc->sc_type == PCKBC_KBD_SLOT && + ga->ga_dp.dp_mod == PAGE0->mem_kbd.pz_dp.dp_mod && + bcmp(ga->ga_dp.dp_bc, PAGE0->mem_kbd.pz_dp.dp_bc, 6) == 0) gsckbd_cnattach(t, PCKBC_KBD_SLOT); #endif pckbc_attach_slot(sc, gsc->sc_type); diff --git a/sys/arch/hppa/gsc/gsckbd.c b/sys/arch/hppa/gsc/gsckbd.c index c6e42325f68..60222b439af 100644 --- a/sys/arch/hppa/gsc/gsckbd.c +++ b/sys/arch/hppa/gsc/gsckbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gsckbd.c,v 1.2 2003/02/15 01:01:21 miod Exp $ */ +/* $OpenBSD: gsckbd.c,v 1.3 2003/02/15 23:42:45 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -155,7 +155,7 @@ struct gsckbd_softc { #endif }; -static int gsckbd_is_console(pckbc_tag_t, pckbc_slot_t); +int gsckbd_is_console(pckbc_tag_t, pckbc_slot_t); int gsckbdprobe(struct device *, void *, void *); void gsckbdattach(struct device *, struct device *, void *); @@ -207,7 +207,7 @@ static int gsckbd_led_decode(int); struct gsckbd_internal gsckbd_consdata; -static int +int gsckbd_is_console(tag, slot) pckbc_tag_t tag; pckbc_slot_t slot; diff --git a/sys/arch/hppa/gsc/hil_gsc.c b/sys/arch/hppa/gsc/hil_gsc.c index c0e2683b9d4..d5ab2bdcd44 100644 --- a/sys/arch/hppa/gsc/hil_gsc.c +++ b/sys/arch/hppa/gsc/hil_gsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hil_gsc.c,v 1.1 2003/02/11 19:44:23 miod Exp $ */ +/* $OpenBSD: hil_gsc.c,v 1.2 2003/02/15 23:42:45 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -67,6 +67,7 @@ hil_gsc_attach(struct device *parent, struct device *self, void *aux) { struct hil_softc *sc = (void *)self; struct gsc_attach_args *ga = aux; + int hil_is_console; sc->sc_bst = ga->ga_iot; if (bus_space_map(ga->ga_iot, ga->ga_hpa, @@ -75,7 +76,10 @@ hil_gsc_attach(struct device *parent, struct device *self, void *aux) return; } - hil_attach(sc); + hil_is_console = ga->ga_dp.dp_mod == PAGE0->mem_kbd.pz_dp.dp_mod && + bcmp(ga->ga_dp.dp_bc, PAGE0->mem_kbd.pz_dp.dp_bc, 6) == 0; + + hil_attach(sc, hil_is_console); gsc_intr_establish((struct gsc_softc *)parent, IPL_TTY, ga->ga_irq, hil_intr, sc, &sc->sc_dev); diff --git a/sys/arch/hppa/hppa/wscons_machdep.c b/sys/arch/hppa/hppa/wscons_machdep.c index ea38f036c77..a5ffe1068c6 100644 --- a/sys/arch/hppa/hppa/wscons_machdep.c +++ b/sys/arch/hppa/hppa/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.4 2003/01/31 22:50:19 miod Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.5 2003/02/15 23:42:46 miod Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -38,21 +38,13 @@ #include <sys/device.h> #include <sys/extent.h> +#include <machine/autoconf.h> #include <machine/bus.h> #include <machine/pdc.h> #include <machine/iomod.h> #include <dev/cons.h> -#include "sti.h" -#if NSTI > 0 -#include <dev/ic/stireg.h> -#include <dev/ic/stivar.h> -#endif - -#if NGSCKBD > 0 -#endif - #include "wsdisplay.h" #if NWSDISPLAY > 0 #include <dev/wscons/wsdisplayvar.h> @@ -66,57 +58,33 @@ cons_decl(ws); void -wscnprobe(cp) - struct consdev *cp; +wscnprobe(struct consdev *cp) { - int maj; - - /* locate the major number */ - for (maj = 0; maj < nchrdev; maj++) - if (cdevsw[maj].d_open == wsdisplayopen) - break; - - if (maj == nchrdev) - panic("wsdisplay is not in cdevsw[]"); - -#if NSTI > 0 - if (PAGE0->mem_cons.pz_class == PCL_DISPL) { - - } else - return; -#else - return; -#endif -#if NGSCKBD > 0 - if (PAGE0->mem_kbd.pz_class == PCL_KEYBD) { - - } else - return; -#else - return; -#endif - - cp->cn_dev = makedev(maj, 0); - cp->cn_pri = CN_INTERNAL; + /* + * Due to various device probe restrictions, the wscons console + * can never be enabled early during boot. + * It will be enabled as soon as enough wscons components get + * attached. + * So do nothing there, the switch will occur in + * wsdisplay_emul_attach() later. + */ } void -wscninit(cp) - struct consdev *cp; +wscninit(struct consdev *cp) { } void -wscnputc(dev, i) - dev_t dev; - char i; +wscnputc(dev_t dev, int i) { - wsdisplay_cnputc(dev, (int)i); +#if NWSDISPLAY > 0 + wsdisplay_cnputc(dev, i); +#endif } int -wscngetc(dev) - dev_t dev; +wscngetc(dev_t dev) { #if NWSKBD > 0 return (wskbd_cngetc(dev)); @@ -126,9 +94,7 @@ wscngetc(dev) } void -wscnpollc(dev, on) - dev_t dev; - int on; +wscnpollc(dev_t dev, int on) { #if NWSKBD > 0 wskbd_cnpollc(dev, on); |