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