1 /* $NetBSD: sbp2reg.h,v 1.6 2002/12/28 10:54:47 jmc Exp $ */
2
3 /*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _DEV_STD_SBP2REG_H_
40 #define _DEV_STD_SBP2REG_H_
41
42 #define SBP2_UNIT_SPEC_ID 0x00609E /* NCITS OUI */
43 #define SBP2_UNIT_SW_VERSION 0x010483
44
45 /* 0x38/8, oui/24
46 */
47 #define SBP2_KEYVALUE_Command_Set_Spec_Id 0x38 /* immediate (OUI) */
48
49 /* 0x39/8, oui/24 Unit Directory
50 */
51 #define SBP2_KEYVALUE_Command_Set 0x39 /* immediate (OUI) */
52
53 /* 0x54/8, offset/24 Unit Directory
54 */
55 #define SBP2_KEYVALUE_Management_Agent \
56 P1212_KEYVALUE_Unit_Dependent_Info /* offset */
57
58 /* 0x3A/8, reserved/8, msg_ORB_timeout/8, ORB_size/8 Unit Directory
59 */
60 #define SBP2_KEYVALUE_Unit_Characteristics 0x3A /* immediate */
61
62 /* 0x3B/8, reserver/8, max_reconnect_hold/16 Unit Directory
63 */
64 #define SBP2_KEYVALUE_Command_Set_Revision 0x3B /* immediate */
65
66 /* 0x3C/8, firmware_revision/24 Unit Directory
67 */
68 #define SBP2_KEYVALUE_Firmware_Revision 0x3C /* immediate */
69
70 /* 0x3D/8, reserver/8, max_reconnect_hold/16 Unit Directory
71 */
72 #define SBP2_KEYVALUE_Reconnect_Timeout 0x3D /* immediate */
73
74 /* 0xD4/8, indirect_offset/24 Unit Directory
75 */
76 #define SBP2_KEYVALUE_Logical_Unit_Directory \
77 P1212_KEYVALUE_Unit_Dependent_Info /* directory */
78
79 /* 0x14/8, reserved/1, ordered/1, reserved/1 Unit Directory
80 * device_type/5, lun/16
81 */
82 #define SBP2_KEYVALUE_Logical_Unit_Number \
83 P1212_KEYVALUE_Unit_Dependent_Info /* immediate */
84
85 /* 0x8D/8, indirect_offset/24 Unit Directory
86 */
87 #define SBP2_KEYVALUE_Unit_Unique_Id \
88 P1212_KEYVALUE_Node_Unique_Id /* leaf */
89
90 #define SBP2_ORB_LOGIN 0
91 #define SBP2_ORB_QUERY_LOGINS 1
92 #define SBP2_ORB_RECONNECT 3
93 #define SBP2_ORB_LOGOUT 7
94
95 /* Max data size in a command orb (add 20 for command section) */
96
97 #define SBP2_MAX_ORB 1004
98 #define SBP2_CMD_ORB_SIZE 32
99
100 #define SBP2_MIN_MGMT_OFFSET 0x4000
101
102 #define SBP_READ 0x1
103 #define SBP_WRITE 0x2
104
105 #define SBP2_LOGGED_IN 0x1
106
107 #define SBP2_MAX_RECONNECT 0xf
108 #define SBP2_RECONNECT 0x4
109
110 #define SBP2_CMDREG_AGENT_STATE 0x00
111 #define SBP2_CMDREG_AGENT_RESET 0x04
112 #define SBP2_CMDREG_ORB_POINTER 0x08
113 #define SBP2_CMDREG_DOORBELL 0x10
114 #define SBP2_CMDREG_UNSOLICITED_STATUS_ENABLE 0x14
115
116 #define SBP2_LOGIN_MAX_RESP 16
117 #define SBP2_LOGIN_SIZE 32
118 #define SBP2_STATUS_SIZE 32
119
120 #define SBP2_LOGIN_EXCLUSIVE_MASK 0x10000000
121 #define SBP2_LOGIN_RECONNECT_MASK 0x00f00000
122
123 #define SBP2_LOGIN_EXCLUSIVE_SHIFT 28
124 #define SBP2_LOGIN_RECONNECT_SHIFT 20
125
126 #define SBP2_LOGIN_SET_EXCLUSIVE (1 << SBP2_LOGIN_EXCLUSIVE_SHIFT)
127 #define SBP2_LOGIN_SET_RECONNECT(x) (x << SBP2_LOGIN_RECONNECT_SHIFT)
128
129 #define SBP2_LOGINRESP_LENGTH_MASK 0xffff0000
130 #define SBP2_LOGINRESP_LOGINID_MASK 0x0000ffff
131 #define SBP2_LOGINRESP_RECONNECT_MASK 0x0000ffff
132
133 #define SBP2_LOGINRESP_LENGTH_SHIFT 16
134
135 #define SBP2_LOGINRESP_GET_LENGTH(x) ((x & SBP2_LOGINRESP_LENGTH_MASK) >> \
136 SBP2_LOGINRESP_LENGTH_SHIFT)
137 #define SBP2_LOGINRESP_GET_LOGINID(x) (x & SBP2_LOGINRESP_LOGINID_MASK)
138 #define SBP2_LOGINRESP_GET_RECONNECT(x) (x & SBP2_LOGINRESP_RECONNECT_MASK)
139
140 #define SBP2_LOGINRESP_CREATE_CMDREG(x,y) (((u_int64_t)x << 32) | y)
141
142 #define SBP2_STATUS_REQUEST_COMPLETE 0x0
143 #define SBP2_STATUS_TRANSPORT_FAIL 0x1
144 #define SBP2_STATUS_ILLEGAL_REQUEST 0x2
145 #define SBP2_STATUS_VENDOR_DEPENDENT 0x3
146
147 #define SBP2_STATUS_UNSPEC_ERROR 0xff
148
149 #define SBP2_STATUS_NOERROR 0x0
150
151 #define SBP2_NUM_ALLOC 0x8
152
153 #define SBP2_ORB_FMT_SBP2 0x0
154 #define SBP2_ORB_FMT_RESERVED 0x1
155 #define SBP2_ORB_FMT_VENDOR 0x2
156 #define SBP2_ORB_FMT_DUMMY 0x3
157
158 #define SBP2_ORB_FMT_SBP2_MASK 0x00000000
159 #define SBP2_ORB_FMT_RESERVED_MASK 0x20000000
160 #define SBP2_ORB_FMT_VENDOR_MASK 0x40000000
161 #define SBP2_ORB_FMT_DUMMY_MASK 0x60000000
162
163 #define SBP2_ORB_NULL_POINTER 0x80000000
164
165 #define SBP2_ORB_NOTIFY_MASK 0x80000000
166 #define SBP2_ORB_FMT_MASK 0x60000000
167 #define SBP2_ORB_RW_MASK 0x08000000
168 #define SBP2_ORB_SPD_MASK 0x07000000
169 #define SBP2_ORB_PAYLOAD_MASK 0x00f00000
170 #define SBP2_ORB_PAGETABLE_MASK 0x00080000
171 #define SBP2_ORB_PAGESIZE_MASK 0x00070000
172 #define SBP2_ORB_DATASIZE_MASK 0x0000ffff
173
174 #define SBP2_ORB_NOTIFY_SHIFT 31
175 #define SBP2_ORB_FMT_SHIFT 29
176 #define SBP2_ORB_RW_SHIFT 27
177 #define SBP2_ORB_SPD_SHIFT 24
178 #define SBP2_ORB_PAYLOAD_SHIFT 20
179 #define SBP2_ORB_PAGETABLE_SHIFT 19
180 #define SBP2_ORB_PAGESIZE_SHIFT 16
181 #define SBP2_ORB_DATASIZE_SHIFT 0
182
183 #define SBP2_ORB_SET_SPEED(x) (x << SBP2_ORB_SPD_SHIFT)
184 #define SBP2_ORB_SET_MAXTRANS(x) ((x + 7) << SBP2_ORB_PAYLOAD_SHIFT)
185
186 #define SBP2_ORB_INIT_STATE 0
187 #define SBP2_ORB_SENT_STATE 1
188 #define SBP2_ORB_STATUS_STATE 2
189 #define SBP2_ORB_NEXT_ORB_STATE 3
190 #define SBP2_ORB_FREE_STATE 0xff
191
192 #define SBP2_STATUS_SRC_MASK 0xc0000000
193 #define SBP2_STATUS_RESP_MASK 0x30000000
194 #define SBP2_STATUS_DEAD_MASK 0x08000000
195 #define SBP2_STATUS_LEN_MASK 0x07000000
196 #define SBP2_STATUS_STATUS_MASK 0x00ff0000
197 #define SBP2_STATUS_ORB_HIGH_MASK 0x0000ffff
198
199 /* Contained within status if needed. */
200 #define SBP2_STATUS_OBJECT_MASK 0xc0
201 #define SBP2_STATUS_BUS_ERROR_MASK 0x0f
202
203 #define SBP2_STATUS_SRC_SHIFT 30
204 #define SBP2_STATUS_RESP_SHIFT 28
205 #define SBP2_STATUS_DEAD_SHIFT 27
206 #define SBP2_STATUS_LEN_SHIFT 24
207 #define SBP2_STATUS_STATUS_SHIFT 16
208 #define SBP2_STATUS_ORB_HIGH_SHIFT 0
209
210 #define SBP2_STATUS_OBJECT_SHIFT 6
211 #define SBP2_STATUS_BUS_ERROR_SHIFT 0
212
213 #define SBP2_STATUS_GET_SRC(x) \
214 (((x) & SBP2_STATUS_SRC_MASK) >> SBP2_STATUS_SRC_SHIFT)
215 #define SBP2_STATUS_GET_RESP(x) \
216 (((x) & SBP2_STATUS_RESP_MASK) >> SBP2_STATUS_RESP_SHIFT)
217 #define SBP2_STATUS_GET_DEAD(x) \
218 (((x) & SBP2_STATUS_DEAD_MASK) >> SBP2_STATUS_DEAD_SHIFT)
219 #define SBP2_STATUS_GET_LEN(x) \
220 (((x) & SBP2_STATUS_LEN_MASK) >> SBP2_STATUS_LEN_SHIFT)
221 #define SBP2_STATUS_GET_STATUS(x) \
222 (((x) & SBP2_STATUS_STATUS_MASK) >> SBP2_STATUS_STATUS_SHIFT)
223 #define SBP2_STATUS_GET_ORBHIGH(x) \
224 (((x) & SBP2_STATUS_ORB_HIGH_MASK))
225 #define SBP2_STATUS_GET_OBJECT(x) \
226 (((x) & SBP2_STATUS_OBJECT_MASK) >> SBP2_STATUS_OBJECT_SHIFT)
227 #define SBP2_STATUS_GET_BUS_ERROR(x) \
228 (((x) & SBP2_STATUS_BUS_ERROR_MASK))
229
230 #define SBP2_STATE_RESET 0x0
231 #define SBP2_STATE_ACTIVE 0x1
232 #define SBP2_STATE_SUSPENDED 0x2
233 #define SBP2_STATE_DEAD 0x3
234
235 #define SBP2_MAXPHYS 0xffff
236 #define SBP2_PHYS_SEGMENT (0x10000 - 512)
237
238 #define SBP2_PTENT_SIZE 8
239 #define SBP2_PTENT_SIZEQ 2
240
241 #define SBP2_PT_MAKELEN(x) (htonl(x << 16))
242
243 struct sbp2_pte_u {
244 uint32_t seg_hi_length;
245 uint32_t seg_lo;
246 };
247
248 struct sbp2_pte_n {
249 uint32_t seg_hi_length;
250 uint32_t seg_lo_offset;
251 };
252
253 #endif /* _DEV_STD_SBP2REG_H_ */
Cache object: 07cf0ca23bbf63c218b2a89947a4df33
|