1 /* $NetBSD: sbp.h,v 1.2 2005/12/11 12:22:02 christos Exp $ */
3 * Copyright (c) 2003 Hidetoshi Shimokawa
4 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the acknowledgement as bellow:
18 * This product includes software developed by K. Kobayashi and H. Shimokawa
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
35 * $FreeBSD: /repoman/r/ncvs/src/sys/dev/firewire/sbp.h,v 1.5 2005/01/06 01:42:41 imp Exp $
39 #define ORB_NOTIFY (1 << 31)
40 #define ORB_FMT_STD (0 << 29)
41 #define ORB_FMT_VED (2 << 29)
42 #define ORB_FMT_NOP (3 << 29)
43 #define ORB_FMT_MSK (3 << 29)
44 #define ORB_EXV (1 << 28)
46 #define ORB_CMD_IN (1 << 27)
48 #define ORB_CMD_SPD(x) ((x) << 24)
49 #define ORB_CMD_MAXP(x) ((x) << 20)
50 #define ORB_RCN_TMO(x) ((x) << 20)
51 #define ORB_CMD_PTBL (1 << 19)
52 #define ORB_CMD_PSZ(x) ((x) << 16)
54 #define ORB_FUN_LGI (0 << 16)
55 #define ORB_FUN_QLG (1 << 16)
56 #define ORB_FUN_RCN (3 << 16)
57 #define ORB_FUN_LGO (7 << 16)
58 #define ORB_FUN_ATA (0xb << 16)
59 #define ORB_FUN_ATS (0xc << 16)
60 #define ORB_FUN_LUR (0xe << 16)
61 #define ORB_FUN_RST (0xf << 16)
62 #define ORB_FUN_MSK (0xf << 16)
63 #define ORB_FUN_RUNQUEUE 0xffff
65 #define SBP_DEBUG(x) if (debug > x) {
73 #define SBP_RECV_LEN 32
86 #if BYTE_ORDER == BIG_ENDIAN
103 #define SRC_NEXT_EXISTS 0
104 #define SRC_NO_NEXT 1
108 #define SBP_REQ_CMP 0 /* request complete */
109 #define SBP_TRANS_FAIL 1 /* transport failure */
110 #define SBP_ILLE_REQ 2 /* illegal request */
111 #define SBP_VEND_DEP 3 /* vendor dependent */
113 /* status (resp == 0) */
114 /* 0: No additional Information to report */
115 /* 1: Request Type not supported */
116 /* 2: Speed not supported */
117 /* 3: Page size not supported */
118 /* 4: Access denied */
119 #define STATUS_ACCESS_DENY 4
120 /* 5: Logical unit not supported */
121 /* 6: Maximum payload too small */
122 /* 7: Reserved for future standardization */
123 /* 8: Resource unavailabe */
124 #define STATUS_RES_UNAVAIL 8
125 /* 9: Function Rejected */
126 /* 10: Login ID not recognized */
127 /* 11: Dummy ORB completed */
128 /* 12: Request aborted */
129 /* 255: Unspecified error */
131 /* status (resp == 1) */
132 /* Referenced object */
133 #define OBJ_ORB (0 << 6) /* 0: ORB */
134 #define OBJ_DATA (1 << 6) /* 1: Data buffer */
135 #define OBJ_PT (2 << 6) /* 2: Page table */
136 #define OBJ_UNSPEC (3 << 6) /* 3: Unable to specify */
137 /* Serial bus error */
138 /* 0: Missing acknowledge */
139 /* 1: Reserved; not to be used */
140 /* 2: Time-out error */
141 #define SBE_TIMEOUT 2
142 /* 3: Reserved; not to be used */
143 /* 4: Busy retry limit exceeded: ack_busy_X */
144 /* 5: Busy retry limit exceeded: ack_busy_A */
145 /* 6: Busy retry limit exceeded: ack_busy_B */
146 /* 7-A: Reserved for future standardization */
147 /* B: Tardy retry limit exceeded */
148 /* C: Confilict error */
151 /* F: Address error */
154 struct sbp_cmd_status
{
155 #define SBP_SFMT_CURR 0
156 #define SBP_SFMT_DEFER 1
157 #if BYTE_ORDER == BIG_ENDIAN
183 #define ORB_FUN_NAMES \
185 /* 1 */ "QUERY LOGINS", \
186 /* 2 */ "Reserved", \
187 /* 3 */ "RECONNECT", \
188 /* 4 */ "SET PASSWORD", \
189 /* 5 */ "Reserved", \
190 /* 6 */ "Reserved", \
192 /* 8 */ "Reserved", \
193 /* 9 */ "Reserved", \
194 /* A */ "Reserved", \
195 /* B */ "ABORT TASK", \
196 /* C */ "ABORT TASK SET", \
197 /* D */ "Reserved", \
198 /* E */ "LOGICAL UNIT RESET", \
199 /* F */ "TARGET RESET"
202 struct scsi3_inquiry_data
{
206 uint8_t rdf
; /* Response data format */
207 uint8_t additional_length
;
213 u_int8_t vendor_specific
[20];
215 typedef struct scsi3_inquiry_data
*scsi3_inquiry_data_t
;
217 struct scsi3_sense_data
{
218 uint8_t response_code
;
219 #define SSD_RESPONSE_CODE_VALID 0x80
220 uint8_t segment_number
;
222 uint8_t information
[4];
223 uint8_t asl
; /* Additional sense length */
224 uint8_t csi
[4]; /* Command-specific information */
225 uint8_t asc
; /* Additional sense code */
226 uint8_t ascq
; /* Additional sense code qualifier */
227 uint8_t fruc
; /* Field replaceable unit code */
228 uint8_t sks
[3]; /* Sense-key specific */
229 uint8_t asb
[14]; /* Additional sense bytes */
231 typedef struct scsi3_sense_data
*scsi3_sense_data_t
;