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/dev | |
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/dev')
-rw-r--r-- | sys/dev/hil/hil.c | 29 | ||||
-rw-r--r-- | sys/dev/hil/hildevs.h | 5 | ||||
-rw-r--r-- | sys/dev/hil/hilkbd.c | 22 | ||||
-rw-r--r-- | sys/dev/hil/hilvar.h | 6 |
4 files changed, 30 insertions, 32 deletions
diff --git a/sys/dev/hil/hil.c b/sys/dev/hil/hil.c index 9c9d9bd647c..d8fbd8031bd 100644 --- a/sys/dev/hil/hil.c +++ b/sys/dev/hil/hil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hil.c,v 1.2 2003/02/15 23:38:46 miod Exp $ */ +/* $OpenBSD: hil.c,v 1.3 2003/02/15 23:42:48 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -125,7 +125,7 @@ hildatawait(struct hil_softc *sc) */ void -hil_attach(struct hil_softc *sc) +hil_attach(struct hil_softc *sc, int hil_is_console) { printf("\n"); @@ -137,7 +137,7 @@ hil_attach(struct hil_softc *sc) sc->sc_cmddone = 0; sc->sc_cmdbp = sc->sc_cmdbuf; sc->sc_pollbp = sc->sc_pollbuf; - sc->sc_kbddev = 0; + sc->sc_console = hil_is_console; } /* @@ -244,24 +244,13 @@ hil_attach_deferred(void *v) if (sc->sc_cmdbuf[0] >= hd->minid && sc->sc_cmdbuf[0] <= hd->maxid) { + ha.ha_console = sc->sc_console; ha.ha_code = id; ha.ha_type = hd->type; ha.ha_descr = hd->descr; ha.ha_infolen = len; bcopy(sc->sc_cmdbuf, ha.ha_info, len); - if (ha.ha_type == HIL_DEVICE_KEYBOARD) { - /* - * Currently, the first found hil keyboard will - * be attached as a console keyboard. - * This will change when we have hil at wax - * attachment. - */ - ha.ha_flags = id == sc->sc_kbddev; - } else { - ha.ha_flags = 0; - } - config_found(&sc->sc_dev, &ha, hildevprint); } } @@ -387,15 +376,7 @@ hilconfig(struct hil_softc *sc) #endif /* - * Locate the main keyboard device, if present. - */ - db = 0; - send_hil_cmd(sc, HIL_READKBDSADR, NULL, 0, &db); - sc->sc_kbddev = ffs((int)db); - - /* - * Put all keyboards in raw mode, in case we ended there after - * a reconfigure event. + * Put all keyboards in raw mode now. */ db = 0; send_hil_cmd(sc, HIL_WRITEKBDSADR, &db, 1, NULL); diff --git a/sys/dev/hil/hildevs.h b/sys/dev/hil/hildevs.h index c093fb10a7a..7ccb01c70d2 100644 --- a/sys/dev/hil/hildevs.h +++ b/sys/dev/hil/hildevs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hildevs.h,v 1.1 2003/02/11 19:39:30 miod Exp $ */ +/* $OpenBSD: hildevs.h,v 1.2 2003/02/15 23:42:48 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -36,15 +36,14 @@ struct hildevice { /* Arguments passed to attach routines */ struct hil_attach_args { - struct confargs ha_ca; int ha_code; /* hil code */ int ha_type; /* hil device type */ + int ha_console; /* console set to hil */ int ha_infolen; /* identify info length */ u_int8_t ha_info[HILBUFSIZE]; /* identify info bits */ #define ha_id ha_info[0] /* hil probe id */ const char *ha_descr; /* device description */ - int ha_flags; /* extra information */ }; /* ha_type values */ diff --git a/sys/dev/hil/hilkbd.c b/sys/dev/hil/hilkbd.c index 3b125145e36..829bf4dcb41 100644 --- a/sys/dev/hil/hilkbd.c +++ b/sys/dev/hil/hilkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hilkbd.c,v 1.3 2003/02/15 23:38:46 miod Exp $ */ +/* $OpenBSD: hilkbd.c,v 1.4 2003/02/15 23:42:48 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -99,6 +99,7 @@ struct wskbd_mapdata hilkbd_keymapdata = { void hilkbd_bell(struct hil_softc *, u_int, u_int, u_int); void hilkbd_callback(void *, u_int, u_int8_t *); void hilkbd_decode(u_int8_t, u_int8_t, u_int *, int *); +int hilkbd_is_console(int); int hilkbdprobe(struct device *parent, void *match, void *aux) @@ -149,7 +150,7 @@ hilkbdattach(struct device *parent, struct device *self, void *aux) printf("\n"); - a.console = ha->ha_flags; + a.console = hilkbd_is_console(ha->ha_console); a.keymap = &hilkbd_keymapdata; a.accessops = &hilkbd_accessops; a.accesscookie = sc; @@ -292,3 +293,20 @@ hilkbd_decode(u_int8_t stat, u_int8_t data, u_int *type, int *key) *type = (data & 1) ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN; *key = data >> 1; } + +int +hilkbd_is_console(int hil_is_console) +{ + static int seen_hilkbd_console = 0; + + /* if not first hil keyboard, then not the console */ + if (seen_hilkbd_console) + return (0); + + /* if PDC console does not match hil bus path, then not the console */ + if (hil_is_console == 0) + return (0); + + seen_hilkbd_console = 1; + return (1); +} diff --git a/sys/dev/hil/hilvar.h b/sys/dev/hil/hilvar.h index 80fc3799a18..58e91aabe7a 100644 --- a/sys/dev/hil/hilvar.h +++ b/sys/dev/hil/hilvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hilvar.h,v 1.2 2003/02/15 23:38:46 miod Exp $ */ +/* $OpenBSD: hilvar.h,v 1.3 2003/02/15 23:42:48 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -79,6 +79,7 @@ struct hil_softc { struct device sc_dev; bus_space_handle_t sc_bsh; bus_space_tag_t sc_bst; + int sc_console; /* console path set to hil */ int sc_cmddone; int sc_cmdending; @@ -90,7 +91,6 @@ struct hil_softc { u_int8_t *sc_cmdbp; /* pointer into sc_cmdbuf */ u_int sc_maxdev; /* number of devices on loop */ - u_int sc_kbddev; /* keyboard device id */ struct hil_cb sc_cb[NHILD]; /* interrupt dispatcher */ }; @@ -101,7 +101,7 @@ void send_hildev_cmd(struct hil_softc *, u_int, u_int, u_int8_t *, u_int *); void hil_set_poll(struct hil_softc *, int); int hil_poll_data(struct hil_softc *, u_int8_t *, u_int8_t *); -void hil_attach(struct hil_softc *); +void hil_attach(struct hil_softc *, int); void hil_attach_deferred(void *); void hil_callback_register(struct hil_softc *, u_int, void (*)(void *, u_int, u_int8_t *), void *); |