diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-07-23 04:40:15 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-07-23 04:40:15 +0000 |
commit | 5207d4715d1efb29aac99eab9f9ab6c045d33e84 (patch) | |
tree | 4c4a2772a56c98e999d8f75011baaccab09bea39 /sys/dev/isa | |
parent | 9203e2e6cffec59281fade1b5508d0da6d116a39 (diff) |
Print LBA-based size as well as CHS size.
Fix some bugs in getting drive parameters into the wdparams array
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/wd.c | 57 | ||||
-rw-r--r-- | sys/dev/isa/wdc.c | 34 | ||||
-rw-r--r-- | sys/dev/isa/wdreg.h | 6 |
3 files changed, 56 insertions, 41 deletions
diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c index 5be8262f271..f8c407ae7b1 100644 --- a/sys/dev/isa/wd.c +++ b/sys/dev/isa/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.32 1997/12/10 23:09:37 rees Exp $ */ +/* $OpenBSD: wd.c,v 1.33 1998/07/23 04:40:11 csapuntz Exp $ */ /* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */ /* @@ -175,16 +175,33 @@ 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 (%dKB cache)\n", - self->dv_xname, - d_link->sc_params.wdp_cylinders * - (d_link->sc_params.wdp_heads * - d_link->sc_params.wdp_sectors) / (1048576 / DEV_BSIZE), - d_link->sc_params.wdp_cylinders, - d_link->sc_params.wdp_heads, - d_link->sc_params.wdp_sectors, - DEV_BSIZE, - d_link->sc_params.wdp_bufsize / 2); + if ((d_link->sc_params.wdp_capabilities & WD_CAP_LBA) != 0) { + + printf("%s: %dMB, %d sec, %d bytes/sec (%dKB cache)\n", + self->dv_xname, + d_link->sc_params.wdp_lbacapacity / 2048, + d_link->sc_params.wdp_lbacapacity, + DEV_BSIZE, /* XXX */ + d_link->sc_params.wdp_bufsize / 2); + + printf ("%s: %d cyl, %d head, %d sec\n", + self->dv_xname, + d_link->sc_params.wdp_cylinders, + d_link->sc_params.wdp_heads, + d_link->sc_params.wdp_sectors); + } + else { + 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 * + d_link->sc_params.wdp_sectors) / (1048576 / DEV_BSIZE), + d_link->sc_params.wdp_cylinders, + d_link->sc_params.wdp_heads, + d_link->sc_params.wdp_sectors, + DEV_BSIZE, + d_link->sc_params.wdp_bufsize / 2); + } } #if NISADMA > 0 @@ -193,13 +210,13 @@ wdattach(parent, self, aux) d_link->sc_mode = WDM_DMA; } else #endif - if (d_link->sc_params.wdp_maxmulti > 1) { - d_link->sc_mode = WDM_PIOMULTI; - d_link->sc_multiple = min(d_link->sc_params.wdp_maxmulti, 16); - } else { - d_link->sc_mode = WDM_PIOSINGLE; - d_link->sc_multiple = 1; - } + if (d_link->sc_params.wdp_maxmulti > 1) { + d_link->sc_mode = WDM_PIOMULTI; + d_link->sc_multiple = min(d_link->sc_params.wdp_maxmulti, 16); + } else { + d_link->sc_mode = WDM_PIOSINGLE; + d_link->sc_multiple = 1; + } printf("%s: using", wd->sc_dev.dv_xname); #if NISADMA > 0 @@ -208,8 +225,8 @@ wdattach(parent, self, aux) else #endif printf(" %d-sector %d-bit pio transfers,", - d_link->sc_multiple, - (d_link->sc_flags & WDF_32BIT) == 0 ? 16 : 32); + d_link->sc_multiple, + (d_link->sc_flags & WDF_32BIT) == 0 ? 16 : 32); if ((d_link->sc_params.wdp_capabilities & WD_CAP_LBA) != 0) printf(" lba addressing\n"); else diff --git a/sys/dev/isa/wdc.c b/sys/dev/isa/wdc.c index c4c109b1967..437fa91965d 100644 --- a/sys/dev/isa/wdc.c +++ b/sys/dev/isa/wdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc.c,v 1.31 1998/07/09 05:37:21 downsj Exp $ */ +/* $OpenBSD: wdc.c,v 1.32 1998/07/23 04:40:12 csapuntz Exp $ */ /* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */ /* @@ -900,23 +900,21 @@ wdc_get_parms(d_link) 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_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]; + d_link->sc_params.wdp_capvalid = (u_int16_t)tb[53]; + d_link->sc_params.wdp_curcyls = (u_int16_t)tb[54]; + d_link->sc_params.wdp_curheads = (u_int16_t)tb[55]; + d_link->sc_params.wdp_cursectors = (u_int16_t)tb[56]; + d_link->sc_params.wdp_curcapacity = ((u_int32_t)tb[58] << 16) + tb[57]; + d_link->sc_params.wdp_curmulti = (u_int8_t)(tb[59] & 0xff); + d_link->sc_params.wdp_valmulti = (u_int8_t)(tb[59] >> 8 & 0xff); + d_link->sc_params.wdp_lbacapacity = ((u_int32_t)tb[61] << 16) + tb[60]; + d_link->sc_params.wdp_dma1word = (u_int16_t)tb[62]; + d_link->sc_params.wdp_dmamword = (u_int16_t)tb[63]; + d_link->sc_params.wdp_eidepiomode = (u_int16_t)tb[64]; + d_link->sc_params.wdp_eidedmamin = (u_int16_t)tb[65]; + d_link->sc_params.wdp_eidedmatime = (u_int16_t)tb[66]; + d_link->sc_params.wdp_eidepiotime = (u_int16_t)tb[67]; + d_link->sc_params.wdp_eidepioiordy = (u_int16_t)tb[68]; } /* Clear any leftover interrupt. */ diff --git a/sys/dev/isa/wdreg.h b/sys/dev/isa/wdreg.h index d517bfb71c7..a44110de3d8 100644 --- a/sys/dev/isa/wdreg.h +++ b/sys/dev/isa/wdreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wdreg.h,v 1.6 1996/09/22 09:02:34 downsj Exp $ */ +/* $OpenBSD: wdreg.h,v 1.7 1998/07/23 04:40:14 csapuntz Exp $ */ /* $NetBSD: wdreg.h,v 1.13 1995/03/29 21:56:46 briggs Exp $ */ /*- @@ -186,11 +186,11 @@ struct wdparams { 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_int32_t wdp_curcapacity; /* 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_int32_t wdp_lbacapacity; /* 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 */ |