diff options
author | wollman <wollman@FreeBSD.org> | 1995-04-12 20:48:13 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-04-12 20:48:13 +0000 |
commit | 6a8d3a357d2d39cf1274d89e9ee73459574e038d (patch) | |
tree | 3733f361a8298b0f38c2e4586c976a9240816ec2 /sys/i386/isa/mse.c | |
parent | 669ed5b46ea62e3997fc8495702ddc9078fa7031 (diff) | |
download | FreeBSD-src-6a8d3a357d2d39cf1274d89e9ee73459574e038d.zip FreeBSD-src-6a8d3a357d2d39cf1274d89e9ee73459574e038d.tar.gz |
Add a class field to devconf and mst drivers.
For those where it was easy, drivers were also fixed to call
dev_attach() during probe rather than attach (in keeping with the
new design articulated in a mail message five months ago). For
a few that were really easy, correct state tracking was added as well.
The `fd' driver was fixed to correctly fill in the description.
The CPU identify code was fixed to attach a `cpu' device. The code
was also massively reordered to fill in cpu_model with somethingremotely
resembling what identifycpu() prints out. A few bytes saved by using
%b to format the features list rather than lots of ifs.
Diffstat (limited to 'sys/i386/isa/mse.c')
-rw-r--r-- | sys/i386/isa/mse.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index de7b26d..a2c5ef3 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -11,7 +11,7 @@ * this software for any purpose. It is provided "as is" * without express or implied warranty. * - * $Id: mse.c,v 1.9 1994/11/08 05:41:34 jkh Exp $ + * $Id: mse.c,v 1.10 1995/03/28 07:55:44 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -181,6 +181,27 @@ struct mse_types { { 0, }, }; +static struct kern_devconf kdc_mse[NMSE] = { { + 0, 0, 0, /* filled in by dev_attach */ + "mse", 0, { MDDT_ISA, 0, "tty" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNCONFIGURED, /* state */ + "ATI or Logitech bus mouse adapter", + DC_CLS_MISC /* class */ +} }; + +static inline void +mse_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_mse[id->id_unit] = kdc_mse[0]; + kdc_mse[id->id_unit].kdc_unit = id->id_unit; + kdc_mse[id->id_unit].kdc_isa = id; + dev_attach(&kdc_mse[id->id_unit]); +} + int mseprobe(idp) register struct isa_device *idp; @@ -188,6 +209,7 @@ mseprobe(idp) register struct mse_softc *sc = &mse_sc[idp->id_unit]; register int i; + mse_registerdev(idp); /* * Check for each mouse type in the table. */ @@ -205,26 +227,6 @@ mseprobe(idp) return (0); } -static struct kern_devconf kdc_mse[NMSE] = { { - 0, 0, 0, /* filled in by dev_attach */ - "mse", 0, { MDDT_ISA, 0, "tty" }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, - &kdc_isa0, /* parent */ - 0, /* parentdata */ - DC_UNKNOWN, /* not supported */ - "ATI or Logitech bus mouse adapter" -} }; - -static inline void -mse_registerdev(struct isa_device *id) -{ - if(id->id_unit) - kdc_mse[id->id_unit] = kdc_mse[0]; - kdc_mse[id->id_unit].kdc_unit = id->id_unit; - kdc_mse[id->id_unit].kdc_isa = id; - dev_attach(&kdc_mse[id->id_unit]); -} - int mseattach(idp) struct isa_device *idp; @@ -232,7 +234,7 @@ mseattach(idp) struct mse_softc *sc = &mse_sc[idp->id_unit]; sc->sc_port = idp->id_iobase; - mse_registerdev(idp); + kdc_mse[idp->id_unit].kdc_state = DC_IDLE; return (1); } @@ -253,6 +255,7 @@ mseopen(dev, flag) if (sc->sc_flags & MSESC_OPEN) return (EBUSY); sc->sc_flags |= MSESC_OPEN; + kdc_mse[MSE_UNIT(dev)].kdc_state = DC_BUSY; sc->sc_obuttons = sc->sc_buttons = 0x7; sc->sc_deltax = sc->sc_deltay = 0; sc->sc_bytesread = PROTOBYTES; @@ -280,6 +283,7 @@ mseclose(dev, flag) s = spltty(); (*sc->sc_disablemouse)(sc->sc_port); sc->sc_flags &= ~MSESC_OPEN; + kdc_mse[MSE_UNIT(dev)].kdc_state = DC_IDLE; splx(s); return(0); } |