summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/wt.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-04-12 20:48:13 +0000
committerwollman <wollman@FreeBSD.org>1995-04-12 20:48:13 +0000
commit6a8d3a357d2d39cf1274d89e9ee73459574e038d (patch)
tree3733f361a8298b0f38c2e4586c976a9240816ec2 /sys/i386/isa/wt.c
parent669ed5b46ea62e3997fc8495702ddc9078fa7031 (diff)
downloadFreeBSD-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/wt.c')
-rw-r--r--sys/i386/isa/wt.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c
index cee9dbc..3b9718b 100644
--- a/sys/i386/isa/wt.c
+++ b/sys/i386/isa/wt.c
@@ -19,7 +19,7 @@
* the original CMU copyright notice.
*
* Version 1.3, Thu Nov 11 12:09:13 MSK 1993
- * $Id: wt.c,v 1.14 1995/01/09 17:55:10 joerg Exp $
+ * $Id: wt.c,v 1.15 1995/03/28 07:55:56 bde Exp $
*
*/
@@ -170,6 +170,28 @@ static int wtreadfm (wtinfo_t *t);
static int wtwritefm (wtinfo_t *t);
static int wtpoll (wtinfo_t *t, int mask, int bits);
+static struct kern_devconf kdc_wt[NWT] = { {
+ 0, 0, 0, /* filled in by dev_attach */
+ "wt", 0, { MDDT_ISA, 0, "bio" },
+ isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
+ &kdc_isa0, /* parent */
+ 0, /* parentdata */
+ DC_UNCONFIGURED, /* state */
+ "Archive or Wangtek QIC-02/QIC-36 tape controller",
+ DC_CLS_TAPE /* class */
+} };
+
+static inline void
+wt_registerdev(struct isa_device *id)
+{
+ if(id->id_unit)
+ kdc_wt[id->id_unit] = kdc_wt[0];
+ kdc_wt[id->id_unit].kdc_unit = id->id_unit;
+ kdc_wt[id->id_unit].kdc_parentdata = id;
+ dev_attach(&kdc_wt[id->id_unit]);
+}
+
+
/*
* Probe for the presence of the device.
*/
@@ -177,6 +199,8 @@ int wtprobe (struct isa_device *id)
{
wtinfo_t *t = wttab + id->id_unit;
+ wt_registerdev(id);
+
t->unit = id->id_unit;
t->chan = id->id_drq;
t->port = id->id_iobase;
@@ -214,27 +238,6 @@ int wtprobe (struct isa_device *id)
return (0);
}
-static struct kern_devconf kdc_wt[NWT] = { {
- 0, 0, 0, /* filled in by dev_attach */
- "wt", 0, { MDDT_ISA, 0, "bio" },
- isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
- &kdc_isa0, /* parent */
- 0, /* parentdata */
- DC_UNKNOWN, /* host adapters are always busy */
- "Archive or Wangtek QIC-02/QIC-36 tape controller"
-} };
-
-static inline void
-wt_registerdev(struct isa_device *id)
-{
- if(id->id_unit)
- kdc_wt[id->id_unit] = kdc_wt[0];
- kdc_wt[id->id_unit].kdc_unit = id->id_unit;
- kdc_wt[id->id_unit].kdc_parentdata = id;
- dev_attach(&kdc_wt[id->id_unit]);
-}
-
-
/*
* Device is found, configure it.
*/
@@ -249,7 +252,7 @@ int wtattach (struct isa_device *id)
printf ("wt%d: type <Wangtek>\n", t->unit);
t->flags = TPSTART; /* tape is rewound */
t->dens = -1; /* unknown density */
- wt_registerdev(id);
+ kdc_wt[id->id_unit].kdc_state = DC_IDLE;
return (1);
}
@@ -336,6 +339,8 @@ int wtopen (int dev, int flag)
return (EAGAIN);
t->flags = TPINUSE;
+ kdc_wt[u].kdc_state = DC_BUSY;
+
if (flag & FREAD)
t->flags |= TPREAD;
if (flag & FWRITE)
@@ -383,6 +388,7 @@ int wtclose (int dev)
wtreadfm (t);
done:
t->flags &= TPREW | TPRMARK | TPSTART | TPTIMER;
+ kdc_wt[u].kdc_state = DC_IDLE;
free (t->buf, M_TEMP);
return (0);
}
OpenPOWER on IntegriCloud