diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-11-18 00:09:16 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-11-18 00:09:16 +0000 |
commit | 31b0d766e88d40f0ba613dffb70b4565626d1c9a (patch) | |
tree | c3cceb17cc19300ee7eac2d1fdb84b2c6dd9e6dc /sys/arch/hp300/dev | |
parent | 64a145823a888809d18469fc425979f77b3fa5bb (diff) |
Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for its size.
No functional change.
Diffstat (limited to 'sys/arch/hp300/dev')
-rw-r--r-- | sys/arch/hp300/dev/ct.c | 6 | ||||
-rw-r--r-- | sys/arch/hp300/dev/ctreg.h | 26 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hd.c | 25 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hdreg.h | 26 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hdvar.h | 3 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hpibvar.h | 30 |
6 files changed, 48 insertions, 68 deletions
diff --git a/sys/arch/hp300/dev/ct.c b/sys/arch/hp300/dev/ct.c index 10b453964a9..3dbd363c8a3 100644 --- a/sys/arch/hp300/dev/ct.c +++ b/sys/arch/hp300/dev/ct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct.c,v 1.12 2005/11/16 21:23:55 miod Exp $ */ +/* $OpenBSD: ct.c,v 1.13 2005/11/18 00:09:15 miod Exp $ */ /* $NetBSD: ct.c,v 1.21 1997/04/02 22:37:23 scottr Exp $ */ /* @@ -204,7 +204,7 @@ ctident(parent, sc, ha) struct ct_softc *sc; struct hpibbus_attach_args *ha; { - struct ct_describe desc; + struct cs80_describe desc; u_char stat, cmd[3]; char name[7]; int i, id, n, type, canstream; @@ -231,7 +231,7 @@ ctident(parent, sc, ha) cmd[1] = C_SVOL(0); cmd[2] = C_DESC; hpibsend(parent->dv_unit, ha->ha_slave, C_CMD, cmd, sizeof(cmd)); - hpibrecv(parent->dv_unit, ha->ha_slave, C_EXEC, &desc, 37); + hpibrecv(parent->dv_unit, ha->ha_slave, C_EXEC, &desc, sizeof(desc)); hpibrecv(parent->dv_unit, ha->ha_slave, C_QSTAT, &stat, sizeof(stat)); bzero(name, sizeof(name)); diff --git a/sys/arch/hp300/dev/ctreg.h b/sys/arch/hp300/dev/ctreg.h index 8560c8e244e..f3b2123b6ef 100644 --- a/sys/arch/hp300/dev/ctreg.h +++ b/sys/arch/hp300/dev/ctreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctreg.h,v 1.6 2004/04/12 22:12:32 jmc Exp $ */ +/* $OpenBSD: ctreg.h,v 1.7 2005/11/18 00:09:15 miod Exp $ */ /* $NetBSD: ctreg.h,v 1.6 1996/02/09 18:00:35 scottr Exp $ */ /* @@ -99,30 +99,6 @@ struct ct_clearcmd { char cmd; }; -struct ct_describe { - u_int d_iuw:16, /* controller: installed unit word */ - d_cmaxxfr:16, /* controller: max transfer rate (Kb) */ - d_ctype:8, /* controller: controller type */ - d_utype:8, /* unit: unit type */ - d_name:24, /* unit: name (6 BCD digits) */ - d_sectsize:16, /* unit: # of bytes per block (sector) */ - d_blkbuf:8, /* unit: # of blocks which can be buffered */ - d_burstsize:8, /* unit: recommended burst size */ - d_blocktime:16, /* unit: block time (u-sec) */ - d_uavexfr:16, /* unit: average transfer rate (Kb) */ - d_retry:16, /* unit: optimal retry time (1/100-sec) */ - d_access:16, /* unit: access time param (1/100-sec) */ - d_maxint:8, /* unit: maximum interleave */ - d_fvbyte:8, /* unit: fixed volume byte */ - d_rvbyte:8, /* unit: removable volume byte */ - d_maxcyl:24, /* volume: maximum cylinder */ - d_maxhead:8, /* volume: maximum head */ - d_maxsect:16, /* volume: maximum sector on track */ - d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */ - d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */ - d_interleave:8; /* volume: current interleave */ - }; - #define CT7946ID 0x220 #define CT9145ID 0x268 #define CT9144ID 0x260 diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c index 9a9a83d01c7..620e792bd94 100644 --- a/sys/arch/hp300/dev/hd.c +++ b/sys/arch/hp300/dev/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.35 2005/11/16 21:23:55 miod Exp $ */ +/* $OpenBSD: hd.c,v 1.36 2005/11/18 00:09:15 miod Exp $ */ /* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */ /* @@ -326,7 +326,7 @@ hdident(parent, sc, ha) struct hd_softc *sc; struct hpibbus_attach_args *ha; { - struct hd_describe *desc = sc != NULL ? &sc->sc_hddesc : NULL; + struct cs80_describe desc; u_char stat, cmd[3]; char name[7]; int i, id, n, ctlr, slave; @@ -361,11 +361,12 @@ hdident(parent, sc, ha) cmd[1] = C_SVOL(0); cmd[2] = C_DESC; hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd)); - hpibrecv(ctlr, slave, C_EXEC, desc, 37); + hpibrecv(ctlr, slave, C_EXEC, &desc, sizeof(desc)); hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat)); + bzero(name, sizeof(name)); if (stat == 0) { - n = desc->d_name; + n = desc.d_name; for (i = 5; i >= 0; i--) { name[i] = (n & 0xf) + '0'; n >>= 4; @@ -375,18 +376,18 @@ hdident(parent, sc, ha) #ifdef DEBUG if (hddebug & HDB_IDENT) { printf("\n%s: name: %x ('%s')\n", - sc->sc_dev.dv_xname, desc->d_name, name); + sc->sc_dev.dv_xname, desc.d_name, name); printf(" iuw %x, maxxfr %d, ctype %d\n", - desc->d_iuw, desc->d_cmaxxfr, desc->d_ctype); + desc.d_iuw, desc.d_cmaxxfr, desc.d_ctype); printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n", - desc->d_utype, desc->d_sectsize, - desc->d_blkbuf, desc->d_burstsize, desc->d_blocktime); + desc.d_utype, desc.d_sectsize, + desc.d_blkbuf, desc.d_burstsize, desc.d_blocktime); printf(" avxfr %d, ort %d, atp %d, maxint %d, fv %x, rv %x\n", - desc->d_uavexfr, desc->d_retry, desc->d_access, - desc->d_maxint, desc->d_fvbyte, desc->d_rvbyte); + desc.d_uavexfr, desc.d_retry, desc.d_access, + desc.d_maxint, desc.d_fvbyte, desc.d_rvbyte); printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n", - desc->d_maxcyl, desc->d_maxhead, desc->d_maxsect, - desc->d_maxvsectl, desc->d_interleave); + desc.d_maxcyl, desc.d_maxhead, desc.d_maxsect, + desc.d_maxvsectl, desc.d_interleave); printf("%s", sc->sc_dev.dv_xname); } #endif diff --git a/sys/arch/hp300/dev/hdreg.h b/sys/arch/hp300/dev/hdreg.h index bb86d423d2f..30a7f1f4198 100644 --- a/sys/arch/hp300/dev/hdreg.h +++ b/sys/arch/hp300/dev/hdreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hdreg.h,v 1.4 2005/11/15 07:02:36 miod Exp $ */ +/* $OpenBSD: hdreg.h,v 1.5 2005/11/18 00:09:15 miod Exp $ */ /* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */ /* @@ -104,30 +104,6 @@ struct hd_clearcmd { char c_cmd; }; -struct hd_describe { - u_int d_iuw:16, /* controller: installed unit word */ - d_cmaxxfr:16, /* controller: max transfer rate (Kb) */ - d_ctype:8, /* controller: controller type */ - d_utype:8, /* unit: unit type */ - d_name:24, /* unit: name (6 BCD digits) */ - d_sectsize:16, /* unit: # of bytes per block (sector) */ - d_blkbuf:8, /* unit: # of blocks which can be buffered */ - d_burstsize:8, /* unit: recommended burst size */ - d_blocktime:16, /* unit: block time (u-sec) */ - d_uavexfr:16, /* unit: average transfer rate (Kb) */ - d_retry:16, /* unit: optimal retry time (1/100-sec) */ - d_access:16, /* unit: access time param (1/100-sec) */ - d_maxint:8, /* unit: maximum interleave */ - d_fvbyte:8, /* unit: fixed volume byte */ - d_rvbyte:8, /* unit: removable volume byte */ - d_maxcyl:24, /* volume: maximum cylinder */ - d_maxhead:8, /* volume: maximum head */ - d_maxsect:16, /* volume: maximum sector on track */ - d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */ - d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */ - d_interleave:8; /* volume: current interleave */ - }; - /* HW ids */ #define HD7946AID 0x220 /* also 7945A */ #define HD9134DID 0x221 /* also 9122S */ diff --git a/sys/arch/hp300/dev/hdvar.h b/sys/arch/hp300/dev/hdvar.h index 1dd72546181..dfe8917d3c2 100644 --- a/sys/arch/hp300/dev/hdvar.h +++ b/sys/arch/hp300/dev/hdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hdvar.h,v 1.7 2005/11/14 20:20:30 miod Exp $ */ +/* $OpenBSD: hdvar.h,v 1.8 2005/11/18 00:09:15 miod Exp $ */ /* $NetBSD: rdvar.h,v 1.6 1997/01/30 09:14:19 thorpej Exp $ */ /* @@ -66,7 +66,6 @@ struct hd_softc { short sc_type; char *sc_addr; int sc_resid; - struct hd_describe sc_hddesc; struct hpibqueue sc_hq; /* hpib job queue entry */ struct hd_iocmd sc_ioc; struct hd_rscmd sc_rsc; diff --git a/sys/arch/hp300/dev/hpibvar.h b/sys/arch/hp300/dev/hpibvar.h index c0bb1c41357..b6eaedb937c 100644 --- a/sys/arch/hp300/dev/hpibvar.h +++ b/sys/arch/hp300/dev/hpibvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hpibvar.h,v 1.9 2005/11/16 21:23:55 miod Exp $ */ +/* $OpenBSD: hpibvar.h,v 1.10 2005/11/18 00:09:15 miod Exp $ */ /* $NetBSD: hpibvar.h,v 1.10 1997/03/31 07:34:25 scottr Exp $ */ /* @@ -158,6 +158,34 @@ struct hpibbus_softc { #define HPIBF_TIMO 0x10 #define HPIBF_DMA16 0x8000 +/* + * Description structure for CS/80 devices. + */ + +struct cs80_describe { + u_int d_iuw:16, /* controller: installed unit word */ + d_cmaxxfr:16, /* controller: max transfer rate (Kb) */ + d_ctype:8, /* controller: controller type */ + d_utype:8, /* unit: unit type */ + d_name:24, /* unit: name (6 BCD digits) */ + d_sectsize:16, /* unit: # of bytes per block (sector) */ + d_blkbuf:8, /* unit: # of blocks which can be buffered */ + d_burstsize:8, /* unit: recommended burst size */ + d_blocktime:16, /* unit: block time (u-sec) */ + d_uavexfr:16, /* unit: average transfer rate (Kb) */ + d_retry:16, /* unit: optimal retry time (1/100-sec) */ + d_access:16, /* unit: access time param (1/100-sec) */ + d_maxint:8, /* unit: maximum interleave */ + d_fvbyte:8, /* unit: fixed volume byte */ + d_rvbyte:8, /* unit: removable volume byte */ + d_maxcyl:24, /* volume: maximum cylinder */ + d_maxhead:8, /* volume: maximum head */ + d_maxsect:16, /* volume: maximum sector on track */ + d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */ + d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */ + d_interleave:8; /* volume: current interleave */ +} __packed; + #ifdef _KERNEL extern caddr_t internalhpib; extern int hpibtimeout; |