xref: /netbsd/sys/dev/scsipi/scsi_all.h (revision 4ac62840)
1 /*	$NetBSD: scsi_all.h,v 1.25 2012/02/25 10:17:14 shattered Exp $	*/
2 
3 /*
4  * SCSI-specific interface description.
5  */
6 
7 /*
8  * Largely written by Julian Elischer (julian@tfs.com)
9  * for TRW Financial Systems.
10  *
11  * TRW Financial Systems, in accordance with their agreement with Carnegie
12  * Mellon University, makes this software available to CMU to distribute
13  * or use in any manner that they see fit as long as this message is kept with
14  * the software. For this reason TFS also grants any other persons or
15  * organisations permission to use or modify this software.
16  *
17  * TFS supplies this software to be publicly redistributed
18  * on the understanding that TFS is not responsible for the correct
19  * functioning of this software in any circumstances.
20  *
21  * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
22  */
23 
24 #ifndef _DEV_SCSIPI_SCSI_ALL_H_
25 #define _DEV_SCSIPI_SCSI_ALL_H_
26 
27 /*
28  * Define some bits that are in ALL (or a lot of) scsi commands
29  */
30 #define	SCSI_CTL_LINK		0x01
31 #define	SCSI_CTL_FLAG		0x02
32 #define	SCSI_CTL_VENDOR		0xC0
33 
34 
35 /*
36  * Some old SCSI devices need the LUN to be set in the top 3 bits of the
37  * second byte of the CDB.
38  */
39 #define	SCSI_CMD_LUN_MASK	0xe0
40 #define	SCSI_CMD_LUN_SHIFT	5
41 
42 #define	SCSI_CHANGE_DEFINITION	0x40
43 struct scsi_changedef {
44 	u_int8_t opcode;
45 	u_int8_t byte2;
46 	u_int8_t unused1;
47 	u_int8_t how;
48 	u_int8_t unused[4];
49 	u_int8_t datalen;
50 	u_int8_t control;
51 };
52 #define	SC_SCSI_1 0x01
53 #define	SC_SCSI_2 0x03
54 
55 /*
56  * Status Byte
57  */
58 #define	SCSI_OK			0x00
59 #define	SCSI_CHECK		0x02
60 #define	SCSI_BUSY		0x08
61 #define	SCSI_INTERM		0x10
62 #define	SCSI_RESV_CONFLICT	0x18
63 #define	SCSI_TERMINATED		0x22
64 #define	SCSI_QUEUE_FULL		0x28
65 #define	SCSI_ACA_ACTIVE		0x30
66 
67 #endif /* _DEV_SCSIPI_SCSI_ALL_H_ */
68