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