Home | History | Annotate | Line # | Download | only in scsipi
scsi_disk.h revision 1.3.3.1
      1 /*
      2  * SCSI interface description
      3  */
      4 
      5 /*
      6  * Some lines of this file come from a file of the name "scsi.h"
      7  * distributed by OSF as part of mach2.5,
      8  *  so the following disclaimer has been kept.
      9  *
     10  * Copyright 1990 by Open Software Foundation,
     11  * Grenoble, FRANCE
     12  *
     13  * 		All Rights Reserved
     14  *
     15  *   Permission to use, copy, modify, and distribute this software and
     16  * its documentation for any purpose and without fee is hereby granted,
     17  * provided that the above copyright notice appears in all copies and
     18  * that both the copyright notice and this permission notice appear in
     19  * supporting documentation, and that the name of OSF or Open Software
     20  * Foundation not be used in advertising or publicity pertaining to
     21  * distribution of the software without specific, written prior
     22  * permission.
     23  *
     24  *   OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
     25  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
     26  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
     27  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     28  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
     29  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
     30  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     31  */
     32 
     33 /*
     34  * Largely written by Julian Elischer (julian (at) tfs.com)
     35  * for TRW Financial Systems.
     36  *
     37  * TRW Financial Systems, in accordance with their agreement with Carnegie
     38  * Mellon University, makes this software available to CMU to distribute
     39  * or use in any manner that they see fit as long as this message is kept with
     40  * the software. For this reason TFS also grants any other persons or
     41  * organisations permission to use or modify this software.
     42  *
     43  * TFS supplies this software to be publicly redistributed
     44  * on the understanding that TFS is not responsible for the correct
     45  * functioning of this software in any circumstances.
     46  *
     47  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     48  *
     49  *	$Id: scsi_disk.h,v 1.3.3.1 1993/11/24 05:03:04 mycroft Exp $
     50  */
     51 
     52 /*
     53  * SCSI command format
     54  */
     55 
     56 #ifndef	_SCSI_SCSI_DISK_H
     57 #define _SCSI_SCSI_DISK_H 1
     58 
     59 struct scsi_reassign_blocks
     60 {
     61 	u_char	op_code;
     62 	u_char	byte2;
     63 	u_char	unused[3];
     64 	u_char	control;
     65 };
     66 
     67 struct scsi_rw
     68 {
     69 	u_char	op_code;
     70 	u_char	addr_2;		/* Most significant */
     71 #define	SRW_TOPADDR	0x1F	/* only 5 bits here */
     72 	u_char	addr_1;
     73 	u_char	addr_0;		/* least significant */
     74 	u_char	length;
     75 	u_char	control;
     76 };
     77 
     78 struct scsi_rw_big
     79 {
     80 	u_char	op_code;
     81 	u_char	byte2;
     82 #define	SRWB_RELADDR	0x01
     83 	u_char	addr_3;		/* Most significant */
     84 	u_char	addr_2;
     85 	u_char	addr_1;
     86 	u_char	addr_0;		/* least significant */
     87 	u_char	reserved;;
     88 	u_char	length2;
     89 	u_char	length1;
     90 	u_char	control;
     91 };
     92 
     93 struct scsi_read_capacity
     94 {
     95 	u_char	op_code;
     96 	u_char	byte2;
     97 	u_char	addr_3;	/* Most Significant */
     98 	u_char	addr_2;
     99 	u_char	addr_1;
    100 	u_char	addr_0;	/* Least Significant */
    101 	u_char	unused[3];
    102 	u_char	control;
    103 };
    104 
    105 struct scsi_start_stop
    106 {
    107 	u_char	op_code;
    108 	u_char	byte2;
    109 	u_char	unused[2];
    110 	u_char	how;
    111 #define	SSS_START		0x01
    112 #define	SSS_LOEJ		0x02
    113 	u_char	control;
    114 };
    115 
    116 
    117 
    118 /*
    119  * Opcodes
    120  */
    121 
    122 #define	REASSIGN_BLOCKS		0x07
    123 #define	READ_COMMAND		0x08
    124 #define WRITE_COMMAND		0x0a
    125 #define MODE_SELECT		0x15
    126 #define MODE_SENSE		0x1a
    127 #define START_STOP		0x1b
    128 #define PREVENT_ALLOW		0x1e
    129 #define	READ_CAPACITY		0x25
    130 #define	READ_BIG		0x28
    131 #define WRITE_BIG		0x2a
    132 
    133 
    134 
    135 struct scsi_read_cap_data
    136 {
    137 	u_char	addr_3;	/* Most significant */
    138 	u_char	addr_2;
    139 	u_char	addr_1;
    140 	u_char	addr_0;	/* Least significant */
    141 	u_char	length_3;	/* Most significant */
    142 	u_char	length_2;
    143 	u_char	length_1;
    144 	u_char	length_0;	/* Least significant */
    145 };
    146 
    147 struct scsi_reassign_blocks_data
    148 {
    149 	u_char	reserved[2];
    150 	u_char	length_msb;
    151 	u_char	length_lsb;
    152 	struct
    153 	{
    154 		u_char	dlbaddr_3;	/* defect logical block address (MSB) */
    155 		u_char	dlbaddr_2;
    156 		u_char	dlbaddr_1;
    157 		u_char	dlbaddr_0;	/* defect logical block address (LSB) */
    158 	} defect_descriptor[1];
    159 };
    160 
    161 union	disk_pages /* this is the structure copied from osf */
    162 {
    163 	struct page_disk_format {
    164 	   u_char pg_code;	/* page code (should be 3)	      */
    165 #define	DISK_PGCODE	0x3F	/* only 6 bits valid */
    166 	   u_char pg_length;	/* page length (should be 0x16)	      */
    167 	   u_char trk_z_1;	/* tracks per zone (MSB)	      */
    168 	   u_char trk_z_0;	/* tracks per zone (LSB)	      */
    169 	   u_char alt_sec_1;	/* alternate sectors per zone (MSB)   */
    170 	   u_char alt_sec_0;	/* alternate sectors per zone (LSB)   */
    171 	   u_char alt_trk_z_1;	/* alternate tracks per zone (MSB)    */
    172 	   u_char alt_trk_z_0;	/* alternate tracks per zone (LSB)    */
    173 	   u_char alt_trk_v_1;	/* alternate tracks per volume (MSB)  */
    174 	   u_char alt_trk_v_0;	/* alternate tracks per volume (LSB)  */
    175 	   u_char ph_sec_t_1;	/* physical sectors per track (MSB)   */
    176 	   u_char ph_sec_t_0;	/* physical sectors per track (LSB)   */
    177 	   u_char bytes_s_1;	/* bytes per sector (MSB)	      */
    178 	   u_char bytes_s_0;	/* bytes per sector (LSB)	      */
    179 	   u_char interleave_1;/* interleave (MSB)		      */
    180 	   u_char interleave_0;/* interleave (LSB)		      */
    181 	   u_char trk_skew_1;	/* track skew factor (MSB)	      */
    182 	   u_char trk_skew_0;	/* track skew factor (LSB)	      */
    183 	   u_char cyl_skew_1;	/* cylinder skew (MSB)		      */
    184 	   u_char cyl_skew_0;	/* cylinder skew (LSB)		      */
    185 	   u_char flags;	/* various */
    186 #define		DISK_FMT_SURF	0x10
    187 #define		DISK_FMT_RMB	0x20
    188 #define		DISK_FMT_HSEC	0x40
    189 #define		DISK_FMT_SSEC	0x80
    190 	   u_char reserved2;
    191 	   u_char reserved3;
    192 	} disk_format;
    193 	struct page_rigid_geometry {
    194 	   u_char pg_code;	/* page code (should be 4)	      */
    195 	   u_char pg_length;	/* page length (should be 0x16)	      */
    196 	   u_char ncyl_2;	/* number of cylinders (MSB)	      */
    197 	   u_char ncyl_1;	/* number of cylinders 		      */
    198 	   u_char ncyl_0;	/* number of cylinders (LSB)	      */
    199 	   u_char nheads;	/* number of heads 		      */
    200 	   u_char st_cyl_wp_2;	/* starting cyl., write precomp (MSB) */
    201 	   u_char st_cyl_wp_1;	/* starting cyl., write precomp	      */
    202 	   u_char st_cyl_wp_0;	/* starting cyl., write precomp (LSB) */
    203 	   u_char st_cyl_rwc_2;/* starting cyl., red. write cur (MSB)*/
    204 	   u_char st_cyl_rwc_1;/* starting cyl., red. write cur      */
    205 	   u_char st_cyl_rwc_0;/* starting cyl., red. write cur (LSB)*/
    206 	   u_char driv_step_1;	/* drive step rate (MSB)	      */
    207 	   u_char driv_step_0;	/* drive step rate (LSB)	      */
    208 	   u_char land_zone_2;	/* landing zone cylinder (MSB)	      */
    209 	   u_char land_zone_1;	/* landing zone cylinder 	      */
    210 	   u_char land_zone_0;	/* landing zone cylinder (LSB)	      */
    211 	   u_char reserved1;
    212 	   u_char reserved2;
    213 	   u_char reserved3;
    214     	} rigid_geometry;
    215 } ;
    216 #endif /* _SCSI_SCSI_DISK_H*/
    217