1 /* $NetBSD: scsi_all.h,v 1.19 2003/01/06 21:02:18 matt 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 * SCSI command format
29 */
30
31 /*
32 * Define dome bits that are in ALL (or a lot of) scsi commands
33 */
34 #define SCSI_CTL_LINK 0x01
35 #define SCSI_CTL_FLAG 0x02
36 #define SCSI_CTL_VENDOR 0xC0
37
38
39 /*
40 * Some old SCSI devices need the LUN to be set in the top 3 bits of the
41 * second byte of the CDB.
42 */
43 #define SCSI_CMD_LUN_MASK 0xe0
44 #define SCSI_CMD_LUN_SHIFT 5
45
46 /*
47 * XXX
48 * Actually some SCSI driver expects this structure to be 12 bytes, so
49 * don't change it unless you really know what you are doing
50 */
51
52 struct scsi_generic {
53 u_int8_t opcode;
54 u_int8_t bytes[11];
55 };
56
57 /* XXX Is this a command ? What's its opcode ? */
58 struct scsi_send_diag {
59 u_int8_t opcode;
60 u_int8_t byte2;
61 #define SSD_UOL 0x01
62 #define SSD_DOL 0x02
63 #define SSD_SELFTEST 0x04
64 #define SSD_PF 0x10
65 u_int8_t unused[1];
66 u_int8_t paramlen[2];
67 u_int8_t control;
68 };
69
70 #define SCSI_RESERVE 0x16
71 struct scsi_reserve {
72 u_int8_t opcode;
73 u_int8_t byte2;
74 u_int8_t unused[2];
75 u_int8_t length;
76 u_int8_t control;
77 };
78
79 #define SCSI_RELEASE 0x17
80 struct scsi_release {
81 u_int8_t opcode;
82 u_int8_t byte2;
83 u_int8_t unused[2];
84 u_int8_t length;
85 u_int8_t control;
86 };
87
88 #define SCSI_CHANGE_DEFINITION 0x40
89 struct scsi_changedef {
90 u_int8_t opcode;
91 u_int8_t byte2;
92 u_int8_t unused1;
93 u_int8_t how;
94 u_int8_t unused[4];
95 u_int8_t datalen;
96 u_int8_t control;
97 };
98 #define SC_SCSI_1 0x01
99 #define SC_SCSI_2 0x03
100
101 /* block descriptor, for mode sense/mode select */
102 struct scsi_blk_desc {
103 u_int8_t density;
104 u_int8_t nblocks[3];
105 u_int8_t reserved;
106 u_int8_t blklen[3];
107 };
108
109 /*
110 * Status Byte
111 */
112 #define SCSI_OK 0x00
113 #define SCSI_CHECK 0x02
114 #define SCSI_BUSY 0x08
115 #define SCSI_INTERM 0x10
116 #define SCSI_RESV_CONFLICT 0x18
117 #define SCSI_TERMINATED 0x22
118 #define SCSI_QUEUE_FULL 0x28
119 #define SCSI_ACA_ACTIVE 0x30
120
121 #endif /* _DEV_SCSIPI_SCSI_ALL_H_ */
Cache object: 2f475f1f647ad89eff0d6b11d28c3dc9
|