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/npx.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/npx.c')
-rw-r--r-- | sys/i386/isa/npx.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 47e43d5..aacff0d 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.20 1995/02/23 17:32:38 bde Exp $ + * $Id: npx.c,v 1.21 1995/03/05 04:06:44 wpaul Exp $ */ #include "npx.h" @@ -148,6 +148,30 @@ _probetrap: iret "); +static struct kern_devconf kdc_npx[NNPX] = { { + 0, 0, 0, /* filled in by dev_attach */ + "npx", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNCONFIGURED, /* state */ + "Floating-point unit", + DC_CLS_MISC /* class */ +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_npx[unit] = kdc_npx[0]; + kdc_npx[unit].kdc_unit = unit; + kdc_npx[unit].kdc_isa = id; + dev_attach(&kdc_npx[unit]); +} + /* * Probe routine. Initialize cr0 to give correct behaviour for [f]wait * whether the device exists or not (XXX should be elsewhere). Set flags @@ -171,6 +195,7 @@ npxprobe(dvp) * install suitable handlers and run with interrupts enabled so we * won't need to do so much here. */ + npx_registerdev(dvp); npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1; save_eflags = read_eflags(); disable_intr(); @@ -308,29 +333,6 @@ npxprobe1(dvp) return (-1); } -static struct kern_devconf kdc_npx[NNPX] = { { - 0, 0, 0, /* filled in by dev_attach */ - "npx", 0, { MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, - &kdc_isa0, /* parent */ - 0, /* parentdata */ - DC_BUSY, - "Floating-point unit" -} }; - -static inline void -npx_registerdev(struct isa_device *id) -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_npx[unit] = kdc_npx[0]; - kdc_npx[unit].kdc_unit = unit; - kdc_npx[unit].kdc_isa = id; - dev_attach(&kdc_npx[unit]); -} - /* * Attach routine - announce which it is, and wire into system */ @@ -354,8 +356,9 @@ npxattach(dvp) printf("npx%d: no 387 emulator in kernel!\n", dvp->id_unit); #endif npxinit(__INITIAL_NPXCW__); - if (npx_exists) - npx_registerdev(dvp); + if (npx_exists) { + kdc_npx[dvp->id_unit].kdc_state = DC_BUSY; + } return (1); /* XXX unused */ } |