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