Home | History | Annotate | Line # | Download | only in scsipi
scsi_disk.h revision 1.9
      1  1.9  mycroft /*	$NetBSD: scsi_disk.h,v 1.9 1996/03/19 03:05:15 mycroft Exp $	*/
      2  1.5      cgd 
      3  1.1      cgd /*
      4  1.3      cgd  * SCSI interface description
      5  1.4  mycroft  */
      6  1.4  mycroft 
      7  1.4  mycroft /*
      8  1.4  mycroft  * Some lines of this file come from a file of the name "scsi.h"
      9  1.1      cgd  * distributed by OSF as part of mach2.5,
     10  1.1      cgd  *  so the following disclaimer has been kept.
     11  1.1      cgd  *
     12  1.1      cgd  * Copyright 1990 by Open Software Foundation,
     13  1.1      cgd  * Grenoble, FRANCE
     14  1.1      cgd  *
     15  1.1      cgd  * 		All Rights Reserved
     16  1.1      cgd  *
     17  1.1      cgd  *   Permission to use, copy, modify, and distribute this software and
     18  1.1      cgd  * its documentation for any purpose and without fee is hereby granted,
     19  1.1      cgd  * provided that the above copyright notice appears in all copies and
     20  1.1      cgd  * that both the copyright notice and this permission notice appear in
     21  1.1      cgd  * supporting documentation, and that the name of OSF or Open Software
     22  1.1      cgd  * Foundation not be used in advertising or publicity pertaining to
     23  1.1      cgd  * distribution of the software without specific, written prior
     24  1.1      cgd  * permission.
     25  1.1      cgd  *
     26  1.1      cgd  *   OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
     27  1.1      cgd  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
     28  1.1      cgd  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
     29  1.1      cgd  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     30  1.1      cgd  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
     31  1.1      cgd  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
     32  1.1      cgd  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     33  1.1      cgd  */
     34  1.1      cgd 
     35  1.1      cgd /*
     36  1.1      cgd  * Largely written by Julian Elischer (julian (at) tfs.com)
     37  1.1      cgd  * for TRW Financial Systems.
     38  1.1      cgd  *
     39  1.1      cgd  * TRW Financial Systems, in accordance with their agreement with Carnegie
     40  1.1      cgd  * Mellon University, makes this software available to CMU to distribute
     41  1.1      cgd  * or use in any manner that they see fit as long as this message is kept with
     42  1.1      cgd  * the software. For this reason TFS also grants any other persons or
     43  1.1      cgd  * organisations permission to use or modify this software.
     44  1.1      cgd  *
     45  1.1      cgd  * TFS supplies this software to be publicly redistributed
     46  1.1      cgd  * on the understanding that TFS is not responsible for the correct
     47  1.1      cgd  * functioning of this software in any circumstances.
     48  1.1      cgd  *
     49  1.1      cgd  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     50  1.1      cgd  */
     51  1.1      cgd 
     52  1.1      cgd /*
     53  1.1      cgd  * SCSI command format
     54  1.1      cgd  */
     55  1.1      cgd 
     56  1.4  mycroft #ifndef	_SCSI_SCSI_DISK_H
     57  1.4  mycroft #define _SCSI_SCSI_DISK_H 1
     58  1.1      cgd 
     59  1.7  mycroft struct scsi_reassign_blocks {
     60  1.9  mycroft 	u_int8_t opcode;
     61  1.9  mycroft 	u_int8_t byte2;
     62  1.9  mycroft 	u_int8_t unused[3];
     63  1.9  mycroft 	u_int8_t control;
     64  1.1      cgd };
     65  1.1      cgd 
     66  1.7  mycroft struct scsi_rw {
     67  1.9  mycroft 	u_int8_t opcode;
     68  1.9  mycroft 	u_int8_t addr[3];
     69  1.4  mycroft #define	SRW_TOPADDR	0x1F	/* only 5 bits here */
     70  1.9  mycroft 	u_int8_t length;
     71  1.9  mycroft 	u_int8_t control;
     72  1.1      cgd };
     73  1.1      cgd 
     74  1.7  mycroft struct scsi_rw_big {
     75  1.9  mycroft 	u_int8_t opcode;
     76  1.9  mycroft 	u_int8_t byte2;
     77  1.4  mycroft #define	SRWB_RELADDR	0x01
     78  1.9  mycroft 	u_int8_t addr[4];
     79  1.9  mycroft 	u_int8_t reserved;
     80  1.9  mycroft 	u_int8_t length[2];
     81  1.9  mycroft 	u_int8_t control;
     82  1.1      cgd };
     83  1.1      cgd 
     84  1.7  mycroft struct scsi_read_capacity {
     85  1.9  mycroft 	u_int8_t opcode;
     86  1.9  mycroft 	u_int8_t byte2;
     87  1.9  mycroft 	u_int8_t addr[4];
     88  1.9  mycroft 	u_int8_t unused[3];
     89  1.9  mycroft 	u_int8_t control;
     90  1.1      cgd };
     91  1.1      cgd 
     92  1.7  mycroft struct scsi_start_stop {
     93  1.9  mycroft 	u_int8_t opcode;
     94  1.9  mycroft 	u_int8_t byte2;
     95  1.9  mycroft 	u_int8_t unused[2];
     96  1.9  mycroft 	u_int8_t how;
     97  1.4  mycroft #define	SSS_STOP		0x00
     98  1.4  mycroft #define	SSS_START		0x01
     99  1.4  mycroft #define	SSS_LOEJ		0x02
    100  1.9  mycroft 	u_int8_t control;
    101  1.1      cgd };
    102  1.1      cgd 
    103  1.1      cgd 
    104  1.1      cgd 
    105  1.1      cgd /*
    106  1.1      cgd  * Opcodes
    107  1.1      cgd  */
    108  1.1      cgd 
    109  1.1      cgd #define	REASSIGN_BLOCKS		0x07
    110  1.1      cgd #define	READ_COMMAND		0x08
    111  1.1      cgd #define WRITE_COMMAND		0x0a
    112  1.1      cgd #define MODE_SELECT		0x15
    113  1.1      cgd #define MODE_SENSE		0x1a
    114  1.1      cgd #define START_STOP		0x1b
    115  1.1      cgd #define PREVENT_ALLOW		0x1e
    116  1.1      cgd #define	READ_CAPACITY		0x25
    117  1.1      cgd #define	READ_BIG		0x28
    118  1.1      cgd #define WRITE_BIG		0x2a
    119  1.1      cgd 
    120  1.1      cgd 
    121  1.7  mycroft struct scsi_read_cap_data {
    122  1.9  mycroft 	u_int8_t addr[4];
    123  1.9  mycroft 	u_int8_t length[4];
    124  1.1      cgd };
    125  1.1      cgd 
    126  1.7  mycroft struct scsi_reassign_blocks_data {
    127  1.9  mycroft 	u_int8_t reserved[2];
    128  1.9  mycroft 	u_int8_t length[2];
    129  1.7  mycroft 	struct {
    130  1.9  mycroft 		u_int8_t dlbaddr[4];
    131  1.1      cgd 	} defect_descriptor[1];
    132  1.1      cgd };
    133  1.1      cgd 
    134  1.9  mycroft union disk_pages {
    135  1.9  mycroft #define	DISK_PGCODE	0x3F	/* only 6 bits valid */
    136  1.1      cgd 	struct page_disk_format {
    137  1.9  mycroft 		u_int8_t pg_code;	/* page code (should be 3) */
    138  1.9  mycroft 		u_int8_t pg_length;	/* page length (should be 0x16) */
    139  1.9  mycroft 		u_int8_t trk_z[2];	/* tracks per zone */
    140  1.9  mycroft 		u_int8_t alt_sec[2];	/* alternate sectors per zone */
    141  1.9  mycroft 		u_int8_t alt_trk_z[2];	/* alternate tracks per zone */
    142  1.9  mycroft 		u_int8_t alt_trk_v[2];	/* alternate tracks per volume */
    143  1.9  mycroft 		u_int8_t ph_sec_t[2];	/* physical sectors per track */
    144  1.9  mycroft 		u_int8_t bytes_s[2];	/* bytes per sector */
    145  1.9  mycroft 		u_int8_t interleave[2];	/* interleave */
    146  1.9  mycroft 		u_int8_t trk_skew[2];	/* track skew factor */
    147  1.9  mycroft 		u_int8_t cyl_skew[2];	/* cylinder skew */
    148  1.9  mycroft 		u_int8_t flags;		/* various */
    149  1.9  mycroft #define	DISK_FMT_SURF	0x10
    150  1.9  mycroft #define	DISK_FMT_RMB	0x20
    151  1.9  mycroft #define	DISK_FMT_HSEC	0x40
    152  1.9  mycroft #define	DISK_FMT_SSEC	0x80
    153  1.9  mycroft 		u_int8_t reserved2;
    154  1.9  mycroft 		u_int8_t reserved3;
    155  1.1      cgd 	} disk_format;
    156  1.1      cgd 	struct page_rigid_geometry {
    157  1.9  mycroft 		u_int8_t pg_code;	/* page code (should be 4) */
    158  1.9  mycroft 		u_int8_t pg_length;	/* page length (should be 0x16)	*/
    159  1.9  mycroft 		u_int8_t ncyl[3];	/* number of cylinders */
    160  1.9  mycroft 		u_int8_t nheads;	/* number of heads */
    161  1.9  mycroft 		u_int8_t st_cyl_wp[3];	/* starting cyl., write precomp */
    162  1.9  mycroft 		u_int8_t st_cyl_rwc[3];	/* starting cyl., red. write cur */
    163  1.9  mycroft 		u_int8_t driv_step[2];	/* drive step rate */
    164  1.9  mycroft 		u_int8_t land_zone[3];	/* landing zone cylinder */
    165  1.9  mycroft 		u_int8_t sp_sync_ctl;	/* spindle synch control */
    166  1.8  thorpej #define SPINDLE_SYNCH_MASK	0x03	/* mask of valid bits */
    167  1.8  thorpej #define SPINDLE_SYNCH_NONE	0x00	/* synch disabled or not supported */
    168  1.8  thorpej #define SPINDLE_SYNCH_SLAVE	0x01	/* disk is a slave */
    169  1.8  thorpej #define SPINDLE_SYNCH_MASTER	0x02	/* disk is a master */
    170  1.8  thorpej #define SPINDLE_SYNCH_MCONTROL	0x03	/* disk is a master control */
    171  1.9  mycroft 		u_int8_t rot_offset;	/* rotational offset (for spindle synch) */
    172  1.9  mycroft 		u_int8_t reserved1;
    173  1.9  mycroft 		u_int8_t rpm[2];	/* media rotation speed */
    174  1.9  mycroft 		u_int8_t reserved2;
    175  1.9  mycroft 		u_int8_t reserved3;
    176  1.1      cgd     	} rigid_geometry;
    177  1.7  mycroft };
    178  1.7  mycroft 
    179  1.7  mycroft #endif /* _SCSI_SCSI_DISK_H */
    180