Home | History | Annotate | Line # | Download | only in scsipi
scsi_all.h revision 1.22
      1  1.21  reinoud /*	$NetBSD: scsi_all.h,v 1.22 2005/02/01 00:19:34 reinoud Exp $	*/
      2   1.5      cgd 
      3   1.1      cgd /*
      4  1.16      wiz  * SCSI-specific interface description.
      5   1.3  mycroft  */
      6   1.3  mycroft 
      7   1.3  mycroft /*
      8   1.1      cgd  * Largely written by Julian Elischer (julian (at) tfs.com)
      9   1.1      cgd  * for TRW Financial Systems.
     10   1.1      cgd  *
     11   1.1      cgd  * TRW Financial Systems, in accordance with their agreement with Carnegie
     12   1.1      cgd  * Mellon University, makes this software available to CMU to distribute
     13  1.12    enami  * or use in any manner that they see fit as long as this message is kept with
     14   1.1      cgd  * the software. For this reason TFS also grants any other persons or
     15   1.1      cgd  * organisations permission to use or modify this software.
     16   1.1      cgd  *
     17   1.1      cgd  * TFS supplies this software to be publicly redistributed
     18   1.1      cgd  * on the understanding that TFS is not responsible for the correct
     19   1.1      cgd  * functioning of this software in any circumstances.
     20   1.1      cgd  *
     21   1.3  mycroft  * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992
     22   1.1      cgd  */
     23   1.1      cgd 
     24  1.19     matt #ifndef _DEV_SCSIPI_SCSI_ALL_H_
     25  1.19     matt #define _DEV_SCSIPI_SCSI_ALL_H_
     26  1.19     matt 
     27   1.1      cgd /*
     28   1.3  mycroft  * Define dome bits that are in ALL (or a lot of) scsi commands
     29   1.1      cgd  */
     30  1.12    enami #define	SCSI_CTL_LINK		0x01
     31  1.12    enami #define	SCSI_CTL_FLAG		0x02
     32  1.12    enami #define	SCSI_CTL_VENDOR		0xC0
     33   1.9  thorpej 
     34   1.9  thorpej 
     35   1.9  thorpej /*
     36   1.9  thorpej  * Some old SCSI devices need the LUN to be set in the top 3 bits of the
     37   1.9  thorpej  * second byte of the CDB.
     38   1.9  thorpej  */
     39   1.9  thorpej #define	SCSI_CMD_LUN_MASK	0xe0
     40   1.9  thorpej #define	SCSI_CMD_LUN_SHIFT	5
     41   1.1      cgd 
     42  1.11   bouyer /* XXX Is this a command ? What's its opcode ? */
     43   1.6  mycroft struct scsi_send_diag {
     44  1.22  reinoud 	u_int8_t opcode;
     45  1.22  reinoud 	u_int8_t byte2;
     46   1.3  mycroft #define	SSD_UOL		0x01
     47   1.3  mycroft #define	SSD_DOL		0x02
     48   1.3  mycroft #define	SSD_SELFTEST	0x04
     49   1.3  mycroft #define	SSD_PF		0x10
     50  1.22  reinoud 	u_int8_t unused[1];
     51  1.22  reinoud 	u_int8_t paramlen[2];
     52  1.22  reinoud 	u_int8_t control;
     53   1.6  mycroft };
     54   1.6  mycroft 
     55  1.12    enami #define	SCSI_RESERVE      		0x16
     56   1.6  mycroft struct scsi_reserve {
     57  1.22  reinoud 	u_int8_t opcode;
     58  1.22  reinoud 	u_int8_t byte2;
     59  1.22  reinoud 	u_int8_t unused[2];
     60  1.22  reinoud 	u_int8_t length;
     61  1.22  reinoud 	u_int8_t control;
     62   1.6  mycroft };
     63   1.6  mycroft 
     64  1.12    enami #define	SCSI_RELEASE      		0x17
     65   1.6  mycroft struct scsi_release {
     66  1.22  reinoud 	u_int8_t opcode;
     67  1.22  reinoud 	u_int8_t byte2;
     68  1.22  reinoud 	u_int8_t unused[2];
     69  1.22  reinoud 	u_int8_t length;
     70  1.22  reinoud 	u_int8_t control;
     71   1.6  mycroft };
     72   1.6  mycroft 
     73  1.11   bouyer #define	SCSI_CHANGE_DEFINITION	0x40
     74   1.6  mycroft struct scsi_changedef {
     75  1.22  reinoud 	u_int8_t opcode;
     76  1.22  reinoud 	u_int8_t byte2;
     77  1.22  reinoud 	u_int8_t unused1;
     78  1.22  reinoud 	u_int8_t how;
     79  1.22  reinoud 	u_int8_t unused[4];
     80  1.22  reinoud 	u_int8_t datalen;
     81  1.22  reinoud 	u_int8_t control;
     82   1.3  mycroft };
     83  1.12    enami #define	SC_SCSI_1 0x01
     84  1.12    enami #define	SC_SCSI_2 0x03
     85   1.1      cgd 
     86  1.18   bouyer /* block descriptor, for mode sense/mode select */
     87   1.6  mycroft struct scsi_blk_desc {
     88  1.22  reinoud 	u_int8_t density;
     89  1.22  reinoud 	u_int8_t nblocks[3];
     90  1.22  reinoud 	u_int8_t reserved;
     91  1.22  reinoud 	u_int8_t blklen[3];
     92   1.6  mycroft };
     93   1.1      cgd 
     94   1.1      cgd /*
     95   1.1      cgd  * Status Byte
     96   1.1      cgd  */
     97  1.15       ad #define	SCSI_OK			0x00
     98  1.15       ad #define	SCSI_CHECK		0x02
     99  1.15       ad #define	SCSI_BUSY		0x08
    100  1.15       ad #define	SCSI_INTERM		0x10
    101  1.15       ad #define	SCSI_RESV_CONFLICT	0x18
    102  1.15       ad #define	SCSI_TERMINATED		0x22
    103  1.15       ad #define	SCSI_QUEUE_FULL		0x28
    104  1.15       ad #define	SCSI_ACA_ACTIVE		0x30
    105  1.19     matt 
    106  1.19     matt #endif /* _DEV_SCSIPI_SCSI_ALL_H_ */
    107