From fceb24d4bbc1faaf0834b9c001f43fb4d98a9f44 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 15 Feb 2003 23:45:53 +0000 Subject: Provide a "code" locator for hil devices. This will let people ask their kernels to attach hilkbd0 (console keyboard) or hilms0 (main mouse) to a specific device in the loop, by using UKC or compiling a new kernel. Using this and the previous console changes, it is now possible on a loop with multiple keyboards, to choose which keyboard will be the console keyboard. --- sys/arch/hppa/conf/GENERIC | 8 ++++---- sys/arch/hppa/conf/RAMDISK | 8 ++++---- sys/dev/hil/files.hil | 4 ++-- sys/dev/hil/hil.c | 20 +++++++++++++++++--- 4 files changed, 27 insertions(+), 13 deletions(-) (limited to 'sys') diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC index 5ac2826840b..e1989b49cab 100644 --- a/sys/arch/hppa/conf/GENERIC +++ b/sys/arch/hppa/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.24 2003/02/15 20:16:41 miod Exp $ +# $OpenBSD: GENERIC,v 1.25 2003/02/15 23:45:50 miod Exp $ # # Diskless kernel config # @@ -69,9 +69,9 @@ option EISAVERBOSE # GSC devices hil* at gsc? irq 1 # Human Interface Loop, kbd and mouse -hilkbd* at hil? # keyboard, knob and buttons -hilms* at hil? # mouse and tablets -#hilid* at hil? # ID module +hilkbd* at hil? code ? # keyboard, knob and buttons +hilms* at hil? code ? # mouse and tablets +#hilid* at hil? code ? # ID module #medusa* at gsc? irq 4 # FDDI diff --git a/sys/arch/hppa/conf/RAMDISK b/sys/arch/hppa/conf/RAMDISK index c9932a84066..8d1a41c0a16 100644 --- a/sys/arch/hppa/conf/RAMDISK +++ b/sys/arch/hppa/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.10 2003/02/15 20:16:41 miod Exp $ +# $OpenBSD: RAMDISK,v 1.11 2003/02/15 23:45:50 miod Exp $ # # Diskless kernel config # @@ -71,9 +71,9 @@ option EISAVERBOSE # GSC devices hil* at gsc? irq 1 # Human Interface Loop, kbd and mouse -hilkbd* at hil? # keyboard, knob and buttons -#hilms* at hil? # mouse and tablets -#hilid* at hil? # ID module +hilkbd* at hil? code ? # keyboard, knob and buttons +#hilms* at hil? code ? # mouse and tablets +#hilid* at hil? code ? # ID module #medusa* at gsc? irq 4 # FDDI diff --git a/sys/dev/hil/files.hil b/sys/dev/hil/files.hil index c78f9155f77..36a48c9e8b2 100644 --- a/sys/dev/hil/files.hil +++ b/sys/dev/hil/files.hil @@ -1,9 +1,9 @@ -# $OpenBSD: files.hil,v 1.2 2003/02/12 01:43:31 miod Exp $ +# $OpenBSD: files.hil,v 1.3 2003/02/15 23:45:52 miod Exp $ # # Configuration file for machine-independent HIL code. # -device hil { } +device hil { code = -1 } file dev/hil/hil.c hil needs-flag device hilkbd: wskbddev diff --git a/sys/dev/hil/hil.c b/sys/dev/hil/hil.c index d8fbd8031bd..869ac0d56d8 100644 --- a/sys/dev/hil/hil.c +++ b/sys/dev/hil/hil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hil.c,v 1.3 2003/02/15 23:42:48 miod Exp $ */ +/* $OpenBSD: hil.c,v 1.4 2003/02/15 23:45:52 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -95,7 +95,7 @@ struct cfdriver hil_cd = { }; void hilconfig(struct hil_softc *); - +int hilsubmatch(struct device *, void *, void *); void hil_process_int(struct hil_softc *, u_int8_t, u_int8_t); void polloff(struct hil_softc *); void pollon(struct hil_softc *); @@ -161,6 +161,19 @@ hildevprint(void *aux, const char *pnp) return (UNCONF); } +int +hilsubmatch(struct device *parent, void *vcf, void *aux) +{ + struct hil_attach_args *ha = aux; + struct cfdata *cf = vcf; + + if (cf->cf_loc[0] != -1 && + cf->cf_loc[0] != ha->ha_code) + return (0); + + return ((*cf->cf_attach->ca_match)(parent, vcf, aux)); +} + void hil_attach_deferred(void *v) { @@ -251,7 +264,8 @@ hil_attach_deferred(void *v) ha.ha_infolen = len; bcopy(sc->sc_cmdbuf, ha.ha_info, len); - config_found(&sc->sc_dev, &ha, hildevprint); + config_found_sm(&sc->sc_dev, &ha, hildevprint, + hilsubmatch); } } -- cgit v1.2.3