1*54876Storek /* 2*54876Storek * Copyright (c) 1992 The Regents of the University of California. 3*54876Storek * All rights reserved. 4*54876Storek * 5*54876Storek * This software was developed by the Computer Systems Engineering group 6*54876Storek * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7*54876Storek * contributed to Berkeley. 8*54876Storek * 9*54876Storek * %sccs.include.redist.c% 10*54876Storek * 11*54876Storek * @(#)disk.h 5.1 (Berkeley) 07/10/92 12*54876Storek * 13*54876Storek * from: $Header: disk.h,v 1.2 92/05/15 11:23:58 torek Exp $ (LBL) 14*54876Storek */ 15*54876Storek 16*54876Storek /* 17*54876Storek * SCSI definitions for Direct Access Devices (disks). 18*54876Storek * This includes WORMs and CD-ROMs (although a few commands, such as 19*54876Storek * format or write, are nonsensical on some). 20*54876Storek * 21*54876Storek * Commands defined in the common header (scsi.h) appear here as comments. 22*54876Storek */ 23*54876Storek 24*54876Storek /* group 0 */ 25*54876Storek /* CMD_TEST_UNIT_READY 0x00 test unit ready */ 26*54876Storek #define CMD_REZERO 0x01 /* rezero unit */ 27*54876Storek /* CMD_REQUEST_SENSE 0x03 /* request sense */ 28*54876Storek #define CMD_FORMAT_UNIT 0x04 /* format unit (disk) */ 29*54876Storek #define CMD_REASSIGN_BLOCKS 0x07 /* reassign blocks (disk, WORM) */ 30*54876Storek #define CMD_READ6 0x08 /* read (6 byte cdb) */ 31*54876Storek #define CMD_WRITE6 0x0a /* write (6 byte cdb) */ 32*54876Storek #define CMD_SEEK6 0x0b /* seek (6 byte cdb) */ 33*54876Storek /* CMD_INQUIRY 0x12 inquiry */ 34*54876Storek #define CMD_MODE_SELECT 0x15 /* mode select */ 35*54876Storek #define CMD_RESERVE 0x16 /* reserve */ 36*54876Storek #define CMD_RELEASE 0x17 /* release */ 37*54876Storek /* CMD_COPY 0x18 copy */ 38*54876Storek #define CMD_MODE_SENSE 0x1a /* mode sense */ 39*54876Storek #define CMD_SSU 0x1b /* start/stop unit */ 40*54876Storek /* CMD_RECEIVE_DIAG 0x1c receive diagnostic results */ 41*54876Storek /* CMD_SEND_DIAG 0x1d send diagnostic */ 42*54876Storek #define CMD_PAMR 0x1e /* prevent/allow medium removal */ 43*54876Storek 44*54876Storek /* group 1 */ 45*54876Storek #define CMD_READ_CAPACITY 0x25 /* read capacity */ 46*54876Storek #define CMD_READ10 0x28 /* read (10 byte cdb) */ 47*54876Storek #define CMD_WRITE10 0x2a /* write (10 byte cdb) */ 48*54876Storek #define CMD_SEEK10 0x2b /* write (10 byte cdb) */ 49*54876Storek #define CMD_WRITE_VERIFY 0x2e /* write and verify */ 50*54876Storek #define CMD_VERIFY 0x2f /* verify */ 51*54876Storek #define CMD_SEARCH_H 0x30 /* search data high */ 52*54876Storek #define CMD_SEARCH_E 0x31 /* search data equal */ 53*54876Storek #define CMD_SEARCH_L 0x32 /* search data low */ 54*54876Storek #define CMD_SET_LIMITS 0x33 /* set limits */ 55*54876Storek /* CMD_COMPARE 0x39 compare */ 56*54876Storek #define CMD_COPY_VERIFY 0x3a /* copy and verify */ 57*54876Storek 58*54876Storek /* this one is in van's but not in my 17B documents */ 59*54876Storek #define CMD_READ_DEFECT_DATA 0x37 /* read defect data */ /* ??? */ 60*54876Storek 61*54876Storek /* 62*54876Storek * Structure of a FORMAT UNIT command (i.e., the cdb): 63*54876Storek * byte 0: opcode<8> 64*54876Storek * byte 1: lun<3> format_data<1> complete_list<1> defect_list_format<3> 65*54876Storek * byte 2: vendor unique 66*54876Storek * byte 3: interleave (MSB) 67*54876Storek * byte 4: interleave (LSB) 68*54876Storek * byte 5: control 69*54876Storek */ 70*54876Storek struct scsi_cdb_fu { 71*54876Storek u_char cdb_cmd; /* SCSI_CMD_FU */ 72*54876Storek u_char cdb_lun_etc; /* lun+FD+CL+DLF */ 73*54876Storek u_char cdb_vu; /* vendor unique */ 74*54876Storek u_char cdb_ilvh; /* interleave (MSB) */ 75*54876Storek u_char cdb_ilvl; /* interleave (LSB) */ 76*54876Storek u_char cdb_ctrl; /* control byte */ 77*54876Storek }; 78*54876Storek 79*54876Storek /* 80*54876Storek * If format data are supplied, they give either additional (cl=0) or 81*54876Storek * new (cl=1) defect list in one of the following formats. 82*54876Storek * Formats 1, 2, and 3 are the same as 0; formats 6 and 7 are 83*54876Storek * vendor unique and reserved, respectively. (The `backwards' 84*54876Storek * in `backwards compatible'...) 85*54876Storek */ 86*54876Storek #define SCSI_DLF_BLOCK 0 /* dlf = blocks */ 87*54876Storek #define SCSI_DLF_BFI 4 /* dlf = bytes from index */ 88*54876Storek #define SCSI_DLF_PS 5 /* dlf = physical sectors */ 89*54876Storek 90*54876Storek /* 91*54876Storek * Defect list header, block format (`defect block address'). 92*54876Storek * 93*54876Storek * N.B.: this structure is also used for the Reassign Blocks command; 94*54876Storek * there the `defect block address' becomes a `defect logical block address'. 95*54876Storek */ 96*54876Storek struct scsi_dlf_dba { 97*54876Storek u_short dlf_xxx; /* reserved */ 98*54876Storek u_char dlf_lenh, /* defect list length (MSB) */ 99*54876Storek dlf_lenl; /* defect list length (LSB) */ 100*54876Storek struct scsi_dlf_dba_desc { 101*54876Storek u_char dbah, /* defect block address (MSB) */ 102*54876Storek dbahm, /* defect block address */ 103*54876Storek dbalm, /* defect block address */ 104*54876Storek dbal; /* defect block address (LSB) */ 105*54876Storek } dlf_dba[1]; /* actually longer */ 106*54876Storek }; 107*54876Storek 108*54876Storek /* 109*54876Storek * Defect list header, Bytes From Index format. 110*54876Storek */ 111*54876Storek struct scsi_dlf_bfi { 112*54876Storek u_short dlf_xxx; /* reserved */ 113*54876Storek u_char dlf_lenh, /* defect list length (MSB) */ 114*54876Storek dlf_lenl; /* defect list length (LSB) */ 115*54876Storek struct scsi_dlf_bfi_desc { 116*54876Storek u_char cylh, /* cylinder number of defect (MSB) */ 117*54876Storek cylm, /* cylinder number of defect */ 118*54876Storek cyll, /* cylinder number of defect (LSB) */ 119*54876Storek head, /* head number of defect */ 120*54876Storek bfih, /* defect bytes from index (MSB) */ 121*54876Storek bfihm, /* defect bytes from index */ 122*54876Storek bfilm, /* defect bytes from index */ 123*54876Storek bfil; /* defect bytes from index (LSB) */ 124*54876Storek } dlf_bfi[1]; /* actually longer */ 125*54876Storek }; 126*54876Storek 127*54876Storek /* 128*54876Storek * Defect list header, Physical Sector format. 129*54876Storek */ 130*54876Storek struct scsi_dlf_ps { 131*54876Storek u_short dlf_xxx; /* reserved */ 132*54876Storek u_char dlf_lenh, /* defect list length (MSB) */ 133*54876Storek dlf_lenl; /* defect list length (LSB) */ 134*54876Storek struct scsi_dlf_ps_desc { 135*54876Storek u_char cylh, /* cylinder number of defect (MSB) */ 136*54876Storek cylm, /* cylinder number of defect */ 137*54876Storek cyll, /* cylinder number of defect (LSB) */ 138*54876Storek head, /* head number of defect */ 139*54876Storek dsnh, /* defect sector number (MSB) */ 140*54876Storek dsnhm, /* defect sector number */ 141*54876Storek dsnlm, /* defect sector number */ 142*54876Storek dsnl; /* defect sector number (LSB) */ 143*54876Storek } dlf_ps[1]; /* actually longer */ 144*54876Storek }; 145*54876Storek 146*54876Storek /* 147*54876Storek * Structure of data passed via a MODE SELECT command. 148*54876Storek */ 149*54876Storek struct scsi_ms { 150*54876Storek u_char ms_xxx0, /* reserved */ 151*54876Storek ms_mt, /* medium type */ 152*54876Storek ms_xxx1, /* reserved */ 153*54876Storek ms_bdl; /* block descriptor length */ 154*54876Storek struct scsi_ms_b_desc { 155*54876Storek u_char dc, /* density code */ 156*54876Storek nbh, /* number of blocks (MSB) */ 157*54876Storek nbm, /* number of blocks */ 158*54876Storek nbl, /* number of blocks (LSB) */ 159*54876Storek xxx, /* reserved */ 160*54876Storek blh, /* block length (MSB) */ 161*54876Storek blm, /* block length */ 162*54876Storek bll; /* block length (LSB) */ 163*54876Storek } ms_bd[1]; /* actually longer */ 164*54876Storek /* followed by vendor unique bytes */ 165*54876Storek }; 166*54876Storek 167*54876Storek /* values for the Medium Type field - disks */ 168*54876Storek #define SCSI_CMD_MS_MT_DEFAULT 0x00 /* whatever is current */ 169*54876Storek #define SCSI_CMD_MS_MT_SS 0x01 /* single sided, unspecified medium */ 170*54876Storek #define SCSI_CMD_MS_MT_DS 0x02 /* double sided, unspecified medium */ 171*54876Storek #define SCSI_CMD_MS_MT_8SSSD 0x05 /* 8" floppy, SSSD (X3.73-1980) */ 172*54876Storek #define SCSI_CMD_MS_MT_8DSSD 0x06 /* 8" floppy, DSSD (X3B8-140) */ 173*54876Storek #define SCSI_CMD_MS_MT_8SSDD 0x09 /* 8" floppy, SSDD (X3B8/78-139) */ 174*54876Storek #define SCSI_CMD_MS_MT_8DSDD 0x0a /* 8" floppy, DSDD (X3.121-1984) */ 175*54876Storek #define SCSI_CMD_MS_MT_5SSSD 0x0d /* 5.25" floppy, SSSD (X3.82-1980) */ 176*54876Storek #define SCSI_CMD_MS_MT_5DSDD 0x12 /* 5.25" floppy, DSDD (X3.125-1984) */ 177*54876Storek #define SCSI_CMD_MS_MT_5DSDD96 0x16 /* 5.25", DSDD, 96tpi (X3.126-198X) */ 178*54876Storek #define SCSI_CMD_MS_MT_5DSQD 0x1a /* 5.25", DSQD, 96tpi (DIS 8630) */ 179*54876Storek #define SCSI_CMD_MS_MT_3DS 0x1e /* 3.5", double sided (X3.137-198X) */ 180*54876Storek 181*54876Storek /* values for the Medium Type field - tapes */ 182*54876Storek #define SCSI_CMD_MS_MT_QIC_12T 0x40 /* 0.25", 12 tracks */ 183*54876Storek #define SCSI_CMD_MS_MT_QIC_24T 0x44 /* 0.25", 24 tracks */ 184*54876Storek 185*54876Storek /* 186*54876Storek * Bits in cdb_lenl for a READ CAPACITY command, 187*54876Storek * and structure returned as data. 188*54876Storek * 189*54876Storek * If PMI is off, the lba in the cdb must be 0. 190*54876Storek */ 191*54876Storek #define SCSI_CMD_RC_PMI 0x01 /* Partial Medium Indicator */ 192*54876Storek 193*54876Storek struct scsi_rc { 194*54876Storek u_char rc_lbah; /* logical block address (MSB) */ 195*54876Storek u_char rc_lbahm; /* logical block address */ 196*54876Storek u_char rc_lbalm; /* logical block address */ 197*54876Storek u_char rc_lbal; /* logical block address (LSB) */ 198*54876Storek u_char rc_blh; /* block length (MSB) */ 199*54876Storek u_char rc_blhm; /* block length */ 200*54876Storek u_char rc_bllm; /* block length */ 201*54876Storek u_char rc_bll; /* block length (LSB) */ 202*54876Storek }; 203