xref: /netbsd-src/sys/dev/scsipi/scsi_all.h (revision db6316d1518382eecd2fdbe55a1205e0620a1b35)
1 /*	$NetBSD: scsi_all.h,v 1.20 2004/12/07 22:27:17 thorpej 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 dome 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 /* XXX Is this a command ? What's its opcode ? */
43 struct scsi_send_diag {
44 	u_int8_t opcode;
45 	u_int8_t byte2;
46 #define	SSD_UOL		0x01
47 #define	SSD_DOL		0x02
48 #define	SSD_SELFTEST	0x04
49 #define	SSD_PF		0x10
50 	u_int8_t unused[1];
51 	u_int8_t paramlen[2];
52 	u_int8_t control;
53 };
54 
55 #define	SCSI_RESERVE      		0x16
56 struct scsi_reserve {
57 	u_int8_t opcode;
58 	u_int8_t byte2;
59 	u_int8_t unused[2];
60 	u_int8_t length;
61 	u_int8_t control;
62 };
63 
64 #define	SCSI_RELEASE      		0x17
65 struct scsi_release {
66 	u_int8_t opcode;
67 	u_int8_t byte2;
68 	u_int8_t unused[2];
69 	u_int8_t length;
70 	u_int8_t control;
71 };
72 
73 #define	SCSI_CHANGE_DEFINITION	0x40
74 struct scsi_changedef {
75 	u_int8_t opcode;
76 	u_int8_t byte2;
77 	u_int8_t unused1;
78 	u_int8_t how;
79 	u_int8_t unused[4];
80 	u_int8_t datalen;
81 	u_int8_t control;
82 };
83 #define	SC_SCSI_1 0x01
84 #define	SC_SCSI_2 0x03
85 
86 /* block descriptor, for mode sense/mode select */
87 struct scsi_blk_desc {
88 	u_int8_t density;
89 	u_int8_t nblocks[3];
90 	u_int8_t reserved;
91 	u_int8_t blklen[3];
92 };
93 
94 /*
95  * Status Byte
96  */
97 #define	SCSI_OK			0x00
98 #define	SCSI_CHECK		0x02
99 #define	SCSI_BUSY		0x08
100 #define	SCSI_INTERM		0x10
101 #define	SCSI_RESV_CONFLICT	0x18
102 #define	SCSI_TERMINATED		0x22
103 #define	SCSI_QUEUE_FULL		0x28
104 #define	SCSI_ACA_ACTIVE		0x30
105 
106 #endif /* _DEV_SCSIPI_SCSI_ALL_H_ */
107