diff options
author | ken <ken@FreeBSD.org> | 1998-10-02 05:25:49 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 1998-10-02 05:25:49 +0000 |
commit | 555e3912745f812a59847721e00316f474707979 (patch) | |
tree | 38cf525c23efaa3da2ad851073076f6f6b69f64a /sys/cam/scsi/scsi_all.h | |
parent | c19e09786ae641a353a484bb8ace2e97269c5b2b (diff) | |
download | FreeBSD-src-555e3912745f812a59847721e00316f474707979.zip FreeBSD-src-555e3912745f812a59847721e00316f474707979.tar.gz |
Modify the changer driver so it can handle (hopefully!) changers that need
block descriptors enabled on mode sense commands.
Basically, we try sending a mode sense with block descriptors disabled (the
previous default), and if it fails, we try sending the mode sense with
block descriptors enabled. If that works, we note that in a runtime quirk
entry, so we don't bother disabling block descriptors again for the device.
This problem was first reported by Chris Jones <cjones@honors.montana.edu>
on one of the NetBSD lists, but I'd imagine that some FreeBSD users would
have run into it eventually as well, since our changer driver is derived
form the NetBSD changer driver.
Also, change some of the probe logic so that we do the right thing in the
case of a failure to attach.
Fix a memory leak in chgetparams().
Add a couple of inline helper functions to scsi_all.h to correctly return
the start of a mode page.
NetBSD PR: kern/6214
Reviewed by: gibbs
Diffstat (limited to 'sys/cam/scsi/scsi_all.h')
-rw-r--r-- | sys/cam/scsi/scsi_all.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index 3a78840..adc16cf 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsi_all.h,v 1.2 1998/09/18 22:33:59 ken Exp $ + * $Id: scsi_all.h,v 1.3 1998/09/29 22:11:30 ken Exp $ */ /* @@ -796,7 +796,8 @@ static __inline u_int32_t scsi_2btoul(u_int8_t *bytes); static __inline u_int32_t scsi_3btoul(u_int8_t *bytes); static __inline int32_t scsi_3btol(u_int8_t *bytes); static __inline u_int32_t scsi_4btoul(u_int8_t *bytes); - +static __inline void *find_mode_page_6(struct scsi_mode_header_6 *mode_header); +static __inline void *find_mode_page_10(struct scsi_mode_header_10 *mode_header); static __inline void scsi_extract_sense(struct scsi_sense_data *sense, int *error_code, int *sense_key, @@ -878,6 +879,33 @@ scsi_4btoul(u_int8_t *bytes) bytes[3]; return (rv); } + +/* + * Given the pointer to a returned mode sense buffer, return a pointer to + * the start of the first mode page. + */ +static __inline void * +find_mode_page_6(struct scsi_mode_header_6 *mode_header) +{ + void *page_start; + + page_start = (void *)((u_int8_t *)&mode_header[1] + + mode_header->blk_desc_len); + + return(page_start); +} + +static __inline void * +find_mode_page_10(struct scsi_mode_header_10 *mode_header) +{ + void *page_start; + + page_start = (void *)((u_int8_t *)&mode_header[1] + + scsi_2btoul(mode_header->blk_desc_len)); + + return(page_start); +} + __END_DECLS #endif /*_SCSI_SCSI_ALL_H*/ |