summaryrefslogtreecommitdiff
path: root/sys/dev/isa
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-09-22 09:02:35 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-09-22 09:02:35 +0000
commitae088f6cd0dd52119e7b1778b4079139c9d1cf55 (patch)
treeb47a51dcba512ec551e682b8ed93532fadab0e5e /sys/dev/isa
parent9c2ab109e1cb32e9953408c7232de8c9f3292428 (diff)
Get some things ready for later.
Diffstat (limited to 'sys/dev/isa')
-rw-r--r--sys/dev/isa/wd.c7
-rw-r--r--sys/dev/isa/wdc.c65
-rw-r--r--sys/dev/isa/wdreg.h80
3 files changed, 97 insertions, 55 deletions
diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c
index 91c08555d59..2d2d63418e1 100644
--- a/sys/dev/isa/wd.c
+++ b/sys/dev/isa/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.18 1996/09/16 02:36:10 downsj Exp $ */
+/* $OpenBSD: wd.c,v 1.19 1996/09/22 09:02:32 downsj Exp $ */
/* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */
/*
@@ -175,7 +175,7 @@ wdattach(parent, self, aux)
printf(": <%s>\n", buf);
if (d_link->sc_lp->d_type != DTYPE_ST506) {
- printf("%s: %dMB, %d cyl, %d head, %d sec, %d bytes/sec\n",
+ printf("%s: %dMB, %d cyl, %d head, %d sec, %d bytes/sec (%dKB cache)\n",
self->dv_xname,
d_link->sc_params.wdp_cylinders *
(d_link->sc_params.wdp_heads *
@@ -183,7 +183,8 @@ wdattach(parent, self, aux)
d_link->sc_params.wdp_cylinders,
d_link->sc_params.wdp_heads,
d_link->sc_params.wdp_sectors,
- DEV_BSIZE);
+ DEV_BSIZE,
+ d_link->sc_params.wdp_bufsize / 2);
}
#if NISADMA > 0
diff --git a/sys/dev/isa/wdc.c b/sys/dev/isa/wdc.c
index 2ea131073b7..4dd2055f90f 100644
--- a/sys/dev/isa/wdc.c
+++ b/sys/dev/isa/wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc.c,v 1.11 1996/09/22 05:16:40 downsj Exp $ */
+/* $OpenBSD: wdc.c,v 1.12 1996/09/22 09:02:33 downsj Exp $ */
/* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */
/*
@@ -676,13 +676,17 @@ wdcintr(arg)
struct wdc_xfer *xfer;
if ((wdc->sc_flags & WDCF_IRQ_WAIT) == 0) {
+ u_char s;
+#ifdef ATAPI_DEBUG_WDC
+ u_char e, i;
+#endif
DELAY(100);
/* Clear the pending interrupt and abort. */
- u_char s = bus_io_read_1(bc, ioh, wd_status);
+ s = bus_io_read_1(bc, ioh, wd_status);
#ifdef ATAPI_DEBUG_WDC
- u_char e = bus_io_read_1(bc, ioh, wd_error);
- u_char i = bus_io_read_1(bc, ioh, wd_seccnt);
+ e = bus_io_read_1(bc, ioh, wd_error);
+ i = bus_io_read_1(bc, ioh, wd_seccnt);
printf("wdcintr: inactive controller, "
"punting st=%02x er=%02x irr=%02x\n", s, e, i);
@@ -1348,30 +1352,49 @@ wdc_get_parms(d_link)
/* Read in parameter block. */
bus_io_read_multi_2(bc, ioh, wd_data, tb,
sizeof(tb) / sizeof(u_int16_t));
- d_link->sc_params.wdp_config = (int16_t)tb[0];
- d_link->sc_params.wdp_cylinders = (int16_t)tb[1];
- d_link->sc_params.wdp_heads = (int16_t)tb[3];
- d_link->sc_params.wdp_unfbytespertrk = (int16_t)tb[4];
- d_link->sc_params.wdp_unfbytespersec = (int16_t)tb[5];
- d_link->sc_params.wdp_sectors = (int16_t)tb[6];
+ d_link->sc_params.wdp_config = (u_int16_t)tb[0];
+ d_link->sc_params.wdp_cylinders = (u_int16_t)tb[1];
+ d_link->sc_params.wdp_heads = (u_int16_t)tb[3];
+ d_link->sc_params.wdp_unfbytespertrk = (u_int16_t)tb[4];
+ d_link->sc_params.wdp_unfbytespersec = (u_int16_t)tb[5];
+ d_link->sc_params.wdp_sectors = (u_int16_t)tb[6];
u_int16_to_string (tb + 7, d_link->sc_params.wdp_vendor1, 6);
u_int16_to_string (tb + 10, d_link->sc_params.wdp_serial, 20);
- d_link->sc_params.wdp_buftype = (int16_t)tb[20];
- d_link->sc_params.wdp_bufsize = (int16_t)tb[21];
- d_link->sc_params.wdp_eccbytes = (int16_t)tb[22];
+ d_link->sc_params.wdp_buftype = (u_int16_t)tb[20];
+ d_link->sc_params.wdp_bufsize = (u_int16_t)tb[21];
+ d_link->sc_params.wdp_eccbytes = (u_int16_t)tb[22];
u_int16_to_string (tb + 23, d_link->sc_params.wdp_revision, 8);
u_int16_to_string (tb + 27, d_link->sc_params.wdp_model, 40);
d_link->sc_params.wdp_maxmulti = (u_int8_t)(tb[47] & 0xff);
- d_link->sc_params.wdp_vendor2[0] = (int8_t)(tb[47] >> 8 &
+ d_link->sc_params.wdp_vendor2[0] = (u_int8_t)(tb[47] >> 8 &
+ 0xff);
+ d_link->sc_params.wdp_usedmovsd = (u_int16_t)tb[48];
+ d_link->sc_params.wdp_vendor3[0] = (u_int8_t)(tb[49] & 0xff);
+ d_link->sc_params.wdp_capabilities = (u_int8_t)(tb[49] >> 8 &
+ 0xff);
+ d_link->sc_params.wdp_vendor4[0] = (u_int8_t)(tb[50] & 0xff);
+ d_link->sc_params.wdp_piotiming = (u_int8_t)(tb[50] >> 8 &
0xff);
- d_link->sc_params.wdp_usedmovsd = (int16_t)tb[48];
- d_link->sc_params.wdp_vendor3[0] = (int8_t)(tb[49] & 0xff);
- d_link->sc_params.wdp_capabilities = (int8_t)(tb[49] >> 8 &
+ d_link->sc_params.wdp_vendor5[0] = (u_int8_t)(tb[51] & 0xff);
+ d_link->sc_params.wdp_dmatiming = (u_int8_t)(tb[51] >> 8 &
0xff);
- d_link->sc_params.wdp_vendor4[0] = (int8_t)(tb[50] & 0xff);
- d_link->sc_params.wdp_piotiming = (int8_t)(tb[50] >> 8 & 0xff);
- d_link->sc_params.wdp_vendor5[0] = (int8_t)(tb[51] & 0xff);
- d_link->sc_params.wdp_dmatiming = (int8_t)(tb[51] >> 8 & 0xff);
+ d_link->sc_params.wdp_capvalid = (u_int16_t)tb[52];
+ d_link->sc_params.wdp_curcyls = (u_int16_t)tb[53];
+ d_link->sc_params.wdp_curheads = (u_int16_t)tb[54];
+ d_link->sc_params.wdp_cursectors = (u_int16_t)tb[55];
+ d_link->sc_params.wdp_curcapacity[0] = (u_int16_t)tb[56];
+ d_link->sc_params.wdp_curcapacity[1] = (u_int16_t)tb[57];
+ d_link->sc_params.wdp_curmulti = (u_int8_t)(tb[58] & 0xff);
+ d_link->sc_params.wdp_valmulti = (u_int8_t)(tb[58] >> 8 & 0xff);
+ d_link->sc_params.wdp_lbacapacity[0] = (u_int16_t)tb[59];
+ d_link->sc_params.wdp_lbacapacity[1] = (u_int16_t)tb[60];
+ d_link->sc_params.wdp_dma1word = (u_int16_t)tb[61];
+ d_link->sc_params.wdp_dmamword = (u_int16_t)tb[62];
+ d_link->sc_params.wdp_eidepiomode = (u_int16_t)tb[63];
+ d_link->sc_params.wdp_eidedmamin = (u_int16_t)tb[64];
+ d_link->sc_params.wdp_eidedmatime = (u_int16_t)tb[65];
+ d_link->sc_params.wdp_eidepiotime = (u_int16_t)tb[66];
+ d_link->sc_params.wdp_eidepioiordy = (u_int16_t)tb[67];
}
/* Clear any leftover interrupt. */
diff --git a/sys/dev/isa/wdreg.h b/sys/dev/isa/wdreg.h
index 4b23e2041ea..d517bfb71c7 100644
--- a/sys/dev/isa/wdreg.h
+++ b/sys/dev/isa/wdreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdreg.h,v 1.5 1996/09/17 15:55:42 mickey Exp $ */
+/* $OpenBSD: wdreg.h,v 1.6 1996/09/22 09:02:34 downsj Exp $ */
/* $NetBSD: wdreg.h,v 1.13 1995/03/29 21:56:46 briggs Exp $ */
/*-
@@ -149,38 +149,56 @@
* read parameters command returns this:
*/
struct wdparams {
- /* drive info */
- short wdp_config; /* general configuration */
+ u_int16_t wdp_config; /* general configuration */
#define WD_CFG_REMOVABLE 0x0080
#define WD_CFG_FIXED 0x0040
- short wdp_cylinders; /* number of non-removable cylinders */
- char __reserved1[2];
- short wdp_heads; /* number of heads */
- short wdp_unfbytespertrk; /* number of unformatted bytes/track */
- short wdp_unfbytespersec; /* number of unformatted bytes/sector */
- short wdp_sectors; /* number of sectors */
- char wdp_vendor1[6];
- /* controller info */
- char wdp_serial[20]; /* serial number */
- short wdp_buftype; /* buffer type */
-#define WD_BUF_SINGLEPORTSECTOR 1 /* single port, single sector buffer */
-#define WD_BUF_DUALPORTMULTI 2 /* dual port, multiple sector buffer */
-#define WD_BUF_DUALPORTMULTICACHE 3 /* above plus track cache */
- short wdp_bufsize; /* buffer size, in 512-byte units */
- short wdp_eccbytes; /* ecc bytes appended */
- char wdp_revision[8]; /* firmware revision */
- char wdp_model[40]; /* model name */
- u_char wdp_maxmulti; /* maximum sectors per interrupt */
- char wdp_vendor2[1];
- short wdp_usedmovsd; /* can use double word read/write? */
- char wdp_vendor3[1];
- char wdp_capabilities; /* capability flags */
-#define WD_CAP_LBA 0x02
+ u_int16_t wdp_cylinders; /* number of non-removable cylinders */
+ u_int8_t __reserved1[2];
+ u_int16_t wdp_heads; /* number of heads */
+ u_int16_t wdp_unfbytespertrk; /* number of unformatted bytes/track */
+ u_int16_t wdp_unfbytespersec; /* number of unformatted bytes/sector */
+ u_int16_t wdp_sectors; /* number of sectors */
+ u_int8_t wdp_vendor1[6];
+ u_int8_t wdp_serial[20]; /* serial number */
+ u_int16_t wdp_buftype; /* buffer type */
+#define WD_BUF_SINGLEPORTSECTOR 1 /* single port, single sector buffer */
+#define WD_BUF_DUALPORTMULTI 2 /* dual port, multiple sector buffer */
+#define WD_BUF_DUALPORTMULTICACHE 3 /* above plus track cache */
+ u_int16_t wdp_bufsize; /* buffer size, in 512-byte units */
+ u_int16_t wdp_eccbytes; /* ecc bytes appended */
+ u_int8_t wdp_revision[8]; /* firmware revision */
+ u_int8_t wdp_model[40]; /* model name */
+ u_int8_t wdp_maxmulti; /* maximum sectors per interrupt */
+ u_int8_t wdp_vendor2[1];
+ u_int16_t wdp_usedmovsd; /* can use double word read/write? */
+ u_int8_t wdp_vendor3[1];
+ u_int8_t wdp_capabilities; /* capability flags */
#define WD_CAP_DMA 0x01
- char __reserved2[2];
- char wdp_vendor4[1];
- char wdp_piotiming; /* PIO timing mode */
- char wdp_vendor5[1];
- char wdp_dmatiming; /* DMA timing mode */
+#define WD_CAP_LBA 0x02
+#define WD_CAP_IORDYSW 0x04
+#define WD_CAP_IODRYSUP 0x08
+ u_int8_t __reserved2[2];
+ u_int8_t wdp_vendor4[1];
+ u_int8_t wdp_piotiming; /* PIO timing mode */
+ u_int8_t wdp_vendor5[1];
+ u_int8_t wdp_dmatiming; /* DMA timing mode */
+ u_int16_t wdp_capvalid; /* valid capabilities */
+ u_int16_t wdp_curcyls; /* logical cylinders */
+ u_int16_t wdp_curheads; /* logical heads */
+ u_int16_t wdp_cursectors; /* logical sectors per track */
+ u_int16_t wdp_curcapacity[2]; /* logical total sectors on drive */
+ u_int8_t wdp_curmulti; /* current multiple sector count */
+ u_int8_t wdp_valmulti; /* multiple sector is valid */
+#define WD_CAP_MULTI 0x01
+ u_int16_t wdp_lbacapacity[2]; /* total number of sectors */
+ u_int16_t wdp_dma1word; /* single-word dma info */
+ u_int16_t wdp_dmamword; /* multiple-word dma info */
+ u_int16_t wdp_eidepiomode; /* EIDE PIO mode */
+#define WD_CAP_PIO3 0x01
+#define WD_CAP_PIO4 0x02
+ u_int16_t wdp_eidedmamin; /* min mword dma cycle time (ns) */
+ u_int16_t wdp_eidedmatime; /* rec'd mword dma cycle time (ns) */
+ u_int16_t wdp_eidepiotime; /* min cycle time (ns), no IORDY */
+ u_int16_t wdp_eidepioiordy; /* min cycle time (ns), with IORDY */
};
#endif /* _KERNEL && !_LOCORE*/