2 * Copyright (c) 2003 Hidetoshi Shimokawa
3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the acknowledgement as bellow:
17 * This product includes software developed by K. Kobayashi and H. Shimokawa
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
34 * $FreeBSD: src/sys/dev/firewire/sbp.h,v 1.3 2003/12/11 03:42:40 simokawa Exp $
35 * $DragonFly: src/sys/dev/disk/sbp/sbp.h,v 1.1 2004/02/05 14:32:53 joerg Exp $
38 #define ORB_NOTIFY (1 << 31)
39 #define ORB_FMT_STD (0 << 29)
40 #define ORB_FMT_VED (2 << 29)
41 #define ORB_FMT_NOP (3 << 29)
42 #define ORB_FMT_MSK (3 << 29)
43 #define ORB_EXV (1 << 28)
45 #define ORB_CMD_IN (1 << 27)
47 #define ORB_CMD_SPD(x) ((x) << 24)
48 #define ORB_CMD_MAXP(x) ((x) << 20)
49 #define ORB_RCN_TMO(x) ((x) << 20)
50 #define ORB_CMD_PTBL (1 << 19)
51 #define ORB_CMD_PSZ(x) ((x) << 16)
53 #define ORB_FUN_LGI (0 << 16)
54 #define ORB_FUN_QLG (1 << 16)
55 #define ORB_FUN_RCN (3 << 16)
56 #define ORB_FUN_LGO (7 << 16)
57 #define ORB_FUN_ATA (0xb << 16)
58 #define ORB_FUN_ATS (0xc << 16)
59 #define ORB_FUN_LUR (0xe << 16)
60 #define ORB_FUN_RST (0xf << 16)
61 #define ORB_FUN_MSK (0xf << 16)
62 #define ORB_FUN_RUNQUEUE 0xffff
64 #define ORB_RES_CMPL 0
65 #define ORB_RES_FAIL 1
66 #define ORB_RES_ILLE 2
67 #define ORB_RES_VEND 3
69 #define SBP_DEBUG(x) if (debug > x) {
77 #define SBP_RECV_LEN 32
90 #if BYTE_ORDER == BIG_ENDIAN
107 #define SRC_NEXT_EXISTS 0
108 #define SRC_NO_NEXT 1
112 #define SBP_REQ_CMP 0 /* request complete */
113 #define SBP_TRANS_FAIL 1 /* transport failure */
114 #define SBP_ILLE_REQ 2 /* illegal request */
115 #define SBP_VEND_DEP 3 /* vendor dependent */
117 /* status (resp == 0) */
118 /* 0: No additional Information to report */
119 /* 1: Request Type not supported */
120 /* 2: Speed not supported */
121 /* 3: Page size not supported */
122 /* 4: Access denied */
123 #define STATUS_ACCESS_DENY 4
124 /* 5: Logical unit not supported */
125 /* 6: Maximum payload too small */
126 /* 7: Reserved for future standardization */
127 /* 8: Resource unavailabe */
128 #define STATUS_RES_UNAVAIL 8
129 /* 9: Function Rejected */
130 /* 10: Login ID not recognized */
131 /* 11: Dummy ORB completed */
132 /* 12: Request aborted */
133 /* 255: Unspecified error */
135 /* status (resp == 1) */
136 /* Referenced object */
137 #define OBJ_ORB (0 << 6) /* 0: ORB */
138 #define OBJ_DATA (1 << 6) /* 1: Data buffer */
139 #define OBJ_PT (2 << 6) /* 2: Page table */
140 #define OBJ_UNSPEC (3 << 6) /* 3: Unable to specify */
141 /* Serial bus error */
142 /* 0: Missing acknowledge */
143 /* 1: Reserved; not to be used */
144 /* 2: Time-out error */
145 #define SBE_TIMEOUT 2
146 /* 3: Reserved; not to be used */
147 /* 4: Busy retry limit exceeded: ack_busy_X */
148 /* 5: Busy retry limit exceeded: ack_busy_A */
149 /* 6: Busy retry limit exceeded: ack_busy_B */
150 /* 7-A: Reserved for future standardization */
151 /* B: Tardy retry limit exceeded */
152 /* C: Confilict error */
155 /* F: Address error */
158 struct sbp_cmd_status{
159 #define SBP_SFMT_CURR 0
160 #define SBP_SFMT_DEFER 1
161 #if BYTE_ORDER == BIG_ENDIAN
183 u_int8_t s_keydep[3];
187 #define ORB_FUN_NAMES \
189 /* 1 */ "QUERY LOGINS", \
190 /* 2 */ "Reserved", \
191 /* 3 */ "RECONNECT", \
192 /* 4 */ "SET PASSWORD", \
193 /* 5 */ "Reserved", \
194 /* 6 */ "Reserved", \
196 /* 8 */ "Reserved", \
197 /* 9 */ "Reserved", \
198 /* A */ "Reserved", \
199 /* B */ "ABORT TASK", \
200 /* C */ "ABORT TASK SET", \
201 /* D */ "Reserved", \
202 /* E */ "LOGICAL UNIT RESET", \
203 /* F */ "TARGET RESET"