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
|
/*
* 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_ADAPTERS_HCI1394_IOCTL_H
#define _SYS_1394_ADAPTERS_HCI1394_IOCTL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* hci1394_ioctl.h
* Test ioctl's to support test/debug of the 1394 HW. hci1394_ioctl_enum_t is
* passed in cmd and a pointer to the appropriate structure (i.e.
* hci1394_ioctl_wrreg_t) is passed in arg.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* write_reg - write OpenHCI register
* read_reg - read OpenHCI register
* write_vreg - write OpenHCI Vendor Specific register
* read_vreg - read OpenHCI Vendor Specific register
* reset_bus - reset the 1394 bus
* selfid_cnt - return the number of times we saw the selfid complete
* interrupt signifying a bus reset has completed. This does not
* have to match the bus generation and probably won't.
* busgen_cnt - return the current bus generation
* read_selfid - read selfid buffer
* write_phy - write PHY register
* read_phy - read PHY register
* hba_info - HBA vendor information
*/
#define HCI11394_IOCTL ('f' << 8)
typedef enum {
HCI1394_IOCTL_WRITE_REG = HCI11394_IOCTL | 0x00,
HCI1394_IOCTL_READ_REG = HCI11394_IOCTL | 0x01,
HCI1394_IOCTL_WRITE_VREG = HCI11394_IOCTL | 0x02,
HCI1394_IOCTL_READ_VREG = HCI11394_IOCTL | 0x03,
HCI1394_IOCTL_RESET_BUS = HCI11394_IOCTL | 0x04,
HCI1394_IOCTL_SELFID_CNT = HCI11394_IOCTL | 0x05,
HCI1394_IOCTL_BUSGEN_CNT = HCI11394_IOCTL | 0x06,
HCI1394_IOCTL_READ_SELFID = HCI11394_IOCTL | 0x07,
HCI1394_IOCTL_WRITE_PHY = HCI11394_IOCTL | 0x08,
HCI1394_IOCTL_READ_PHY = HCI11394_IOCTL | 0x09,
HCI1394_IOCTL_HBA_INFO = HCI11394_IOCTL | 0x0A
} hci1394_ioctl_enum_t;
/*
* HCI1394_IOCTL_WRITE_REG
* Write OHCI register. addr is an offset into the OpenHCI register map.
* (i.e. addr = 0 would write to the Version Register). addr must be 32-bit
* aligned (i.e. 0, 4, 8, C, 10). data is the 32-bit word to write into the
* OpenHCI register.
*
* NOTE: Writing OpenHCI registers can cause the hardware and/or SW to
* misbehave. Extreme care should be used when using this call.
*/
typedef struct hci1394_ioctl_wrreg_s {
uint_t addr;
uint32_t data;
} hci1394_ioctl_wrreg_t;
/*
* HCI1394_IOCTL_READ_REG
* Read OHCI register. addr is an offset into the OpenHCI register map.
* (i.e. addr = 0 would write to the Version Register). addr must be 32-bit
* aligned (i.e. 0, 4, 8, C, 10). When the ioctl returns successfully, data
* will contain the 32-bit word read from the OHCI register.
*/
typedef struct hci1394_ioctl_rdreg_s {
uint_t addr;
uint32_t data;
} hci1394_ioctl_rdreg_t;
/*
* HCI1394_IOCTL_WRITE_VREG
* Write Vendor Specific OHCI register. addr is an offset into the Vendor
* Specific OpenHCI register map. (i.e. addr = 0 would write to the first
* Vendor Specific register. addr must be 32-bit aligned (i.e. 0, 4, 8, C,
* 10). data is the 32-bit word to write into the Vendor Specific OpenHCI
* register. regset defines which vendor specific register set to write to.
* There will usually be one vendor specific register set so this will
* usually be set to 0.
*
* NOTE: Writing Vendor Specific OpenHCI registers can cause the hardware
* and/or SW to misbehave. Extreme care should be used when using this
* call.
*/
typedef struct hci1394_ioctl_wrvreg_s {
uint_t regset;
uint_t addr;
uint32_t data;
} hci1394_ioctl_wrvreg_t;
/*
* HCI1394_IOCTL_READ_VREG
* Read Vendor specific OHCI register. addr is an offset into the Vendor
* Specific OpenHCI register space. (i.e. addr = 0 is the first Vendor
* Specific register). addr must be 32-bit aligned (i.e. 0, 4, 8, C, 10).
* When the ioctl returns successfully, data will contain the 32-bit word
* read from the Vendor Specific OHCI register. regset defines which vendor
* specific register set to read from. There will usually be one vendor
* specific register set so this will usually be set to 0.
*/
typedef struct hci1394_ioctl_rdvreg_s {
uint_t regset;
uint_t addr;
uint32_t data;
} hci1394_ioctl_rdvreg_t;
/* HCI1394_IOCTL_RESET_BUS has no parameters */
/*
* HCI1394_IOCTL_SELFID_CNT
* When the ioctl returns successfully, count will contain the number of
* times the nexus driver has seen and responded to a selfid_complete
* interrupt. This interrupt signifies that the bus reset has completed
* and the hardware based bus enumeration has completed. This number will
* most likely not be the same as the bus generation. Everytime this
* increments, the bus generation count should increment by at least one.
*
* NOTE: The current implementation of the nexus driver uses a uint_t for
* selfid_cnt.
*/
typedef struct hci1394_ioctl_selfid_cnt_s {
uint_t count;
} hci1394_ioctl_selfid_cnt_t;
/*
* HCI1394_IOCTL_BUSGEN_CNT
* When the ioctl returns successfully, count will contain the current 1394
* bus generation count.
*
* NOTE: The current implementation of the nexus driver uses the OpenHCI
* generation count which is an 8 bit value. Therefore, this count will
* wrap over at 0xFF.
*/
typedef struct hci1394_ioctl_busgen_cnt_s {
uint_t count;
} hci1394_ioctl_busgen_cnt_t;
/*
* HCI1394_IOCTL_READ_SELFID
* Copies the contents of the selfid buffer into a buffer pointed to by buf.
* Count is the number of 32-bit words to copy into buf. The maximum size
* of the selfid buffer is 1024 32-bit words. The very first word is the
* OpenHCI selfid header.
*/
typedef struct hci1394_ioctl_read_selfid_s {
uint32_t *buf;
uint_t count;
} hci1394_ioctl_read_selfid_t;
/*
* HCI1394_IOCTL_WRPHY
* Write PHY register. addr is an offset into the phy register space.
* (i.e. addr = 0 is the first phy register). addr is byte aligned
* (i.e. 0, 1, 2, 3, 4). data should contain the 8-bit value to write to the
* PHY register. The data should be stored as follows <0x000000dd> where dd
* is the byte written.
*
* NOTE: Phy register 0 cannot be read or written.
*
* NOTE: Writing PHY registers can cause the hardware and/or SW to misbehave.
* Extreme care should be used when using this call.
*/
typedef struct hci1394_ioctl_wrphy_s {
uint_t addr;
uint_t data;
} hci1394_ioctl_wrphy_t;
/*
* HCI1394_IOCTL_RDPHY
* Read PHY register. addr is an offset into the phy register space.
* (i.e. addr = 0 is the first phy register). addr is byte aligned
* (i.e. 0, 1, 2, 3, 4). When the ioctl returns successfully, data will
* contain the 8-bit data read from the PHY register. The data will be stored
* as follows <0x000000dd> where dd is the byte read.
*
* NOTE: Phy register 0 cannot be read or written.
*/
typedef struct hci1394_ioctl_rdphy_s {
uint_t addr;
uint_t data;
} hci1394_ioctl_rdphy_t;
/*
* HCI1394_IOCTL_HBA_INFO
* HBA Vendor Information
*
* Vendor Specific Info
* pci_vendor_id - VendorID from PCI config space (0x0-0x1)
* pci_device_id - DeviceID from PCI config space (0x2-0x3)
* pci_revision_id - RevisionID from PCI config space (0x8)
* ohci_version - 1394 OpenHCI Version Register (0x0)
* ohci_vendor_id - 1394 OpenHCI Vendor ID Register (0x40)
* ohci_vregset_cnt - Number of vendor specific register maps that have been
* mapped by the driver. The driver will only map in
* vendor specific registers for adapters it knows about.
*/
typedef struct hci1394_ioctl_hbainfo_s {
uint_t pci_vendor_id;
uint_t pci_device_id;
uint_t pci_revision_id;
uint32_t ohci_version;
uint32_t ohci_vendor_id;
uint_t ohci_vregset_cnt;
} hci1394_ioctl_hbainfo_t;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_1394_ADAPTERS_HCI1394_IOCTL_H */
|