diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1993-08-20 09:23:30 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1993-08-20 09:23:30 +0000 |
commit | cf0a4c9f207124f943e290bcc365b75f8deea2c6 (patch) | |
tree | 5dcbce83587cfd32b34f8a919c3f679ce971a405 /sys | |
parent | 2970641bb3922023009c2b42e8d0074196806195 (diff) | |
download | FreeBSD-src-cf0a4c9f207124f943e290bcc365b75f8deea2c6.zip FreeBSD-src-cf0a4c9f207124f943e290bcc365b75f8deea2c6.tar.gz |
Update scsi code to the latest from Julian. This code is now identical
to the last copy from Julian. After this commit I will be commiting the
local fixes and makeing diffs to send back to Julian so he can update his
code.
----
From julian@jules.DIALix.oz.au Thu Aug 5 09:25:23 1993
To: hd@world.std.com, julian@jules.DIALix.oz.au
Cc: nate@bsd.coe.montana.edu
Subject: Re: new scsi
----
From julian@jules.DIALix.oz.au Sat Aug 7 04:13:17 1993
To: hd@world.std.com (HD Associates)
Cc: nate@bsd.coe.montana.edu
Subject: Re: timeout diffs
Here are the diffs to take the scsi stuff to my latest tree from what
Nate and you received..
the changes remove all the local timeout stuff and use (un)timeout(),
----
From julian@jules.DIALix.oz.au Sat Aug 7 04:13:45 1993
To: hd@world.std.com (HD Associates)
Cc: nate@bsd.coe.montana.edu, briggs@csugrad.cs.vt.edu
here is a fix for a silly bug in the scsiconf I just sent out
and a similar fix for st.c
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/cd.c | 73 | ||||
-rw-r--r-- | sys/scsi/ch.c | 77 | ||||
-rw-r--r-- | sys/scsi/scsi_all.h | 223 | ||||
-rw-r--r-- | sys/scsi/scsi_cd.h | 151 | ||||
-rw-r--r-- | sys/scsi/scsi_changer.h | 48 | ||||
-rw-r--r-- | sys/scsi/scsi_disk.h | 85 | ||||
-rw-r--r-- | sys/scsi/scsi_tape.h | 109 | ||||
-rw-r--r-- | sys/scsi/scsiconf.c | 145 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 7 | ||||
-rw-r--r-- | sys/scsi/sd.c | 192 | ||||
-rw-r--r-- | sys/scsi/st.c | 160 |
11 files changed, 542 insertions, 728 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 538c9e1..879b0f7 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -13,11 +13,17 @@ * functioning of this software in any circumstances. * */ -static char rev[] = "$Revision: 1.2 $"; +static char rev[] = "$Revision: 1.5 $"; /* * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system */ #define SPLCD splbio @@ -703,8 +709,8 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag) struct cd_mode_data data; if(error = cd_get_mode(unit,&data,AUDIO_PAGE)) break; - data.page.audio.sotc = 0; - data.page.audio.immed = 1; + data.page.audio.flags &= ~CD_PA_SOTC; + data.page.audio.flags |= CD_PA_IMMED; if(error = cd_set_mode(unit,&data)) break; return(cd_play_tracks(unit @@ -722,8 +728,8 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag) struct cd_mode_data data; if(error = cd_get_mode(unit,&data,AUDIO_PAGE)) break; - data.page.audio.sotc = 0; - data.page.audio.immed = 1; + data.page.audio.flags &= ~CD_PA_SOTC; + data.page.audio.flags |= CD_PA_IMMED; if(error = cd_set_mode(unit,&data)) break; return(cd_play(unit,args->blk,args->len)); @@ -876,10 +882,10 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag) struct cd_mode_data data; if(error = cd_get_mode(unit,&data,AUDIO_PAGE)) break; - data.page.audio.port[LEFT_PORT].channels = 15; - data.page.audio.port[RIGHT_PORT].channels = 15; - data.page.audio.port[2].channels = 15; - data.page.audio.port[3].channels = 15; + data.page.audio.port[LEFT_PORT].channels = LEFT_CHANNEL; + data.page.audio.port[RIGHT_PORT].channels = LEFT_CHANNEL; + data.page.audio.port[2].channels = 0; + data.page.audio.port[3].channels = 0; if(error = cd_set_mode(unit,&data)) break; } @@ -1070,7 +1076,7 @@ int page; bzero(&scsi_cmd, sizeof(scsi_cmd)); bzero(data,sizeof(*data)); scsi_cmd.op_code = MODE_SENSE; - scsi_cmd.page_code = page; + scsi_cmd.page = page; scsi_cmd.length = sizeof(*data) & 0xff; retval = cd_scsi_cmd(unit, &scsi_cmd, @@ -1092,7 +1098,7 @@ struct cd_mode_data *data; bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = MODE_SELECT; - scsi_cmd.pf = 1; + scsi_cmd.byte2 |= SMS_PF; scsi_cmd.length = sizeof(*data) & 0xff; data->header.data_length = 0; /*show_mem(data,sizeof(*data));/**/ @@ -1224,8 +1230,8 @@ cd_start_unit(unit,part,type) bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = START_STOP; - scsi_cmd.start = type==CD_START?1:0; - scsi_cmd.loej = type==CD_EJECT?1:0; + scsi_cmd.how |= (type==CD_START)?SSS_START:0; + scsi_cmd.how |= (type==CD_EJECT)?SSS_LOEJ:0; if (cd_scsi_cmd(unit, &scsi_cmd, @@ -1249,7 +1255,7 @@ int unit,type,flags; if(type==CD_EJECT || type==PR_PREVENT || cd_data[unit].openparts == 0 ) { bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = PREVENT_ALLOW; - scsi_cmd.prevent=type==CD_EJECT?PR_ALLOW:type; + scsi_cmd.how = (type==CD_EJECT)?PR_ALLOW:type; if (cd_scsi_cmd(unit, &scsi_cmd, sizeof(struct scsi_prevent), @@ -1281,8 +1287,8 @@ struct cd_sub_channel_info *data; scsi_cmd.op_code=READ_SUBCHANNEL; if(mode==CD_MSF_FORMAT) - scsi_cmd.msf=1; - scsi_cmd.subQ=1; + scsi_cmd.byte2 |= CD_MSF; + scsi_cmd.byte3=SRS_SUBQ; scsi_cmd.subchan_format=format; scsi_cmd.track=track; scsi_cmd.data_len[0]=(len)>>8; @@ -1315,7 +1321,7 @@ struct cd_toc_entry *data; scsi_cmd.op_code=READ_TOC; if(mode==CD_MSF_FORMAT) - scsi_cmd.msf=1; + scsi_cmd.byte2 |= CD_MSF; scsi_cmd.from_track=start; scsi_cmd.data_len[0]=(ntoc)>>8; scsi_cmd.data_len[1]=(ntoc)&0xff; @@ -1521,11 +1527,11 @@ struct scsi_xfer *xs; silent = (xs->flags & SCSI_SILENT); sense = &(xs->sense); - switch(sense->error_class) + switch(sense->error_code & SSD_ERRCODE) { - case 7: + case 0x70: { - key=sense->ext.extended.sense_key; + key=sense->ext.extended.flags & SSD_KEY; switch(key) { case 0x0: @@ -1534,7 +1540,7 @@ struct scsi_xfer *xs; if(!silent) { printf("cd%d: soft error(corrected) ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)", (sense->ext.extended.info[0] <<24)| @@ -1553,7 +1559,7 @@ struct scsi_xfer *xs; if(!silent) { printf("cd%d: medium error ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)", (sense->ext.extended.info[0] <<24)| @@ -1585,7 +1591,7 @@ struct scsi_xfer *xs; { printf("cd%d: attempted protection violation ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1601,7 +1607,7 @@ struct scsi_xfer *xs; { printf("cd%d: block wrong state (worm)\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1629,7 +1635,7 @@ struct scsi_xfer *xs; { printf("cd%d: search returned\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1649,7 +1655,7 @@ struct scsi_xfer *xs; { printf("cd%d: verify miscompare\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1667,19 +1673,12 @@ struct scsi_xfer *xs; } break; } - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: + default: { - if(!silent)printf("cd%d: error class %d code %d\n", + if(!silent)printf("cd%d: error code %d\n", unit, - sense->error_class, - sense->error_code); - if(sense->valid) + sense->error_code & SSD_ERRCODE); + if(sense->error_code & SSD_ERRCODE_VALID) if(!silent)printf("block no. %d (decimal)\n", (sense->ext.unextended.blockhi <<16) + (sense->ext.unextended.blockmed <<8) diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index 57a4749..ba7cdcd 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -1,5 +1,16 @@ +/* + */ /* - * Written by Julian Elischer (julian@tfs.com) + * HISTORY + * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system + * */ #include <sys/types.h> @@ -89,7 +100,7 @@ struct scsi_switch *scsi_switch; unit = next_ch_unit++; if( unit >= NCH) { - printf("Too many scsi changers..(%d > %d) reconfigure kernel",(unit + 1),NCH); + printf("Too many scsi changers..(%d > %d) reconfigure kernel\n",(unit + 1),NCH); return(0); } /*******************************************************\ @@ -359,7 +370,7 @@ char *data; bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = READ_ELEMENT_STATUS; - scsi_cmd.element_type_code=type; + scsi_cmd.byte2 = type; scsi_cmd.starting_element_addr[0]=(from>>8)&0xff; scsi_cmd.starting_element_addr[1]=from&0xff; scsi_cmd.number_of_elements[1]=1; @@ -518,8 +529,8 @@ int unit,flags; for(l=1;l>=0;l--) { bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = MODE_SENSE; - scsi_cmd.dbd = l; - scsi_cmd.page_code = 0x3f; /* All Pages */ + scsi_cmd.byte2 = SMS_DBD; + scsi_cmd.page = 0x3f; /* All Pages */ scsi_cmd.length = sizeof(scsi_sense); /*******************************************************\ * do the command, but we don't need the results * @@ -750,42 +761,41 @@ struct scsi_xfer *xs; * Get the sense fields and work out what CLASS * \***************************************************************/ sense = &(xs->sense); - switch(sense->error_class) + switch(sense->error_code & SSD_ERRCODE) { /***************************************************************\ * If it's class 7, use the extended stuff and interpret the key * \***************************************************************/ - case 7: + case 0x70: { - key=sense->ext.extended.sense_key; - if(sense->ext.extended.ili) + key=sense->ext.extended.flags & SSD_KEY; + if(sense->ext.extended.flags & SSD_ILI) if(!silent) { printf("length error "); } - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) xs->resid = ntohl(*((long *)sense->ext.extended.info)); if(xs->bp) { xs->bp->b_flags |= B_ERROR; return(ESUCCESS); } - if(sense->ext.extended.eom) + if(sense->ext.extended.flags & SSD_EOM) if(!silent) printf("end of medium "); - if(sense->ext.extended.filemark) + if(sense->ext.extended.flags & SSD_FILEMARK) if(!silent) printf("filemark "); if(ch_debug) { - printf("code%x class%x valid%x\n" - ,sense->error_code - ,sense->error_class - ,sense->valid); + printf("code%x valid%x\n" + ,sense->error_code & SSD_ERRCODE + ,sense->error_code & SSD_ERRCODE_VALID); printf("seg%x key%x ili%x eom%x fmark%x\n" ,sense->ext.extended.segment - ,sense->ext.extended.sense_key - ,sense->ext.extended.ili - ,sense->ext.extended.eom - ,sense->ext.extended.filemark); + ,sense->ext.extended.flags & SSD_KEY + ,sense->ext.extended.flags & SSD_ILI + ,sense->ext.extended.flags & SSD_EOM + ,sense->ext.extended.flags & SSD_FILEMARK); printf("info: %x %x %x %x followed by %d extra bytes\n" ,sense->ext.extended.info[0] ,sense->ext.extended.info[1] @@ -819,7 +829,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: soft error(corrected) ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -842,7 +852,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: medium error ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -881,7 +891,7 @@ struct scsi_xfer *xs; { printf("st%d: attempted protection violation " , unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -900,7 +910,7 @@ struct scsi_xfer *xs; { printf("st%d: block wrong state (worm)\n " , unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -932,7 +942,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: search returned\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -954,7 +964,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: verify miscompare\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -978,19 +988,12 @@ struct scsi_xfer *xs; /***************************************************************\ * If it's NOT class 7, just report it. * \***************************************************************/ - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: + default: { - if(!silent) printf("st%d: error class %d code %d\n", + if(!silent) printf("st%d: error code %d\n", unit, - sense->error_class, - sense->error_code); - if(sense->valid) + sense->error_code & SSD_ERRCODE); + if(sense->error_code & SSD_ERRCODE_VALID) if(!silent) printf("block no. %d (decimal)\n", (sense->ext.unextended.blockhi <<16), + (sense->ext.unextended.blockmed <<8), diff --git a/sys/scsi/scsi_all.h b/sys/scsi/scsi_all.h index 3d9a829..2a1b6a6 100644 --- a/sys/scsi/scsi_all.h +++ b/sys/scsi/scsi_all.h @@ -1,15 +1,31 @@ /* * HISTORY * $Log: scsi_all.h,v $ - * Revision 1.1.1.1 1993/06/12 14:57:27 rgrimes - * Initial import, 0.1 + pk 0.2.4-B1 - * + * Revision 1.4 93/08/05 21:37:37 julian + * fix the definitionof the last byte of each scsi command. + * + * Revision 1.3 93/08/01 02:39:21 julian + * compiles.. no mode bitfields + * + * Revision 1.2 93/07/31 22:52:26 julian + * removed all bitfields + * + * Revision 1.1 93/04/12 21:51:01 root + * checkin for 'jules' + * * Revision 1.2 1992/11/20 23:07:13 julian * add a definition for device type T_NODEVICE * * Revision 1.1 1992/09/26 22:14:02 julian * Initial revision * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system * */ @@ -42,6 +58,15 @@ * SCSI command format */ +/* + * Define dome bits that are in ALL (or a lot of) scsi commands + */ +#define SCSI_CTL_LINK 0x01 +#define SCSI_CTL_FLAG 0x02 +#define SCSI_CTL_VENDOR 0xC0 +#define SCSI_CMD_LUN 0xA0 /*these two should not be needed*/ +#define SCSI_CMD_LUN_SHIFT 5 /* LUN in the cmd is no longer SCSI */ + struct scsi_generic { @@ -52,152 +77,117 @@ struct scsi_generic struct scsi_test_unit_ready { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[3]; - u_char link:1; - u_char flag:4; - u_char :3; + u_char control; }; struct scsi_send_diag { u_char op_code; - u_char uol:1; - u_char dol:1; - u_char selftest:1; - u_char :1; - u_char pf:1; - u_char lun:3; + u_char byte2; +#define SSD_UOL 0x01 +#define SSD_DOL 0x02 +#define SSD_SELFTEST 0x04 +#define SSD_PF 0x10 u_char unused[1]; u_char paramlen[2]; - u_char link:1; - u_char flag:4; - u_char :3; + u_char control; }; struct scsi_sense { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_inquiry { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_mode_sense { u_char op_code; - u_char :3; - u_char dbd:1; - u_char rsvd:1; - u_char lun:3; - u_char page_code:6; - u_char page_ctrl:2; + u_char byte2; +#define SMS_DBD 0x08 + u_char page; +#define SMS_PAGE_CODE 0x3F +#define SMS_PAGE_CTRL 0xC0 +#define SMS_PAGE_CTRL_CURRENT 0x00 +#define SMS_PAGE_CTRL_CHANGEABLE 0x40 +#define SMS_PAGE_CTRL_DEFAULT 0x80 +#define SMS_PAGE_CTRL_SAVED 0xC0 u_char unused; u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_mode_sense_big { u_char op_code; - u_char :3; - u_char dbd:1; - u_char rsvd:1; - u_char lun:3; - u_char page_code:6; - u_char page_ctrl:2; + u_char byte2; /* same bits as small version */ + u_char page; /* same bits as small version */ u_char unused[4]; u_char length[2]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_mode_select { u_char op_code; - u_char sp:1; - u_char :3; - u_char pf:1; - u_char lun:3; + u_char byte2; +#define SMS_SP 0x01 +#define SMS_PF 0x10 u_char unused[2]; u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_mode_select_big { u_char op_code; - u_char sp:1; - u_char :3; - u_char pf:1; - u_char lun:3; + u_char byte2; /* same bits as small version */ u_char unused[5]; u_char length[2]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_reserve { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_release { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_prevent { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; - u_char prevent:1; - u_char :7; - u_char link:1; - u_char flag:1; - u_char :6; + u_char how; + u_char control; }; -#define PR_PREVENT 1 -#define PR_ALLOW 0 +#define PR_PREVENT 0x01 +#define PR_ALLOW 0x00 /* * Opcodes @@ -240,19 +230,31 @@ struct scsi_prevent struct scsi_inquiry_data { - u_char device_type:5; - u_char device_qualifier:3; - u_char dev_qual2:7; - u_char removable:1; - u_char ansii_version:3; - u_char :5; + u_char device; +#define SID_TYPE 0x1F +#define SID_QUAL 0xE0 +#define SID_QUAL_LU_OK 0x00 +#define SID_QUAL_LU_OFFLINE 0x20 +#define SID_QUAL_RSVD 0x40 +#define SID_QUAL_BAD_LU 0x60 + u_char dev_qual2; +#define SID_QUAL2 0x7F +#define SID_REMOVABLE 0x80 + u_char version; +#define SID_ANSII 0x07 +#define SID_ECMA 0x38 +#define SID_ISO 0xC0 u_char response_format; u_char additional_length; u_char unused[2]; - u_char :3; - u_char can_link:1; - u_char can_sync:1; - u_char :3; + u_char flags; +#define SID_SftRe 0x01 +#define SID_CmdQue 0x02 +#define SID_Linked 0x08 +#define SID_Sync 0x10 +#define SID_WBus16 0x20 +#define SID_WBus32 0x40 +#define SID_RelAdr 0x80 char vendor[8]; char product[16]; char revision[4]; @@ -262,37 +264,22 @@ struct scsi_inquiry_data struct scsi_sense_data { - u_char error_code:4; - u_char error_class:3; - u_char valid:1; + u_char error_code; /* same bits as new version */ union { struct { - u_char blockhi:5; - u_char vendor:3; + u_char blockhi; u_char blockmed; u_char blocklow; } unextended; struct { u_char segment; - u_char sense_key:4; - u_char :1; - u_char ili:1; - u_char eom:1; - u_char filemark:1; + u_char flags; /* same bits as new version */ u_char info[4]; u_char extra_len; /* allocate enough room to hold new stuff - u_char cmd_spec_info[4]; - u_char add_sense_code; - u_char add_sense_code_qual; - u_char fru; - u_char sense_key_spec_1:7; - u_char sksv:1; - u_char sense_key_spec_2; - u_char sense_key_spec_3; ( by increasing 16 to 26 below) */ u_char extra_bytes[26]; } extended; @@ -300,33 +287,33 @@ struct scsi_sense_data }; struct scsi_sense_data_new { - u_char error_code:7; - u_char valid:1; + u_char error_code; +#define SSD_ERRCODE 0x7F +#define SSD_ERRCODE_VALID 0x80 union { - struct + struct /* this is depreciated, the standard says "DON'T"*/ { - u_char blockhi:5; - u_char vendor:3; + u_char blockhi; u_char blockmed; u_char blocklow; } unextended; struct { u_char segment; - u_char sense_key:4; - u_char :1; - u_char ili:1; - u_char eom:1; - u_char filemark:1; + u_char flags; +#define SSD_KEY 0x0F +#define SSD_ILI 0x20 +#define SSD_EOM 0x40 +#define SSD_FILEMARK 0x80 u_char info[4]; u_char extra_len; u_char cmd_spec_info[4]; u_char add_sense_code; u_char add_sense_code_qual; u_char fru; - u_char sense_key_spec_1:7; - u_char sksv:1; + u_char sense_key_spec_1; +#define SSD_SCS_VALID 0x80 u_char sense_key_spec_2; u_char sense_key_spec_3; u_char extra_bytes[16]; diff --git a/sys/scsi/scsi_cd.h b/sys/scsi/scsi_cd.h index 6606889..b5758c8 100644 --- a/sys/scsi/scsi_cd.h +++ b/sys/scsi/scsi_cd.h @@ -12,6 +12,13 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system */ @@ -19,6 +26,11 @@ /* * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 */ +/* + * Define two bits always in the same place in byte 2 (flag byte) + */ +#define CD_RELADDR 0x01 +#define CD_MSF 0x02 /* * SCSI command format @@ -27,29 +39,22 @@ struct scsi_read_capacity_cd { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char addr_3; /* Most Significant */ u_char addr_2; u_char addr_1; u_char addr_0; /* Least Significant */ u_char unused[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_pause { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[6]; - u_char resume:1; - u_char :7; - u_char link:1; - u_char flag:1; - u_char :6; + u_char resume; + u_char control; }; #define PA_PAUSE 1 #define PA_RESUME 0 @@ -57,8 +62,7 @@ struct scsi_pause struct scsi_play_msf { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused; u_char start_m; u_char start_s; @@ -66,132 +70,96 @@ struct scsi_play_msf u_char end_m; u_char end_s; u_char end_f; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_play_track { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; u_char start_track; u_char start_index; u_char unused1; u_char end_track; u_char end_index; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_play { u_char op_code; - u_char reladdr:1; - u_char :4; - u_char lun:3; + u_char byte2; u_char blk_addr[4]; u_char unused; u_char xfer_len[2]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_play_big { u_char op_code; - u_char reladdr:1; - u_char :4; - u_char lun:3; + u_char byte2; /* same as above */ u_char blk_addr[4]; u_char xfer_len[4]; u_char unused; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_play_rel_big { u_char op_code; - u_char reladdr:1; - u_char :4; - u_char lun:3; + u_char byte2; /* same as above */ u_char blk_addr[4]; u_char xfer_len[4]; u_char track; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_read_header { u_char op_code; - u_char :1; - u_char msf:1; - u_char :3; - u_char lun:3; + u_char byte2; u_char blk_addr[4]; u_char unused; u_char data_len[2]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_read_subchannel { u_char op_code; - u_char :1; - u_char msf:1; - u_char :3; - u_char lun:3; - u_char :6; - u_char subQ:1; - u_char :1; + u_char byte2; + u_char byte3; +#define SRS_SUBQ 0x40 u_char subchan_format; u_char unused[2]; u_char track; u_char data_len[2]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_read_toc { u_char op_code; - u_char :1; - u_char msf:1; - u_char :3; - u_char lun:3; + u_char byte2; u_char unused[4]; u_char from_track; u_char data_len[2]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; ; struct scsi_read_cd_capacity { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char addr_3; /* Most Significant */ u_char addr_2; u_char addr_1; u_char addr_0; /* Least Significant */ u_char unused[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; /* @@ -211,26 +179,6 @@ struct scsi_read_cd_capacity #define PLAY_TRACK_REL_BIG 0xa9 /* cdrom play track/index mode */ -struct cd_inquiry_data /* in case there is some special info */ -{ - u_char device_type:5; - u_char device_qualifier:3; - u_char dev_qual2:7; - u_char removable:1; - u_char ansii_version:3; - u_char :5; - u_char response_format; - u_char additional_length; - u_char unused[2]; - u_char :3; - u_char can_link:1; - u_char can_sync:1; - u_char :3; - char vendor[8]; - char product[16]; - char revision[4]; - u_char extra[8]; -}; struct scsi_read_cd_cap_data { @@ -246,32 +194,31 @@ struct scsi_read_cd_cap_data union cd_pages { -#define AUDIO_PAGE 0x0e struct audio_page { - u_char page_code:6; - u_char :1; - u_char ps:1; + u_char page_code; +#define CD_PAGE_CODE 0x3F +#define AUDIO_PAGE 0x0e +#define CD_PAGE_PS 0x80 u_char param_len; - u_char :1; - u_char sotc:1; - u_char immed:1; - u_char :5; + u_char flags; +#define CD_PA_SOTC 0x02 +#define CD_PA_IMMED 0x04 u_char unused[2]; - u_char format_lba:4; - u_char :3; - u_char apr_valid:1; + u_char format_lba; +#define CD_PA_FORMAT_LBA 0x0F +#define CD_PA_APR_VALID 0x80 u_char lb_per_sec[2]; struct port_control { - u_char channels:4; + u_char channels; +#define CHANNEL 0x0F #define CHANNEL_0 1 #define CHANNEL_1 2 #define CHANNEL_2 4 #define CHANNEL_3 8 #define LEFT_CHANNEL CHANNEL_0 #define RIGHT_CHANNEL CHANNEL_1 - u_char :4; u_char volume; } port[4]; #define LEFT_PORT 0 diff --git a/sys/scsi/scsi_changer.h b/sys/scsi/scsi_changer.h index 16ca71f..172f9c3 100644 --- a/sys/scsi/scsi_changer.h +++ b/sys/scsi/scsi_changer.h @@ -1,4 +1,16 @@ /* + * HISTORY + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system + * + */ + +/* * SCSI changer interface description */ @@ -29,17 +41,15 @@ struct scsi_read_element_status { u_char op_code; - u_char element_type_code:4; - u_char voltag:1; - u_char lun:3; + u_char byte2; +#define SRES_ELEM_TYPE_CODE 0x0F +#define SRES_ELEM_VOLTAG 0x10 u_char starting_element_addr[2]; u_char number_of_elements[2]; u_char resv1; u_char allocation_length[3]; u_char resv2; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; #define RE_ALL_ELEMENTS 0 #define RE_MEDIUM_TRANSPORT_ELEMENT 1 @@ -50,32 +60,24 @@ struct scsi_read_element_status struct scsi_move_medium { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char transport_element_address[2]; u_char source_address[2]; u_char destination_address[2]; u_char rsvd[2]; - u_char invert:1; - u_char :7; - u_char link:1; - u_char flag:1; - u_char :6; + u_char invert; + u_char control; }; struct scsi_position_to_element { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char transport_element_address[2]; u_char source_address[2]; u_char rsvd[2]; - u_char invert:1; - u_char :7; - u_char link:1; - u_char flag:1; - u_char :6; + u_char invert; + u_char control; }; /* @@ -96,9 +98,9 @@ struct scsi_element_status_data struct element_status_page { u_char element_type_code; - u_char :5; - u_char avoltag:1; - u_char pvoltag:1; + u_char flags; +#define ESP_AVOLTAG 0x40 +#define ESP_PVOLTAG 0x80 u_char element_descriptor_length[2]; u_char rsvd; u_char byte_count_of_descriptor_data[3]; diff --git a/sys/scsi/scsi_disk.h b/sys/scsi/scsi_disk.h index 75f8150..38e53c5 100644 --- a/sys/scsi/scsi_disk.h +++ b/sys/scsi/scsi_disk.h @@ -1,16 +1,29 @@ - /* * HISTORY * $Log: scsi_disk.h,v $ - * Revision 1.1.1.1 1993/06/12 14:57:27 rgrimes - * Initial import, 0.1 + pk 0.2.4-B1 - * + * Revision 1.3 93/08/05 21:38:11 julian + * fix the definitionof the last byte of each scsi command. + * + * Revision 1.2 93/07/31 22:52:42 julian + * removed all bitfields + * + * Revision 1.1 93/04/12 21:51:04 root + * checkin for 'jules' + * * Revision 1.2 1992/10/13 03:14:21 julian * added the load-eject field in 'start/stop' for removable devices. * * Revision 1.1 1992/09/26 22:11:29 julian * Initial revision * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system + * */ /* @@ -73,73 +86,58 @@ struct scsi_reassign_blocks { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_rw { u_char op_code; - u_char addr_2:5; /* Most significant */ - u_char lun:3; + u_char addr_2; /* Most significant */ +#define SRW_TOPADDR 0x1F /* only 5 bits here */ u_char addr_1; u_char addr_0; /* least significant */ u_char length; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_rw_big { u_char op_code; - u_char rel_addr:1; - u_char :4; /* Most significant */ - u_char lun:3; - u_char addr_3; + u_char byte2; +#define SRWB_RELADDR 0x01 + u_char addr_3; /* Most significant */ u_char addr_2; u_char addr_1; u_char addr_0; /* least significant */ u_char reserved;; u_char length2; u_char length1; - u_char link:1; - u_char flag:1; - u_char :4; - u_char vendor:2; + u_char control; }; struct scsi_read_capacity { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char addr_3; /* Most Significant */ u_char addr_2; u_char addr_1; u_char addr_0; /* Least Significant */ u_char unused[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; }; struct scsi_start_stop { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[2]; - u_char start:1; - u_char loej:1; - u_char :6; - u_char link:1; - u_char flag:1; - u_char :6; + u_char how; +#define SSS_START 0x01 +#define SSS_LOEJ 0x02 + u_char control; }; @@ -190,8 +188,8 @@ struct scsi_reassign_blocks_data union disk_pages /* this is the structure copied from osf */ { struct page_disk_format { - u_char pg_code:6; /* page code (should be 3) */ - u_char :2; + u_char pg_code; /* page code (should be 3) */ +#define DISK_PGCODE 0x3F /* only 6 bits valid */ u_char pg_length; /* page length (should be 0x16) */ u_char trk_z_1; /* tracks per zone (MSB) */ u_char trk_z_0; /* tracks per zone (LSB) */ @@ -211,17 +209,16 @@ union disk_pages /* this is the structure copied from osf */ u_char trk_skew_0; /* track skew factor (LSB) */ u_char cyl_skew_1; /* cylinder skew (MSB) */ u_char cyl_skew_0; /* cylinder skew (LSB) */ - u_char reserved1:4; - u_char surf:1; - u_char rmb:1; - u_char hsec:1; - u_char ssec:1; + u_char flags; /* various */ +#define DISK_FMT_SURF 0x10 +#define DISK_FMT_RMB 0x20 +#define DISK_FMT_HSEC 0x40 +#define DISK_FMT_SSEC 0x80 u_char reserved2; u_char reserved3; } disk_format; struct page_rigid_geometry { - u_char pg_code:7; /* page code (should be 4) */ - u_char mbone:1; /* must be one */ + u_char pg_code; /* page code (should be 4) */ u_char pg_length; /* page length (should be 0x16) */ u_char ncyl_2; /* number of cylinders (MSB) */ u_char ncyl_1; /* number of cylinders */ diff --git a/sys/scsi/scsi_tape.h b/sys/scsi/scsi_tape.h index f4a26d7..e43aa83 100644 --- a/sys/scsi/scsi_tape.h +++ b/sys/scsi/scsi_tape.h @@ -1,13 +1,20 @@ /* * HISTORY * $Log: scsi_tape.h,v $ + * Revision 1.5 93/08/05 21:38:14 julian + * fix the definitionof the last byte of each scsi command. * - * julian - added some special stuff for some OLD scsi tapes (CIPHER - * ST150S) - * - * Revision 1.1.1.1 1993/06/12 14:57:27 rgrimes - * Initial import, 0.1 + pk 0.2.4-B1 - * + * Revision 1.4 93/08/01 02:39:40 julian + * compiles.. no mode bitfields + * + * Revision 1.3 93/07/31 23:05:40 root + * removed all bitfields + * + * Revision 1.2 93/05/10 23:57:23 root + * added some special stuff for some OLD scsi tapes (CIPHER ST150S) + * + * Revision 1.1 93/04/12 21:51:06 root + * checkin for 'jules' * * Revision 1.2 1993/01/26 18:39:08 julian * add the 'write protected' bit in the device status struct. @@ -15,6 +22,14 @@ * Revision 1.1 1992/09/26 22:10:21 julian * Initial revision * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system + * */ /* @@ -41,6 +56,10 @@ * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 */ + + + + /* * SCSI command format */ @@ -49,25 +68,19 @@ struct scsi_rw_tape { u_char op_code; - u_char fixed:1; - u_char :4; - u_char lun:3; + u_char byte2; +#define SRWT_FIXED 0x01 u_char len[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; } rw_tape; struct scsi_space { u_char op_code; - u_char code:2; - u_char :3; - u_char lun:3; + u_char byte2; +#define SS_CODE 0x03 u_char number[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; } space; #define SP_BLKS 0 #define SP_FILEMARKS 1 @@ -77,52 +90,40 @@ struct scsi_space struct scsi_write_filemarks { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char number[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; } write_filemarks; struct scsi_rewind { u_char op_code; - u_char immed:1; - u_char :4; - u_char lun:3; + u_char byte2; +#define SR_IMMED 0x01 u_char unused[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; } rewind; struct scsi_load { u_char op_code; - u_char immed:1; - u_char :4; - u_char lun:3; + u_char byte2; +#define SL_IMMED 0x01 u_char unused[2]; - u_char load:1; - u_char reten:1; - u_char :6; - u_char link:1; - u_char flag:1; - u_char :6; + u_char how; + u_char control; } load; #define LD_UNLOAD 0 #define LD_LOAD 1 +#define LD_RETEN 2 + struct scsi_blk_limits { u_char op_code; - u_char :5; - u_char lun:3; + u_char byte2; u_char unused[3]; - u_char link:1; - u_char flag:1; - u_char :6; + u_char control; } blk_limits; /* @@ -149,15 +150,13 @@ struct scsi_blk_limits_data u_char min_length_0; /* Least significant */ }; -struct scsi_mode_header_tape -{ - u_char data_length; /* Sense data length */ - u_char medium_type; - u_char speed:4; - u_char buf_mode:3; - u_char write_protected:1; - u_char blk_desc_len; -}; +/* defines for the device specific byte in the mode select/sense header */ +#define SMH_DSP_SPEED 0x0F +#define SMH_DSP_BUFF_MODE 0x70 +#define SMH_DSP_BUFF_MODE_OFF 0x00 +#define SMH_DSP_BUFF_MODE_ON 0x10 +#define SMH_DSP_BUFF_MODE_MLTI 0x20 +#define SMH_DSP_WRITE_PROT 0x80 /* A special for the CIPHER ST150S(old drive) */ struct blk_desc_cipher @@ -166,9 +165,9 @@ struct blk_desc_cipher u_char nblocks[3]; u_char reserved; u_char blklen[3]; - u_char sec:1; /* soft error count */ - u_char aui:1; /* autoload inhibit */ - u_char :6; + u_char other; +#define ST150_SEC 0x01 /* soft error count */ +#define SR150_AUI 0x02 /* autoload inhibit */ }; diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 264dc1b..04aec86 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -12,6 +12,13 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system */ /* @@ -19,11 +26,9 @@ */ /* - * $Log: - * 23 May 93 Rodney W. Grimes ADDED Pioneer DRM-600 cd changer - * - */ - +$Log: +* +*/ #include <sys/types.h> #include "st.h" #include "sd.h" @@ -131,8 +136,6 @@ knowndevs[] = { #if NCD > 0 { T_READONLY,T_REMOV,"SONY ","CD-ROM CDU-8012 " ,"3.1a",cdattach,"cd",SC_ONE_LU }, - { T_READONLY,T_REMOV,"PIONEER ","CD-ROM DRM-600 " - ,"any",cdattach,"cd",SC_MORE_LUS }, #endif NCD #if NBLL > 0 { T_PROCESSOR,T_FIXED,"AEG ","READER " @@ -174,7 +177,7 @@ struct scsi_switch *scsi_switch; #if SCSI_DELAY > 2 printf("waiting for scsi devices to settle\n"); #else SCSI_DELAY > 2 -#define SCSI_DELAY 15 +#define SCSI_DELAY 2 #endif SCSI_DELAY > 2 #else #define SCSI_DELAY 2 @@ -339,19 +342,10 @@ int *maybe_more; desc[12]); } - type = inqbuf.device_type; - qualifier = inqbuf.device_qualifier; - remov = inqbuf.removable; + type = inqbuf.device & SID_TYPE; + qualifier = inqbuf.device & SID_QUAL; + remov = inqbuf.dev_qual2 & SID_REMOVABLE; - /* Check for a non-existent unit. If the device is returning - * this much, then we must set the flag that has - * the searcher keep looking on other luns. - */ - if (qualifier == 3 && type == T_NODEVICE) - { - *maybe_more = 1; - return (struct scsidevs *)0; - } /* Any device qualifier that has * the top bit set (qualifier&4 != 0) is vendor specific and @@ -360,20 +354,31 @@ int *maybe_more; switch(qualifier) { - case 0: + case SID_QUAL_LU_OK: qtype=""; break; - case 1: + + case SID_QUAL_LU_OFFLINE: qtype=", Unit not Connected!"; break; - case 2: + + case SID_QUAL_RSVD: qtype=", Reserved Peripheral Qualifier!"; + *maybe_more = 1; + return (struct scsidevs *)0; break; - case 3: + + case SID_QUAL_BAD_LU: + /* + * Check for a non-existent unit. If the device is returning + * this much, then we must set the flag that has + * the searcher keep looking on other luns. + */ qtype=", The Target can't support this Unit!"; - break; + *maybe_more = 1; + return (struct scsidevs *)0; - default: + default: dtype="vendor specific"; qtype=""; *maybe_more = 1; @@ -381,48 +386,53 @@ int *maybe_more; } if (dtype == 0) + { switch(type) { - case T_DIRECT: - dtype="direct"; - break; - case T_SEQUENTIAL: - dtype="sequential"; - break; - case T_PRINTER: - dtype="printer"; - break; - case T_PROCESSOR: - dtype="processor"; - break; - case T_READONLY: - dtype="readonly"; - break; - case T_WORM: - dtype="worm"; - break; - case T_SCANNER: - dtype="scanner"; - break; - case T_OPTICAL: - dtype="optical"; - break; - case T_CHANGER: - dtype="changer"; - break; - case T_COMM: - dtype="communication"; - break; - default: - dtype="unknown"; - break; + case T_DIRECT: + dtype="direct"; + break; + case T_SEQUENTIAL: + dtype="sequential"; + break; + case T_PRINTER: + dtype="printer"; + break; + case T_PROCESSOR: + dtype="processor"; + break; + case T_READONLY: + dtype="readonly"; + break; + case T_WORM: + dtype="worm"; + break; + case T_SCANNER: + dtype="scanner"; + break; + case T_OPTICAL: + dtype="optical"; + break; + case T_CHANGER: + dtype="changer"; + break; + case T_COMM: + dtype="communication"; + break; + case T_NODEVICE: + *maybe_more = 1; + return (struct scsidevs *)0; + default: + dtype="unknown"; + break; } + } /***********************************************\ * Then if it's advanced enough, more detailed * * information * \***********************************************/ - if(inqbuf.ansii_version > 0) + if((inqbuf.version & SID_ANSII) > 0) { if ((len = inqbuf.additional_length + ( (char *)inqbuf.unused @@ -454,14 +464,14 @@ int *maybe_more; ,manu ,model ,version - ,inqbuf.ansii_version + ,inqbuf.version & SID_ANSII ); /***********************************************\ * Try make as good a match as possible with * * available sub drivers * \***********************************************/ bestmatch = (selectdev(unit,target,lu,&scsi_switch, - qualifier,type,remov,manu,model,version)); + qualifier,type,remov?T_REMOV:T_FIXED,manu,model,version)); if((bestmatch) && (bestmatch->flags & SC_MORE_LUS)) { *maybe_more = 1; @@ -486,7 +496,7 @@ char *manu,*model,*rev; struct scsidevs *bestmatch = (struct scsidevs *)0; struct scsidevs *thisentry = knowndevs; - type |= (qualifier << 5); + type |= qualifier; /* why? */ thisentry--; while( count++ < numents) @@ -605,9 +615,10 @@ retry: scsi_xfer.error=0; * correct response. * *( especially exabytes) * \*******************************************************/ - if(scsi_xfer.sense.error_class == 7 ) + if(((scsi_xfer.sense.error_code & SSD_ERRCODE) == 0x70 ) + ||((scsi_xfer.sense.error_code & SSD_ERRCODE) == 0x71 )) { - key = scsi_xfer.sense.ext.extended.sense_key ; + key = scsi_xfer.sense.ext.extended.flags & SSD_KEY ; switch(key) { case 2: /* not ready BUT PRESENT! */ @@ -690,8 +701,8 @@ retry: scsi_xfer.error=0; * correct response. * *( especially exabytes) * \*******************************************************/ - if((scsi_xfer.sense.error_class == 7 ) - && (scsi_xfer.sense.ext.extended.sense_key == 6)) + if(((scsi_xfer.sense.error_code & SSD_ERRCODE) == 0x70 ) + && ((scsi_xfer.sense.ext.extended.flags & SSD_KEY) == 6)) { /* it's changed so it's there */ spinwait(1000); { diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 6445788..c36efde 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -12,6 +12,13 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system + * */ /* diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index fda382b..af85d87 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -12,9 +12,16 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system + * */ -static char rev[] = "$Revision: 1.2 $"; +static char rev[] = "$Revision: 1.5 $"; /* * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 @@ -134,7 +141,7 @@ struct scsi_switch *scsi_switch; \*******************************************************/ if( unit >= NSD) { - printf("Too many scsi disks..(%d > %d) reconfigure kernel",(unit + 1),NSD); + printf("Too many scsi disks..(%d > %d) reconfigure kernel\n",(unit + 1),NSD); return(0); } /*******************************************************\ @@ -174,7 +181,7 @@ struct scsi_switch *scsi_switch; * request must specify this. * \*******************************************************/ sd_get_parms(unit, SCSI_NOSLEEP | SCSI_NOMASK); - printf("sd%d: %dMB, cyls %d, heads %d, secs %d, bytes/sec %d\n", + printf(" sd%d: %dMB, cyls %d, heads %d, secs %d, bytes/sec %d\n", unit, ( dp->cyls * dp->heads @@ -904,7 +911,7 @@ int unit,type,flags; bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = PREVENT_ALLOW; - scsi_cmd.prevent=type; + scsi_cmd.how=type; return (sd_scsi_cmd(unit, &scsi_cmd, sizeof(scsi_cmd), @@ -923,7 +930,7 @@ int unit,flags; bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = START_STOP; - scsi_cmd.start = 1; + scsi_cmd.how = SSS_START; return (sd_scsi_cmd(unit, &scsi_cmd, @@ -995,7 +1002,7 @@ int sd_get_parms(unit, flags) { bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = MODE_SENSE; - scsi_cmd.page_code = 3; + scsi_cmd.page = 3; scsi_cmd.length = 0x24; /*******************************************************\ * do the command, but we don't need the results * @@ -1032,7 +1039,7 @@ int sd_get_parms(unit, flags) \*******************************************************/ bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = MODE_SENSE; - scsi_cmd.page_code = 4; + scsi_cmd.page = 4; scsi_cmd.length = 0x20; /*******************************************************\ * If the command worked, use the results to fill out * @@ -1251,11 +1258,11 @@ struct scsi_xfer *xs; silent = (xs->flags & SCSI_SILENT); sense = &(xs->sense); - switch(sense->error_class) + switch(sense->error_code & SSD_ERRCODE) { - case 7: + case 0x70: { - key=sense->ext.extended.sense_key; + key=sense->ext.extended.flags & SSD_KEY; switch(key) { case 0x0: @@ -1264,7 +1271,7 @@ struct scsi_xfer *xs; if(!silent) { printf("sd%d: soft error(corrected) ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)", (sense->ext.extended.info[0] <<24)| @@ -1283,7 +1290,7 @@ struct scsi_xfer *xs; if(!silent) { printf("sd%d: medium error ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)", (sense->ext.extended.info[0] <<24)| @@ -1320,7 +1327,7 @@ struct scsi_xfer *xs; { printf("sd%d: attempted protection violation ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1336,7 +1343,7 @@ struct scsi_xfer *xs; { printf("sd%d: block wrong state (worm)\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1364,7 +1371,7 @@ struct scsi_xfer *xs; { printf("sd%d: search returned\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1384,7 +1391,7 @@ struct scsi_xfer *xs; { printf("sd%d: verify miscompare\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1402,19 +1409,12 @@ struct scsi_xfer *xs; } break; } - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: + default: { - if(!silent)printf("sd%d: error class %d code %d\n", + if(!silent)printf("sd%d: code %d\n", unit, - sense->error_class, - sense->error_code); - if(sense->valid) + sense->error_code & SSD_ERRCODE); + if(sense->error_code & SSD_ERRCODE_VALID) if(!silent)printf("block no. %d (decimal)\n", (sense->ext.unextended.blockhi <<16) + (sense->ext.unextended.blockmed <<8) @@ -1446,143 +1446,13 @@ sdsize(dev_t dev) return((int)sd->disklabel.d_partitions[part].p_size); } -#ifdef SCSIDUMP -#include <vm/vm.h> -/***********************************************************************\ -* dump all of physical memory into the partition specified, starting * -* at offset 'dumplo' into the partition. * -\***********************************************************************/ -static struct scsi_xfer sx; -#define MAXTRANSFER 8 /* 1 page at a time */ -int -sddump(dev_t dev) /* dump core after a system crash */ +sddump() { - register struct sd_data *sd; /* disk unit to do the IO */ - long num; /* number of sectors to write */ - int unit, part, sdc; - long blkoff, blknum, blkcnt; - long nblocks; - char *addr; - struct scsi_rw_big cmd; - extern int Maxmem; - static sddoingadump = 0 ; - extern caddr_t CADDR1; /* map the page we are about to write, here*/ - struct scsi_xfer *xs = &sx; - int retval; - - addr = (char *) 0; /* starting address */ - - /* toss any characters present prior to dump */ - while (sgetc(1)) - ; - - /* size of memory to dump */ - num = Maxmem; - unit = UNIT(dev); /* eventually support floppies? */ - part = PARTITION(dev); /* file system */ - /* check for acceptable drive number */ - if (unit >= NSD) return(ENXIO); /* 31 Jul 92*/ - - sd = sd_data+unit; - /* was it ever initialized etc. ? */ - if (!(sd->flags & SDINIT)) return (ENXIO); - if (sd->flags & SDVALID != SDVALID) return (ENXIO) ; - if (sd->flags & SDWRITEPROT) return (ENXIO); - - /* Convert to disk sectors */ - num = (u_long) num * NBPG / sd->disklabel.d_secsize; - - /* check if controller active */ - if (sddoingadump) return(EFAULT); - - nblocks = sd->disklabel.d_partitions[part].p_size; - blkoff = sd->disklabel.d_partitions[part].p_offset; + printf("sddump() -- not implemented\n"); + return(-1); +} - /* check transfer bounds against partition size */ - if ((dumplo < 0) || ((dumplo + num) > nblocks)) - return(EINVAL); - sddoingadump = 1 ; - blknum = dumplo + blkoff; - while (num > 0) - { - if (blkcnt > MAXTRANSFER) blkcnt = MAXTRANSFER; - pmap_enter( kernel_pmap, - CADDR1, - trunc_page(addr), - VM_PROT_READ, - TRUE); -#ifndef NOT_TRUSTED - /*******************************************************\ - * Fill out the scsi command * - \*******************************************************/ - bzero(&cmd, sizeof(cmd)); - cmd.op_code = WRITE_BIG; - cmd.addr_3 = (blknum & 0xff000000) >> 24; - cmd.addr_2 = (blknum & 0xff0000) >> 16; - cmd.addr_1 = (blknum & 0xff00) >> 8; - cmd.addr_0 = blknum & 0xff; - cmd.length2 = (blkcnt & 0xff00) >> 8; - cmd.length1 = (blkcnt & 0xff); - /*******************************************************\ - * Fill out the scsi_xfer structure * - * Note: we cannot sleep as we may be an interrupt * - \*******************************************************/ - bzero(xs, sizeof(sx)); - xs->flags |= SCSI_NOMASK|SCSI_NOSLEEP|INUSE; - xs->adapter = sd->ctlr; - xs->targ = sd->targ; - xs->lu = sd->lu; - xs->retries = SD_RETRIES; - xs->timeout = 10000;/* 10000 millisecs for a disk !*/ - xs->cmd = (struct scsi_generic *)&cmd; - xs->cmdlen = sizeof(cmd); - xs->resid = blkcnt * 512; - xs->when_done = 0; - xs->done_arg = unit; - xs->done_arg2 = (int)xs; - xs->error = XS_NOERROR; - xs->bp = 0; - xs->data = (u_char *)CADDR1; - xs->datalen = blkcnt * 512; - /*******************************************************\ - * Pass all this info to the scsi driver. * - \*******************************************************/ - retval = (*(sd->sc_sw->scsi_cmd))(xs); - switch(retval) - { - case SUCCESSFULLY_QUEUED: - case HAD_ERROR: - return(ENXIO); /* we said not to sleep! */ - case COMPLETE: - break; - default: - return(ENXIO); /* we said not to sleep! */ - } -#else NOT_TRUSTED - printf ("sd%d addr 0x%x, blk %d\n",unit,addr,blknum); -#endif - - if ((unsigned)addr % (1024*1024) == 0) printf("%d ", num/2048) ; - /* update block count */ - num -= MAXTRANSFER; - blknum += MAXTRANSFER ; - (int) addr += 512 * MAXTRANSFER; - - /* operator aborting dump? */ - if (sgetc(1)) - return(EINTR); - } - return(0); -} -#else /* No SCSIDUMP CODE */ -sddump() -{ - printf("\nsddump() -- not implemented\n"); - DELAY(100000000); /* 100 seconds */ - return(-1); -} -#endif diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 0fd40d4..5b9e8ea 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -12,6 +12,13 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00098 + * -------------------- ----- ---------------------- + * + * 16 Feb 93 Julian Elischer ADDED for SCSI system */ /* @@ -205,7 +212,7 @@ struct scsi_switch *scsi_switch; unit = next_st_unit++; if( unit >= NST) { - printf("Too many scsi tapes..(%d > %d) reconfigure kernel", + printf("Too many scsi tapes..(%d > %d) reconfigure kernel\n", (unit + 1),NST); return(0); } @@ -240,17 +247,17 @@ struct scsi_switch *scsi_switch; { if(st_test_ready(unit,SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT)) { - printf("st%d: tape present: %d blocks of %d bytes\n", + printf("\tst%d: tape present: %d blocks of %d bytes\n", unit, st->numblks, st->media_blksiz); } else { - printf("st%d: drive empty\n", unit); + printf("\tst%d: drive empty\n", unit); } } else { - printf("st%d: drive offline\n", unit); + printf("\tst%d: drive offline\n", unit); } /*******************************************************\ * Set up the bufs for this device * @@ -301,10 +308,10 @@ int unit; if (scsi_inquire(st->ctlr, st->targ, st->lu, st->sc_sw, &inqbuf, SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT) != COMPLETE) { - printf("st%d: couldn't get device type, using default\n", unit); + printf(" st%d: couldn't get device type, using default\n", unit); return; } - if(inqbuf.ansii_version == 0) + if((inqbuf.version & SID_ANSII) == 0) { /***********************************************\ * If not advanced enough, use default values * @@ -339,7 +346,7 @@ int unit; if ((strcmp(manu, finger->manu) == 0 ) && (strcmp(model2, finger->model) == 0 )) { - printf("st%d: %s is a known rogue\n", unit,finger->name); + printf(" st%d: %s is a known rogue\n", unit,finger->name); st->modes[0] = finger->modes[0]; st->modes[1] = finger->modes[1]; st->modes[2] = finger->modes[2]; @@ -872,7 +879,7 @@ trynext: \*******************************************************/ if(st->flags & ST_FIXEDBLOCKS) { - cmd.fixed = 1; + cmd.byte2 |= SRWT_FIXED; lto3b(bp->b_bcount/st->blksiz,cmd.len); } else @@ -1004,7 +1011,7 @@ struct scsi_xfer *xs; * again for more data... we have it all * * SO SET THE ERROR BIT! * * * - * UNDER MACH:(CMU) * + * UNDER MACH (CMU) and NetBSD: * * To indicate the same as above, we * * need only have a non 0 resid that is * * less than the b_bcount, but the * @@ -1026,6 +1033,7 @@ struct scsi_xfer *xs; * for EOM and resid == count for EOF). * * We will report the EOx NEXT time.. * \***************************************/ +/* how do I distinguish NetBSD? at present it's wrong for NetBsd */ #ifdef MACH /*osf and cmu varieties */ #ifdef OSF bp->b_flags |= B_ERROR; @@ -1139,7 +1147,7 @@ caddr_t arg; unsigned int opri; int errcode = 0; unsigned char unit; - int number,flags,ret; + int number,flags; struct st_data *st; /*******************************************************\ @@ -1166,7 +1174,6 @@ caddr_t arg; g->mt_dns_high = st->modes[HIGH_DSTY].density; g->mt_dns_medium = st->modes[MED_DSTY].density; g->mt_dns_low = st->modes[LOW_DSTY].density; - ret=TRUE; break; } @@ -1186,29 +1193,29 @@ caddr_t arg; switch ((short)(mt->mt_op)) { case MTWEOF: /* write an end-of-file record */ - ret = st_write_filemarks(unit,number,flags); + if(!st_write_filemarks(unit,number,flags)) errcode = EIO; st_data[unit].flags &= ~ST_WRITTEN; break; case MTFSF: /* forward space file */ - ret = st_space(unit,number,SP_FILEMARKS,flags); + if(!st_space(unit,number,SP_FILEMARKS,flags)) errcode = EIO; break; case MTBSF: /* backward space file */ - ret = st_space(unit,-number,SP_FILEMARKS,flags); + if(!st_space(unit,-number,SP_FILEMARKS,flags)) errcode = EIO; break; case MTFSR: /* forward space record */ - ret = st_space(unit,number,SP_BLKS,flags); + if(!st_space(unit,number,SP_BLKS,flags)) errcode = EIO; break; case MTBSR: /* backward space record */ - ret = st_space(unit,-number,SP_BLKS,flags); + if(!st_space(unit,-number,SP_BLKS,flags)) errcode = EIO; break; case MTREW: /* rewind */ - ret = st_rewind(unit,FALSE,flags); + if(!st_rewind(unit,FALSE,flags)) errcode = EIO; break; case MTOFFL: /* rewind and put the drive offline */ - if((ret = st_rewind(unit,FALSE,flags))) + if(st_rewind(unit,FALSE,flags)) { st_prevent(unit,PR_ALLOW,0); - ret = st_load(unit,LD_UNLOAD,flags); + st_load(unit,LD_UNLOAD,flags); } else { @@ -1218,14 +1225,13 @@ caddr_t arg; case MTNOP: /* no operation, sets status only */ case MTCACHE: /* enable controller cache */ case MTNOCACHE: /* disable controller cache */ - ret = TRUE;; break; case MTSETBSIZ: /* Set block size for device */ if (st->blkmin == st->blkmax) { /* This doesn't make sense for a */ /* real fixed block device */ - ret = FALSE; + errcode = EINVAL; } else { @@ -1238,14 +1244,13 @@ caddr_t arg; else { if (number < st->blkmin || number > st->blkmax) - { ret = FALSE; - ret = FALSE; + { + errcode = EINVAL; } else { st->blksiz = number; st->flags |= ST_FIXEDBLOCKS; - ret = TRUE; } } } @@ -1257,51 +1262,49 @@ caddr_t arg; case MTSETHDNSTY: /* Set high density defaults for device */ if (number < 0 || number > SCSI_2_MAX_DENSITY_CODE) { - ret = EINVAL; + errcode = EINVAL; } else { st->modes[HIGH_DSTY].density = number; - ret = TRUE; } break; case MTSETMDNSTY: /* Set medium density defaults for device */ if (number < 0 || number > SCSI_2_MAX_DENSITY_CODE) { - ret = EINVAL; + errcode = EINVAL; } else { st->modes[MED_DSTY].density = number; - ret = TRUE; } break; case MTSETLDNSTY: /* Set low density defaults for device */ if (number < 0 || number > SCSI_2_MAX_DENSITY_CODE) { - ret = FALSE; + errcode = EINVAL; } else { st->modes[LOW_DSTY].density = number; - ret = TRUE; } break; default: - return EINVAL; + errcode = EINVAL; } break; } case MTIOCIEOT: case MTIOCEEOT: - ret=TRUE; break; + default: + errcode = EINVAL; } - return(ret?ESUCCESS:EIO); + return errcode; } @@ -1427,13 +1430,13 @@ int unit,flags; struct scsi_mode_sense scsi_cmd; struct scsi_sense { - struct scsi_mode_header_tape header; + struct scsi_mode_header header; struct blk_desc blk_desc; }scsi_sense; struct scsi_sense_page_0 { - struct scsi_mode_header_tape header; + struct scsi_mode_header header; struct blk_desc blk_desc; unsigned char sense_data[PAGE_0_SENSE_DATA_SIZE]; /* Tandberg tape drives returns page 00 */ @@ -1499,9 +1502,11 @@ int unit,flags; unit, st->numblks, st->media_blksiz, - (((struct scsi_sense *)scsi_sense_ptr)->header.write_protected ? + ((((struct scsi_sense *)scsi_sense_ptr)->header.dev_spec + & SMH_DSP_WRITE_PROT) ? "protected" : "enabled"), - (((struct scsi_sense *)scsi_sense_ptr)->header.buf_mode ? + ((((struct scsi_sense *)scsi_sense_ptr)->header.dev_spec + & SMH_DSP_BUFF_MODE)? "" : "un") ); } @@ -1526,12 +1531,12 @@ int unit,flags,dsty_code; struct scsi_mode_select scsi_cmd; struct dat { - struct scsi_mode_header_tape header; + struct scsi_mode_header header; struct blk_desc blk_desc; }dat; struct dat_page_0 { - struct scsi_mode_header_tape header; + struct scsi_mode_header header; struct blk_desc blk_desc; unsigned char sense_data[PAGE_0_SENSE_DATA_SIZE]; }dat_page_0; @@ -1559,7 +1564,7 @@ int unit,flags,dsty_code; scsi_cmd.op_code = MODE_SELECT; scsi_cmd.length = dat_len; ((struct dat *)dat_ptr)->header.blk_desc_len = sizeof(struct blk_desc); - ((struct dat *)dat_ptr)->header.buf_mode = 1; + ((struct dat *)dat_ptr)->header.dev_spec |= SMH_DSP_BUFF_MODE_ON; ((struct dat *)dat_ptr)->blk_desc.density = dsty_code; if(st->flags & ST_FIXEDBLOCKS) { @@ -1603,7 +1608,7 @@ int unit,number,what,flags; st_data[unit].flags &= ~(ST_AT_FILEMARK | ST_AT_EOM); bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = SPACE; - scsi_cmd.code = what; + scsi_cmd.byte2 = what & SS_CODE; lto3b(number,scsi_cmd.number); if (st_scsi_cmd(unit, &scsi_cmd, @@ -1658,15 +1663,10 @@ int unit,type,flags; st_data[unit].flags &= ~(ST_AT_FILEMARK | ST_AT_EOM); bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = LOAD_UNLOAD; - scsi_cmd.load=type; + scsi_cmd.how=type; if (type == LD_LOAD) { - /*scsi_cmd.reten=TRUE;*/ - scsi_cmd.reten=FALSE; - } - else - { - scsi_cmd.reten=FALSE; + /*scsi_cmd.how |= LD_RETEN;*/ } if (st_scsi_cmd(unit, &scsi_cmd, @@ -1693,7 +1693,7 @@ int unit,type,flags; bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = PREVENT_ALLOW; - scsi_cmd.prevent=type; + scsi_cmd.how=type; if (st_scsi_cmd(unit, &scsi_cmd, sizeof(scsi_cmd), @@ -1720,7 +1720,7 @@ int unit,immed,flags; st_data[unit].flags &= ~(ST_AT_FILEMARK | ST_AT_EOM); bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = REWIND; - scsi_cmd.immed=immed; + scsi_cmd.byte2=immed?SR_IMMED:0?SR_IMMED:0; if (st_scsi_cmd(unit, &scsi_cmd, sizeof(scsi_cmd), @@ -1899,16 +1899,15 @@ struct scsi_xfer *xs; if(st_debug) { int count = 0; - printf("code%x class%x valid%x\n" - ,sense->error_code - ,sense->error_class - ,sense->valid); + printf("code%x valid%x\n" + ,sense->error_code & SSD_ERRCODE + ,sense->error_code & SSD_ERRCODE_VALID ? 1 : 0); printf("seg%x key%x ili%x eom%x fmark%x\n" ,sense->ext.extended.segment - ,sense->ext.extended.sense_key - ,sense->ext.extended.ili - ,sense->ext.extended.eom - ,sense->ext.extended.filemark); + ,sense->ext.extended.flags & SSD_KEY + ,sense->ext.extended.flags & SSD_ILI ? 1 : 0 + ,sense->ext.extended.flags & SSD_EOM ? 1 : 0 + ,sense->ext.extended.flags & SSD_FILEMARK ? 1 : 0); printf("info: %x %x %x %x followed by %d extra bytes\n" ,sense->ext.extended.info[0] ,sense->ext.extended.info[1] @@ -1922,26 +1921,26 @@ struct scsi_xfer *xs; } printf("\n"); } - switch(sense->error_class) + switch(sense->error_code & SSD_ERRCODE) { /***************************************************************\ * If it's class 7, use the extended stuff and interpret the key * \***************************************************************/ - case 7: + case 0x70: { - if(sense->ext.extended.eom) + if(sense->ext.extended.flags & SSD_EOM) { st_data[unit].flags |= ST_AT_EOM; } - if(sense->ext.extended.filemark) + if(sense->ext.extended.flags & SSD_FILEMARK) { st_data[unit].flags |= ST_AT_FILEMARK; } - if(sense->ext.extended.ili) + if(sense->ext.extended.flags & SSD_ILI) { - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { /*******************************\ * In all ili cases, note that * @@ -1970,18 +1969,18 @@ struct scsi_xfer *xs; } }/* there may be some other error. check the rest */ - key=sense->ext.extended.sense_key; + key=sense->ext.extended.flags & SSD_KEY; switch(key) { case 0x0: - if(!(sense->ext.extended.ili)) + if(!(sense->ext.extended.flags & SSD_ILI)) xs->resid = 0; /* XXX check this */ return(ESUCCESS); case 0x1: if(!silent) { printf("st%d: soft error(corrected) ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -1994,7 +1993,7 @@ struct scsi_xfer *xs; printf("\n"); } } - if(!(sense->ext.extended.ili)) + if(!(sense->ext.extended.flags & SSD_ILI)) xs->resid = 0; /* XXX check this */ return(ESUCCESS); case 0x2: @@ -2004,7 +2003,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: medium error ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -2038,7 +2037,7 @@ struct scsi_xfer *xs; { printf("st%d: attempted protection violation " , unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -2057,7 +2056,7 @@ struct scsi_xfer *xs; { printf("st%d: fixed block wrong size \n " , unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("requested size: %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -2087,7 +2086,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: search returned\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -2109,7 +2108,7 @@ struct scsi_xfer *xs; if(!silent) { printf("st%d: verify miscompare\n ", unit); - if(sense->valid) + if(sense->error_code & SSD_ERRCODE_VALID) { printf("block no. %d (decimal)\n", (sense->ext.extended.info[0] <<24)| @@ -2133,19 +2132,12 @@ struct scsi_xfer *xs; /***************************************************************\ * If it's NOT class 7, just report it. * \***************************************************************/ - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: + default: { - if(!silent) printf("st%d: error class %d code %d\n", + if(!silent) printf("st%d: error code %d\n", unit, - sense->error_class, - sense->error_code); - if(sense->valid) + sense->error_code & SSD_ERRCODE); + if(sense->error_code & SSD_ERRCODE_VALID) if(!silent) printf("block no. %d (decimal)\n", (sense->ext.unextended.blockhi <<16), + (sense->ext.unextended.blockmed <<8), |