blob: 615087bb072b969a036386bbb35a45e0e9a0bc25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1999-2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_1394_IEEE1394_H
#define _SYS_1394_IEEE1394_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ieee1394.h
* This file contains various defines that go with IEEE 1394
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* IEEE1394_MAX_NODES defines the maximum number of nodes
* that can be addressed on a single 1394 bus. There are
* a 63 physical nodes that can be present and 1 broadcast
* node id. The range of 1394 nodeid's are
* 0 ... (IEEE1394_MAX_NODES - 1)
*/
#define IEEE1394_MAX_NODES 64
/* The node id for broadcast writes */
#define IEEE1394_BROADCAST_NODEID 63
/* Maximum number of ports per node */
#define IEEE1394_MAX_NUM_PORTS 16
#define IEEE1394_BUS_NUM_MASK 0x0000FFC0
#define IEEE1394_LOCAL_BUS 0x3FF
#define IEEE1394_NODE_NUM_MASK 0x0000003F
#define IEEE1394_NODE_NUM(DATA) ((DATA) & IEEE1394_NODE_NUM_MASK)
#define IEEE1394_BUS_CYCLES_PER_SEC 8000
/* IEEE 1394 Bus related definitions */
#define IEEE1394_ADDR_NODE_ID_MASK 0xFFFF000000000000
#define IEEE1394_ADDR_NODE_ID_SHIFT 48
#define IEEE1394_ADDR_NODE_ID(ADDR) \
(((ADDR) & IEEE1394_ADDR_NODE_ID_MASK) >> \
IEEE1394_ADDR_NODE_ID_SHIFT)
#define IEEE1394_ADDR_BUS_ID_MASK 0xFFC0000000000000
#define IEEE1394_ADDR_BUS_ID_SHIFT 54
#define IEEE1394_ADDR_BUS_ID(ADDR) \
(((ADDR) & IEEE1394_ADDR_BUS_ID_MASK) >> \
IEEE1394_ADDR_BUS_ID_SHIFT)
#define IEEE1394_ADDR_PHY_ID_MASK 0x003F000000000000
#define IEEE1394_ADDR_PHY_ID_SHIFT 48
#define IEEE1394_ADDR_PHY_ID(ADDR) \
(((ADDR) & IEEE1394_ADDR_PHY_ID_MASK) >> \
IEEE1394_ADDR_PHY_ID_SHIFT)
#define IEEE1394_ADDR_OFFSET_MASK 0x0000FFFFFFFFFFFF
/* IEEE 1394 data sizes */
#define IEEE1394_QUADLET (sizeof (uint32_t))
#define IEEE1394_OCTLET (sizeof (uint64_t))
/* Still need to look at these */
/* TCODES - packet transaction codes (as defined in 1394-1995 6.2.4.5) */
#define IEEE1394_TCODE_WRITE_QUADLET 0x0
#define IEEE1394_TCODE_WRITE_BLOCK 0x1
#define IEEE1394_TCODE_WRITE_RESP 0x2
#define IEEE1394_TCODE_RES1 0x3
#define IEEE1394_TCODE_READ_QUADLET 0x4
#define IEEE1394_TCODE_READ_BLOCK 0x5
#define IEEE1394_TCODE_READ_QUADLET_RESP 0x6
#define IEEE1394_TCODE_READ_BLOCK_RESP 0x7
#define IEEE1394_TCODE_CYCLE_START 0x8
#define IEEE1394_TCODE_LOCK 0x9
#define IEEE1394_TCODE_ISOCH 0xA
#define IEEE1394_TCODE_LOCK_RESP 0xB
#define IEEE1394_TCODE_RES2 0xC
#define IEEE1394_TCODE_RES3 0xD
#define IEEE1394_TCODE_PHY 0xE
#define IEEE1394_TCODE_RES4 0xF
#define IEEE1394_RESP_COMPLETE 0x0
#define IEEE1394_RESP_CONFLICT_ERROR 0x4
#define IEEE1394_RESP_DATA_ERROR 0x5
#define IEEE1394_RESP_TYPE_ERROR 0x6
#define IEEE1394_RESP_ADDRESS_ERROR 0x7
#define IEEE1394_ISOCH_HDR_QUAD_SZ 3
/* Self ID packet definitions */
#define IEEE1394_SELFID_PCKT_ID_MASK 0xC0000000
#define IEEE1394_SELFID_PCKT_ID_SHIFT 30
#define IEEE1394_SELFID_PCKT_ID_VALID 0x2
#define IEEE1394_SELFID_ISVALID(S_PKT) \
(~((S_PKT)->spkt_data ^ (S_PKT)->spkt_inverse) ? 0 : 1)
#define IEEE1394_SELFID_PHYID_MASK 0x3F000000
#define IEEE1394_SELFID_PHYID_SHIFT 24
#define IEEE1394_SELFID_PHYID(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_PHYID_MASK) >> \
IEEE1394_SELFID_PHYID_SHIFT)
/* SelfID PKT #0 */
#define IEEE1394_SELFID_L_MASK 0x00400000
#define IEEE1394_SELFID_L_SHIFT 22
#define IEEE1394_SELFID_ISLINKON(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_L_MASK) >> \
IEEE1394_SELFID_L_SHIFT)
#define IEEE1394_SELFID_GAP_CNT_MASK 0x003F0000
#define IEEE1394_SELFID_GAP_CNT_SHIFT 16
#define IEEE1394_SELFID_GAP_CNT(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_GAP_CNT_MASK) >> \
IEEE1394_SELFID_GAP_CNT_SHIFT)
#define IEEE1394_SELFID_SP_MASK 0x0000C000
#define IEEE1394_SELFID_SP_SHIFT 14
#define IEEE1394_SELFID_DEL_MASK (0x00003000)
#define IEEE1394_SELFID_DEL_SHIFT 12
#define IEEE1394_SELFID_DELAY(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_DEL_MASK) >> \
IEEE1394_SELFID_DEL_SHIFT)
#define IEEE1394_SELFID_C_MASK 0x00000800
#define IEEE1394_SELFID_C_SHIFT 11
#define IEEE1394_SELFID_ISCONTENDER(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_C_MASK) >> \
IEEE1394_SELFID_C_SHIFT)
#define IEEE1394_SELFID_PWR_MASK 0x00000700
#define IEEE1394_SELFID_PWR_SHIFT 8
#define IEEE1394_SELFID_POWER(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_PWR_MASK) >> \
IEEE1394_SELFID_PWR_SHIFT)
#define IEEE1394_SELFID_PORT_TO_CHILD 0x3
#define IEEE1394_SELFID_PORT_TO_PARENT 0x2
#define IEEE1394_SELFID_PORT_NOT_CONNECTED 0x1
#define IEEE1394_SELFID_PORT_NO_PORT 0x0
#define IEEE1394_SELFID_I_MASK 0x00000002
#define IEEE1394_SELFID_I_SHIFT 1
#define IEEE1394_SELFID_INITIATED_RESET(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_I_MASK) >> \
IEEE1394_SELFID_I_SHIFT)
#define IEEE1394_SELFID_M_MASK 0x00000001
#define IEEE1394_SELFID_M_SHIFT 0
#define IEEE1394_SELFID_ISMORE(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_M_MASK) >> \
IEEE1394_SELFID_M_SHIFT)
#define IEEE1394_SELFID_PORT_OFFSET_FIRST 6
/* SelfID PKT #1 (n=0) */
#define IEEE1394_SELFID_N_MASK 0x00700000
#define IEEE1394_SELFID_N_SHIFT 20
#define IEEE1394_SELFID_PKT_NUM(S_PKT) \
(((S_PKT)->spkt_data & IEEE1394_SELFID_N_MASK) >> \
IEEE1394_SELFID_N_SHIFT)
#define IEEE1394_SELFID_PORT_OFFSET_OTHERS 16
/* PHY Config Packet definitions */
#define IEEE1394_PHY_CONFIG_T_BIT_MASK 0x00400000
#define IEEE1394_PHY_CONFIG_T_BIT_SHIFT 22
#define IEEE1394_PHY_CONFIG_GAP_CNT_MASK 0x003F0000
#define IEEE1394_PHY_CONFIG_GAP_CNT_SHIFT 16
#define IEEE1394_PHY_CONFIG_R_BIT_MASK 0x00800000
#define IEEE1394_PHY_CONFIG_R_BIT_SHIFT 23
#define IEEE1394_PHY_CONFIG_ROOT_HOLD_MASK 0x3F000000
#define IEEE1394_PHY_CONFIG_ROOT_HOLD_SHIFT 24
/*
* CSR Registers and register fields.
*/
/* CSR Register Addresses (IEEE1394-1995 8.3.2.2) */
#define IEEE1394_CSR_STATE_CLEAR 0xFFFFF0000000
#define IEEE1394_CSR_STATE_SET 0xFFFFF0000004
#define IEEE1394_CSR_NODE_IDS 0xFFFFF0000008
#define IEEE1394_CSR_RESET_START 0xFFFFF000000C
#define IEEE1394_CSR_SPLIT_TIMEOUT_HI 0xFFFFF0000018
#define IEEE1394_CSR_SPLIT_TIMEOUT_LO 0xFFFFF000001C
#define IEEE1394_CSR_ARG_HI 0xFFFFF0000020
#define IEEE1394_CSR_ARG_LO 0xFFFFF0000024
#define IEEE1394_CSR_TEST_START 0xFFFFF0000028
#define IEEE1394_CSR_TEST_STATUS 0xFFFFF000002C
/* Optional Register Addresses */
#define IEEE1394_CSR_INTERRUPT_TARGET 0xFFFFF0000050
#define IEEE1394_CSR_INTERRUPT_MASK 0xFFFFF0000054
#define IEEE1394_CSR_CLOCK_VALUE 0xFFFFF0000058
#define IEEE1394_CSR_CLOCK_VALUE_SZ 0x28
#define IEEE1394_CSR_MESSAGE_REQUEST 0xFFFFF0000080
#define IEEE1394_CSR_MESSAGE_REQUEST_SZ 0x80
/* Serial Bus CSR Register Addresss (IEEE1394-1995 8.3.2.3) */
#define IEEE1394_SCSR_CYCLE_TIME 0xFFFFF0000200
#define IEEE1394_SCSR_BUS_TIME 0xFFFFF0000204
#define IEEE1394_SCSR_PWRFAIL_IMMINENT 0xFFFFF0000208
#define IEEE1394_SCSR_PWRSRC 0xFFFFF000020C
#define IEEE1394_SCSR_BUSY_TIMEOUT 0xFFFFF0000210
#define IEEE1394_SCSR_BUSMGR_ID 0xFFFFF000021C
#define IEEE1394_SCSR_BANDWIDTH_AVAIL 0xFFFFF0000220
#define IEEE1394_SCSR_CHANS_AVAIL_HI 0xFFFFF0000224
#define IEEE1394_SCSR_CHANS_AVAIL_LO 0xFFFFF0000228
/* Config ROM Address */
#define IEEE1394_CONFIG_ROM_ADDR 0xFFFFF0000400
#define IEEE1394_CONFIG_ROM_SZ 0x400
#define IEEE1394_CONFIG_ROM_QUAD_SZ 0x100
/* Unit CSR Register Addresses */
#define IEEE1394_UCSR_TOPOLOGY_MAP 0xFFFFF0001000
#define IEEE1394_UCSR_TOPOLOGY_MAP_SZ 0x400
#define IEEE1394_UCSR_SPEED_MAP 0xFFFFF0002000
#define IEEE1394_UCSR_SPEED_MAP_SZ 0x1000
/* Boundary for "reserved" CSR registers */
#define IEEE1394_UCSR_RESERVED_BOUNDARY 0xFFFFF0010000
#define IEEE1394_CSR_OFFSET_MASK 0x00000000FFFF
/* 1394 Bus Speeds */
#define IEEE1394_S100 0
#define IEEE1394_S200 1
#define IEEE1394_S400 2
#define IEEE1394_S800 3
#define IEEE1394_S1600 4
#define IEEE1394_S3200 5
/* IEEE 1394 Bandwidth bounds */
#define IEEE1394_BANDWIDTH_MIN 0
#define IEEE1394_BANDWIDTH_MAX 0x1333
/* Speed Map specific defines */
#define IEEE1394_SPEED_MAP_CRC_LEN 0x03F1
#define IEEE1394_SPEED_MAP_LEN_MASK 0x0000FFFF
#define IEEE1394_SPEED_MAP_LEN_SHIFT 16
#define IEEE1394_SPEED_MAP_DATA_LEN 0x0FBE
/* Topology Map specific defines */
#define IEEE1394_TOP_MAP_LEN_MASK 0x0000FFFF
#define IEEE1394_TOP_MAP_LEN_SHIFT 16
/* Config ROM specific defines */
#define IEEE1394_CFG_ROM_CRC_VALUE_MASK 0x0000FFFF
#define IEEE1394_CFG_ROM_CRC_LEN_SHIFT 16
#define IEEE1394_CFG_ROM_CRC_LEN_MASK 0xFF
#define IEEE1394_CFG_ROM_LEN_SHIFT 16
/* CRC16 defines */
#define IEEE1394_CRC16_MASK 0xFFFF
/* Bit positions in the STATE register */
#define IEEE1394_CSR_STATE_CMSTR 0x00000100
#define IEEE1394_CSR_STATE_DREQ 0x00000040
#define IEEE1394_CSR_STATE_ABDICATE 0x00000400
/* Positions in the BUS_INFO_BLOCK */
#define IEEE1394_BIB_LNK_SPD_MASK 0x00000007
#define IEEE1394_BIB_LNK_SPD_SHIFT 0
#define IEEE1394_BIB_GEN_MASK 0x000000F0
#define IEEE1394_BIB_GEN_SHIFT 4
#define IEEE1394_BIB_MROM_MASK 0x00000300
#define IEEE1394_BIB_MROM_SHIFT 8
#define IEEE1394_BIB_IRMC_MASK 0x80000000
#define IEEE1394_BIB_IRMC_SHIFT 31
#define IEEE1394_BIB_BMC_MASK 0x10000000
#define IEEE1394_BIB_BMC_SHIFT 28
#define IEEE1394_BIB_CMC_MASK 0x40000000
#define IEEE1394_BIB_CMC_SHIFT 30
#define IEEE1394_BIB_MAXREC_MASK 0x0000F000
#define IEEE1394_BIB_MAXREC_SHIFT 12
#define IEEE1394_BIB_QUAD_SZ 5
#define IEEE1394_BIB_SZ 0x14
/* Bus Manager specific defines */
#define IEEE1394_BM_IRM_TIMEOUT 625000
#define IEEE1394_BM_INCUMBENT_TIMEOUT 125000
#ifdef __cplusplus
}
#endif
#endif /* _SYS_1394_IEEE1394_H */
|