diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-06-10 08:01:15 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-06-10 08:01:15 +0000 |
commit | f8da1b4285628bdb2ba423b0c08c7b0f7b3ceb58 (patch) | |
tree | bb1feeeed41b3a1c2279a2c81ec4c187b1e4c2cb /sys | |
parent | c3a0d345e8b3415cc8b8111abaab4d1c25827b2a (diff) |
* Keep the cappage in the acd_softc.
* If TYPE_DAD, and removable, assume it's a busted CD-ROM.
* Print out some cappage data in attach, and other cosmetic changes.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/atapi/acd.c | 40 | ||||
-rw-r--r-- | sys/dev/atapi/atapi.h | 10 | ||||
-rw-r--r-- | sys/dev/atapi/atapiconf.c | 4 | ||||
-rw-r--r-- | sys/dev/atapi/atapilink.h | 14 |
4 files changed, 53 insertions, 15 deletions
diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c index 702d39d11cd..e5dfa3a4f0f 100644 --- a/sys/dev/atapi/acd.c +++ b/sys/dev/atapi/acd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acd.c,v 1.4 1996/06/10 00:43:56 downsj Exp $ */ +/* $OpenBSD: acd.c,v 1.5 1996/06/10 08:01:06 downsj Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -77,6 +77,7 @@ struct acd_softc { #define CDF_WLABEL 0x04 /* label is writable */ #define CDF_LABELLING 0x08 /* writing label */ struct at_dev_link *ad_link; /* contains our drive number, etc ... */ + struct cappage cap; /* drive capabilities */ struct cd_parms { int blksize; u_long disksize; /* total number sectors */ @@ -123,8 +124,11 @@ acdmatch(parent, match, aux) sa->id.config.device_type & ATAPI_DEVICE_TYPE_MASK); #endif - if ((sa->id.config.device_type & ATAPI_DEVICE_TYPE_MASK) == - ATAPI_DEVICE_TYPE_CD) + if (((sa->id.config.device_type & ATAPI_DEVICE_TYPE_MASK) == + ATAPI_DEVICE_TYPE_CD) || + (((sa->id.config.device_type & ATAPI_DEVICE_TYPE_MASK) == + ATAPI_DEVICE_TYPE_DAD) && + (sa->id.config.cmd_drq_rem & ATAPI_REMOVABLE))) return 1; return 0; } @@ -141,7 +145,6 @@ acdattach(parent, self, aux) struct acd_softc *acd = (void *)self; struct at_dev_link *sa = aux; struct mode_sense cmd; - struct cappage cap; printf("\n"); @@ -169,13 +172,36 @@ acdattach(parent, self, aux) bzero(&cmd, sizeof(cmd)); cmd.operation_code = ATAPI_MODE_SENSE; cmd.page_code_control = CAP_PAGE; - _lto2b(sizeof(cap), cmd.length); - if (atapi_exec_cmd(sa, &cmd , sizeof(cmd), &cap, sizeof(cap), - B_READ, A_POLLED) != 0) { + _lto2b(sizeof(struct cappage), cmd.length); + if (atapi_exec_cmd(sa, &cmd , sizeof(cmd), &acd->cap, + sizeof(struct cappage), B_READ, A_POLLED) != 0) { printf("%s: can't MODE SENSE: atapi_exec_cmd failed\n", self->dv_xname); return; } + + /* + * Fix cappage entries in place. + */ + acd->cap.max_speed = _2btos((u_int8_t *)&acd->cap.max_speed); + acd->cap.max_vol_levels = _2btos((u_int8_t *)&acd->cap.max_vol_levels); + acd->cap.buf_size = _2btos((u_int8_t *)&acd->cap.buf_size); + acd->cap.cur_speed = _2btos((u_int8_t *)&acd->cap.cur_speed); + + /* + * Display useful information about the drive (not media!). + */ + printf ("%s: ", self->dv_xname); + if (acd->cap.cur_speed != acd->cap.max_speed) + printf ("%d/", acd->cap.cur_speed * 1000 / 1024); + printf ("%dKb/sec", acd->cap.max_speed * 1000 / 1024); + if (acd->cap.buf_size) + printf (", %dKb cache", acd->cap.buf_size); + if (acd->cap.format_cap & FORMAT_AUDIO_PLAY) + printf (", audio play"); + if (acd->cap.max_vol_levels) + printf (", %d volume levels", acd->cap.max_vol_levels); + printf ("\n"); } /* diff --git a/sys/dev/atapi/atapi.h b/sys/dev/atapi/atapi.h index ed82083c528..d382863e561 100644 --- a/sys/dev/atapi/atapi.h +++ b/sys/dev/atapi/atapi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atapi.h,v 1.2 1996/06/09 08:59:48 downsj Exp $ */ +/* $OpenBSD: atapi.h,v 1.3 1996/06/10 08:01:11 downsj Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -198,10 +198,10 @@ struct cappage { #define SEP_VOL 0x01 /* independent volume controls */ #define SEP_MUTE 0x02 /* independent mute controls */ - u_int8_t max_speed[2]; /* max raw data rate in bytes/1000 */ - u_int8_t max_vol_levels[2]; /* number of discrete volume levels */ - u_int8_t buf_size[2]; /* internal buffer size in bytes/1024 */ - u_int8_t cur_speed[2]; /* current data rate in bytes/1000 */ + u_int16_t max_speed; /* max raw data rate in bytes/1000 */ + u_int16_t max_vol_levels; /* number of discrete volume levels */ + u_int16_t buf_size; /* internal buffer size in bytes/1024 */ + u_int16_t cur_speed; /* current data rate in bytes/1000 */ /* Digital drive output format description (optional?) */ u_int8_t reserved3; diff --git a/sys/dev/atapi/atapiconf.c b/sys/dev/atapi/atapiconf.c index cd285c7de6f..dc60f426cf5 100644 --- a/sys/dev/atapi/atapiconf.c +++ b/sys/dev/atapi/atapiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiconf.c,v 1.2 1996/06/09 08:59:49 downsj Exp $ */ +/* $OpenBSD: atapiconf.c,v 1.3 1996/06/10 08:01:13 downsj Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -155,7 +155,7 @@ atapiprint(aux, bus) if (bus != NULL) printf("%s", bus); - printf(" drive %d: <%s, %s, %s> type %d/%s %s", + printf(" drive %d: <%s, %s, %s> ATAPI %d/%s %s", ad_link->drive, id->model, id->serial_number, id->firmware_revision, id->config.device_type & ATAPI_DEVICE_TYPE_MASK, dtype, fixrem); diff --git a/sys/dev/atapi/atapilink.h b/sys/dev/atapi/atapilink.h index d8791f97ce3..f9a125276e8 100644 --- a/sys/dev/atapi/atapilink.h +++ b/sys/dev/atapi/atapilink.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atapilink.h,v 1.3 1996/06/10 00:43:57 downsj Exp $ */ +/* $OpenBSD: atapilink.h,v 1.4 1996/06/10 08:01:14 downsj Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -204,6 +204,7 @@ static __inline void _lto2b __P((u_int32_t val, u_int8_t *bytes)); static __inline void _lto3b __P((u_int32_t val, u_int8_t *bytes)); static __inline void _lto4b __P((u_int32_t val, u_int8_t *bytes)); static __inline u_int32_t _2btol __P((u_int8_t *bytes)); +static __inline u_int16_t _2btos __P((u_int8_t *bytes)); static __inline u_int32_t _3btol __P((u_int8_t *bytes)); static __inline u_int32_t _4btol __P((u_int8_t *bytes)); @@ -258,6 +259,17 @@ _2btol(bytes) return (rv); } +static __inline u_int16_t +_2btos(bytes) + u_int8_t *bytes; +{ + register u_int16_t rv; + + rv = (bytes[0] << 8) | + bytes[1]; + return (rv); +} + static __inline u_int32_t _3btol(bytes) u_int8_t *bytes; |