Home | History | Annotate | Line # | Download | only in scsipi
scsi_disk.h revision 1.2
      1 /*
      2  * HISTORY
      3  * $Log: scsi_disk.h,v $
      4  * Revision 1.2  1993/04/12 08:19:32  deraadt
      5  * new scsi subsystem.
      6  * changes also in config/mkioconf.c
      7  * 	i386/isa/wd.c, fd.c, and all scsi drivers.
      8  *
      9  * Revision 1.1  1993/03/21  18:13:00  cgd
     10  * after 0.2.2 "stable" patches applied
     11  *
     12  * Revision 1.2  1992/10/13  03:14:21  julian
     13  * added the load-eject field in 'start/stop' for removable devices.
     14  *
     15  * Revision 1.1  1992/09/26  22:11:29  julian
     16  * Initial revision
     17  *
     18  *
     19  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
     20  * --------------------         -----   ----------------------
     21  * CURRENT PATCH LEVEL:         1       00098
     22  * --------------------         -----   ----------------------
     23  *
     24  * 16 Feb 93	Julian Elischer		ADDED for SCSI system
     25  *
     26  */
     27 
     28 /*
     29  * SCSI interface description
     30  */
     31 
     32 /*
     33  * Some lines of this file comes from a file of the name "scsi.h"
     34  * distributed by OSF as part of mach2.5,
     35  *  so the following disclaimer has been kept.
     36  *
     37  * Copyright 1990 by Open Software Foundation,
     38  * Grenoble, FRANCE
     39  *
     40  * 		All Rights Reserved
     41  *
     42  *   Permission to use, copy, modify, and distribute this software and
     43  * its documentation for any purpose and without fee is hereby granted,
     44  * provided that the above copyright notice appears in all copies and
     45  * that both the copyright notice and this permission notice appear in
     46  * supporting documentation, and that the name of OSF or Open Software
     47  * Foundation not be used in advertising or publicity pertaining to
     48  * distribution of the software without specific, written prior
     49  * permission.
     50  *
     51  *   OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
     52  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
     53  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
     54  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     55  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
     56  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
     57  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     58  */
     59 
     60 /*
     61  * Largely written by Julian Elischer (julian (at) tfs.com)
     62  * for TRW Financial Systems.
     63  *
     64  * TRW Financial Systems, in accordance with their agreement with Carnegie
     65  * Mellon University, makes this software available to CMU to distribute
     66  * or use in any manner that they see fit as long as this message is kept with
     67  * the software. For this reason TFS also grants any other persons or
     68  * organisations permission to use or modify this software.
     69  *
     70  * TFS supplies this software to be publicly redistributed
     71  * on the understanding that TFS is not responsible for the correct
     72  * functioning of this software in any circumstances.
     73  *
     74  */
     75 
     76 /*
     77  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     78  */
     79 
     80 /*
     81  * SCSI command format
     82  */
     83 
     84 
     85 struct scsi_reassign_blocks
     86 {
     87 	u_char	op_code;
     88 	u_char	:5;
     89 	u_char	lun:3;
     90 	u_char	unused[3];
     91 	u_char	link:1;
     92 	u_char	flag:1;
     93 	u_char	:6;
     94 };
     95 
     96 struct scsi_rw
     97 {
     98 	u_char	op_code;
     99 	u_char	addr_2:5;	/* Most significant */
    100 	u_char	lun:3;
    101 	u_char	addr_1;
    102 	u_char	addr_0;		/* least significant */
    103 	u_char	length;
    104 	u_char	link:1;
    105 	u_char	flag:1;
    106 	u_char	:6;
    107 };
    108 
    109 struct scsi_rw_big
    110 {
    111 	u_char	op_code;
    112 	u_char	rel_addr:1;
    113 	u_char	:4;	/* Most significant */
    114 	u_char	lun:3;
    115 	u_char	addr_3;
    116 	u_char	addr_2;
    117 	u_char	addr_1;
    118 	u_char	addr_0;		/* least significant */
    119 	u_char	reserved;;
    120 	u_char	length2;
    121 	u_char	length1;
    122 	u_char	link:1;
    123 	u_char	flag:1;
    124 	u_char	:4;
    125 	u_char	vendor:2;
    126 };
    127 
    128 struct scsi_read_capacity
    129 {
    130 	u_char	op_code;
    131 	u_char	:5;
    132 	u_char	lun:3;
    133 	u_char	addr_3;	/* Most Significant */
    134 	u_char	addr_2;
    135 	u_char	addr_1;
    136 	u_char	addr_0;	/* Least Significant */
    137 	u_char	unused[3];
    138 	u_char	link:1;
    139 	u_char	flag:1;
    140 	u_char	:6;
    141 };
    142 
    143 struct scsi_start_stop
    144 {
    145 	u_char	op_code;
    146 	u_char	:5;
    147 	u_char	lun:3;
    148 	u_char	unused[2];
    149 	u_char	start:1;
    150 	u_char	loej:1;
    151 	u_char	:6;
    152 	u_char	link:1;
    153 	u_char	flag:1;
    154 	u_char	:6;
    155 };
    156 
    157 
    158 
    159 /*
    160  * Opcodes
    161  */
    162 
    163 #define FORMAT_DISK		0x04
    164 #define	REASSIGN_BLOCKS		0x07
    165 #define	READ_COMMAND		0x08
    166 #define WRITE_COMMAND		0x0a
    167 #define MODE_SELECT		0x15
    168 #define MODE_SENSE		0x1a
    169 #define START_STOP		0x1b
    170 #define PREVENT_ALLOW		0x1e
    171 #define	READ_CAPACITY		0x25
    172 #define	READ_BIG		0x28
    173 #define WRITE_BIG		0x2a
    174 
    175 
    176 struct scsi_format_parms {			/* physical BFI format */
    177 	u_short reserved;
    178 	u_short list_len;
    179 	struct defect {
    180 		unsigned cyl  : 24;
    181 		unsigned head : 8;
    182 		long    bytes_from_index;
    183 	} defect[127];
    184 } format_parms;
    185 
    186 
    187 struct scsi_read_cap_data
    188 {
    189 	u_char	addr_3;	/* Most significant */
    190 	u_char	addr_2;
    191 	u_char	addr_1;
    192 	u_char	addr_0;	/* Least significant */
    193 	u_char	length_3;	/* Most significant */
    194 	u_char	length_2;
    195 	u_char	length_1;
    196 	u_char	length_0;	/* Least significant */
    197 };
    198 
    199 struct scsi_reassign_blocks_data
    200 {
    201 	u_char	reserved[2];
    202 	u_char	length_msb;
    203 	u_char	length_lsb;
    204 	struct
    205 	{
    206 		u_char	dlbaddr_3;	/* defect logical block address (MSB) */
    207 		u_char	dlbaddr_2;
    208 		u_char	dlbaddr_1;
    209 		u_char	dlbaddr_0;	/* defect logical block address (LSB) */
    210 	} defect_descriptor[1];
    211 };
    212 
    213 union	disk_pages /* this is the structure copied from osf */
    214 {
    215 	struct page_disk_format {
    216 	   u_char pg_code:6;	/* page code (should be 3)	      */
    217 	   u_char :2;
    218 	   u_char pg_length;	/* page length (should be 0x16)	      */
    219 	   u_char trk_z_1;	/* tracks per zone (MSB)	      */
    220 	   u_char trk_z_0;	/* tracks per zone (LSB)	      */
    221 	   u_char alt_sec_1;	/* alternate sectors per zone (MSB)   */
    222 	   u_char alt_sec_0;	/* alternate sectors per zone (LSB)   */
    223 	   u_char alt_trk_z_1;	/* alternate tracks per zone (MSB)    */
    224 	   u_char alt_trk_z_0;	/* alternate tracks per zone (LSB)    */
    225 	   u_char alt_trk_v_1;	/* alternate tracks per volume (MSB)  */
    226 	   u_char alt_trk_v_0;	/* alternate tracks per volume (LSB)  */
    227 	   u_char ph_sec_t_1;	/* physical sectors per track (MSB)   */
    228 	   u_char ph_sec_t_0;	/* physical sectors per track (LSB)   */
    229 	   u_char bytes_s_1;	/* bytes per sector (MSB)	      */
    230 	   u_char bytes_s_0;	/* bytes per sector (LSB)	      */
    231 	   u_char interleave_1;/* interleave (MSB)		      */
    232 	   u_char interleave_0;/* interleave (LSB)		      */
    233 	   u_char trk_skew_1;	/* track skew factor (MSB)	      */
    234 	   u_char trk_skew_0;	/* track skew factor (LSB)	      */
    235 	   u_char cyl_skew_1;	/* cylinder skew (MSB)		      */
    236 	   u_char cyl_skew_0;	/* cylinder skew (LSB)		      */
    237 	   u_char reserved1:4;
    238 	   u_char surf:1;
    239 	   u_char rmb:1;
    240 	   u_char hsec:1;
    241 	   u_char ssec:1;
    242 	   u_char reserved2;
    243 	   u_char reserved3;
    244 	} disk_format;
    245 	struct page_rigid_geometry {
    246 	   u_char pg_code:7;	/* page code (should be 4)	      */
    247 	   u_char mbone:1;	/* must be one			      */
    248 	   u_char pg_length;	/* page length (should be 0x16)	      */
    249 	   u_char ncyl_2;	/* number of cylinders (MSB)	      */
    250 	   u_char ncyl_1;	/* number of cylinders 		      */
    251 	   u_char ncyl_0;	/* number of cylinders (LSB)	      */
    252 	   u_char nheads;	/* number of heads 		      */
    253 	   u_char st_cyl_wp_2;	/* starting cyl., write precomp (MSB) */
    254 	   u_char st_cyl_wp_1;	/* starting cyl., write precomp	      */
    255 	   u_char st_cyl_wp_0;	/* starting cyl., write precomp (LSB) */
    256 	   u_char st_cyl_rwc_2;/* starting cyl., red. write cur (MSB)*/
    257 	   u_char st_cyl_rwc_1;/* starting cyl., red. write cur      */
    258 	   u_char st_cyl_rwc_0;/* starting cyl., red. write cur (LSB)*/
    259 	   u_char driv_step_1;	/* drive step rate (MSB)	      */
    260 	   u_char driv_step_0;	/* drive step rate (LSB)	      */
    261 	   u_char land_zone_2;	/* landing zone cylinder (MSB)	      */
    262 	   u_char land_zone_1;	/* landing zone cylinder 	      */
    263 	   u_char land_zone_0;	/* landing zone cylinder (LSB)	      */
    264 	   u_char reserved1;
    265 	   u_char reserved2;
    266 	   u_char reserved3;
    267     	} rigid_geometry;
    268 } ;
    269