| @@ -1,340 +1,316 @@ | | | @@ -1,340 +1,316 @@ |
1 | /* $NetBSD: firewirereg.h,v 1.9 2009/06/20 09:40:52 cegger Exp $ */ | | 1 | /* $NetBSD: firewirereg.h,v 1.10 2009/06/20 20:18:32 dyoung Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 2003 Hidetoshi Shimokawa | | 3 | * Copyright (c) 2003 Hidetoshi Shimokawa |
4 | * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa | | 4 | * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. All advertising materials mentioning features or use of this software | | 15 | * 3. All advertising materials mentioning features or use of this software |
16 | * must display the acknowledgement as bellow: | | 16 | * must display the acknowledgement as bellow: |
17 | * | | 17 | * |
18 | * This product includes software developed by K. Kobayashi and H. Shimokawa | | 18 | * This product includes software developed by K. Kobayashi and H. Shimokawa |
19 | * | | 19 | * |
20 | * 4. The name of the author may not be used to endorse or promote products | | 20 | * 4. The name of the author may not be used to endorse or promote products |
21 | * derived from this software without specific prior written permission. | | 21 | * derived from this software without specific prior written permission. |
22 | * | | 22 | * |
23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
26 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | | 26 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
31 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | 31 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
32 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 32 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
33 | * POSSIBILITY OF SUCH DAMAGE. | | 33 | * POSSIBILITY OF SUCH DAMAGE. |
34 | * | | 34 | * |
35 | * $FreeBSD: src/sys/dev/firewire/firewirereg.h,v 1.50 2007/07/20 03:42:57 simokawa Exp $ | | 35 | * $FreeBSD: src/sys/dev/firewire/firewirereg.h,v 1.50 2007/07/20 03:42:57 simokawa Exp $ |
36 | * | | 36 | * |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/uio.h> | | 39 | #include <sys/uio.h> |
40 | | | 40 | |
41 | STAILQ_HEAD(fw_xferlist, fw_xfer); | | 41 | STAILQ_HEAD(fw_xferlist, fw_xfer); |
42 | | | 42 | |
43 | struct fw_device{ | | 43 | struct fw_device{ |
44 | uint16_t dst; | | 44 | uint16_t dst; |
45 | struct fw_eui64 eui; | | 45 | struct fw_eui64 eui; |
46 | uint8_t speed; | | 46 | uint8_t speed; |
47 | uint8_t maxrec; | | 47 | uint8_t maxrec; |
48 | uint8_t nport; | | 48 | uint8_t nport; |
49 | uint8_t power; | | 49 | uint8_t power; |
50 | #define CSRROMOFF 0x400 | | 50 | #define CSRROMOFF 0x400 |
51 | #define CSRROMSIZE 0x400 | | 51 | #define CSRROMSIZE 0x400 |
52 | int rommax; /* offset from 0xffff f000 0000 */ | | 52 | int rommax; /* offset from 0xffff f000 0000 */ |
53 | uint32_t csrrom[CSRROMSIZE/4]; | | 53 | uint32_t csrrom[CSRROMSIZE/4]; |
54 | int rcnt; | | 54 | int rcnt; |
55 | struct firewire_comm *fc; | | 55 | struct firewire_comm *fc; |
56 | uint32_t status; | | 56 | uint32_t status; |
57 | #define FWDEVNEW 0 | | 57 | #define FWDEVNEW 0 |
58 | #define FWDEVINIT 1 | | 58 | #define FWDEVINIT 1 |
59 | #define FWDEVATTACHED 2 | | 59 | #define FWDEVATTACHED 2 |
60 | #define FWDEVINVAL 3 | | 60 | #define FWDEVINVAL 3 |
61 | STAILQ_ENTRY(fw_device) link; | | 61 | STAILQ_ENTRY(fw_device) link; |
62 | device_t sbp; | | 62 | device_t sbp; |
63 | }; | | 63 | }; |
64 | | | 64 | |
65 | struct firewire_softc { | | 65 | struct firewire_softc { |
66 | #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 | | | |
67 | fw_dev_t dev; | | | |
68 | device_t sbp_dev; | | | |
69 | #elif defined(__NetBSD__) | | | |
70 | device_t dev; | | 66 | device_t dev; |
71 | SLIST_HEAD(, firewire_dev_list) devlist; | | 67 | SLIST_HEAD(, firewire_dev_list) devlist; |
72 | void *si_drv1; | | 68 | void *si_drv1; |
73 | int si_iosize_max; | | 69 | int si_iosize_max; |
74 | #endif | | | |
75 | struct firewire_comm *fc; | | 70 | struct firewire_comm *fc; |
76 | }; | | 71 | }; |
77 | #if defined(__NetBSD__) | | | |
78 | struct firewire_dev_list { | | 72 | struct firewire_dev_list { |
79 | SLIST_ENTRY(firewire_dev_list) link; | | 73 | SLIST_ENTRY(firewire_dev_list) link; |
80 | device_t dev; | | 74 | device_t dev; |
81 | struct fw_device *fwdev; | | 75 | struct fw_device *fwdev; |
82 | }; | | 76 | }; |
83 | #endif | | | |
84 | | | 77 | |
85 | #define FW_MAX_DMACH 0x20 | | 78 | #define FW_MAX_DMACH 0x20 |
86 | #define FW_MAX_DEVCH FW_MAX_DMACH | | 79 | #define FW_MAX_DEVCH FW_MAX_DMACH |
87 | #define FW_XFERTIMEOUT 1 | | 80 | #define FW_XFERTIMEOUT 1 |
88 | | | 81 | |
89 | struct firewire_dev_comm { | | 82 | struct firewire_dev_comm { |
90 | device_t dev; | | 83 | device_t dev; |
91 | struct firewire_comm *fc; | | 84 | struct firewire_comm *fc; |
92 | void (*post_busreset) (void *); | | 85 | void (*post_busreset) (void *); |
93 | void (*post_explore) (void *); | | 86 | void (*post_explore) (void *); |
94 | }; | | 87 | }; |
95 | | | 88 | |
96 | struct tcode_info { | | 89 | struct tcode_info { |
97 | u_char hdr_len; /* IEEE1394 header length */ | | 90 | u_char hdr_len; /* IEEE1394 header length */ |
98 | u_char flag; | | 91 | u_char flag; |
99 | #define FWTI_REQ (1 << 0) | | 92 | #define FWTI_REQ (1 << 0) |
100 | #define FWTI_RES (1 << 1) | | 93 | #define FWTI_RES (1 << 1) |
101 | #define FWTI_TLABEL (1 << 2) | | 94 | #define FWTI_TLABEL (1 << 2) |
102 | #define FWTI_BLOCK_STR (1 << 3) | | 95 | #define FWTI_BLOCK_STR (1 << 3) |
103 | #define FWTI_BLOCK_ASY (1 << 4) | | 96 | #define FWTI_BLOCK_ASY (1 << 4) |
104 | u_char valid_res; | | 97 | u_char valid_res; |
105 | }; | | 98 | }; |
106 | | | 99 | |
107 | struct firewire_comm{ | | 100 | struct firewire_comm{ |
108 | device_t dev; | | 101 | device_t dev; |
109 | device_t bdev; | | 102 | device_t bdev; |
110 | uint16_t busid:10, | | 103 | uint16_t busid:10, |
111 | nodeid:6; | | 104 | nodeid:6; |
112 | u_int mode; | | 105 | u_int mode; |
113 | u_int nport; | | 106 | u_int nport; |
114 | u_int speed; | | 107 | u_int speed; |
115 | u_int maxrec; | | 108 | u_int maxrec; |
116 | u_int irm; | | 109 | u_int irm; |
117 | u_int max_node; | | 110 | u_int max_node; |
118 | u_int max_hop; | | 111 | u_int max_hop; |
119 | #define FWPHYASYST (1 << 0) | | 112 | #define FWPHYASYST (1 << 0) |
120 | uint32_t status; | | 113 | uint32_t status; |
121 | #define FWBUSDETACH (-2) | | 114 | #define FWBUSDETACH (-2) |
122 | #define FWBUSNOTREADY (-1) | | 115 | #define FWBUSNOTREADY (-1) |
123 | #define FWBUSRESET 0 | | 116 | #define FWBUSRESET 0 |
124 | #define FWBUSINIT 1 | | 117 | #define FWBUSINIT 1 |
125 | #define FWBUSCYMELECT 2 | | 118 | #define FWBUSCYMELECT 2 |
126 | #define FWBUSMGRELECT 3 | | 119 | #define FWBUSMGRELECT 3 |
127 | #define FWBUSMGRDONE 4 | | 120 | #define FWBUSMGRDONE 4 |
128 | #define FWBUSEXPLORE 5 | | 121 | #define FWBUSEXPLORE 5 |
129 | #define FWBUSPHYCONF 6 | | 122 | #define FWBUSPHYCONF 6 |
130 | #define FWBUSEXPDONE 7 | | 123 | #define FWBUSEXPDONE 7 |
131 | #define FWBUSCOMPLETION 10 | | 124 | #define FWBUSCOMPLETION 10 |
132 | int nisodma; | | 125 | int nisodma; |
133 | struct fw_eui64 eui; | | 126 | struct fw_eui64 eui; |
134 | struct fw_xferq | | 127 | struct fw_xferq |
135 | *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; | | 128 | *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; |
136 | struct fw_xferlist tlabels[0x40]; | | 129 | struct fw_xferlist tlabels[0x40]; |
137 | u_char last_tlabel[0x40]; | | 130 | u_char last_tlabel[0x40]; |
138 | fw_mtx_t tlabel_lock; | | 131 | fw_mtx_t tlabel_lock; |
139 | STAILQ_HEAD(, fw_bind) binds; | | 132 | STAILQ_HEAD(, fw_bind) binds; |
140 | STAILQ_HEAD(, fw_device) devices; | | 133 | STAILQ_HEAD(, fw_device) devices; |
141 | u_int sid_cnt; | | 134 | u_int sid_cnt; |
142 | #define CSRSIZE 0x4000 | | 135 | #define CSRSIZE 0x4000 |
143 | uint32_t csr_arc[CSRSIZE/4]; | | 136 | uint32_t csr_arc[CSRSIZE/4]; |
144 | #define CROMSIZE 0x400 | | 137 | #define CROMSIZE 0x400 |
145 | uint32_t *config_rom; | | 138 | uint32_t *config_rom; |
146 | struct crom_src_buf *crom_src_buf; | | 139 | struct crom_src_buf *crom_src_buf; |
147 | struct crom_src *crom_src; | | 140 | struct crom_src *crom_src; |
148 | struct crom_chunk *crom_root; | | 141 | struct crom_chunk *crom_root; |
149 | struct fw_topology_map *topology_map; | | 142 | struct fw_topology_map *topology_map; |
150 | struct fw_speed_map *speed_map; | | 143 | struct fw_speed_map *speed_map; |
151 | struct callout busprobe_callout; | | 144 | struct callout busprobe_callout; |
152 | struct callout bmr_callout; | | 145 | struct callout bmr_callout; |
153 | struct callout timeout_callout; | | 146 | struct callout timeout_callout; |
154 | fw_task_t task_timeout; | | 147 | fw_task_t task_timeout; |
155 | uint32_t (*cyctimer) (struct firewire_comm *); | | 148 | uint32_t (*cyctimer) (struct firewire_comm *); |
156 | void (*ibr) (struct firewire_comm *); | | 149 | void (*ibr) (struct firewire_comm *); |
157 | uint32_t (*set_bmr) (struct firewire_comm *, uint32_t); | | 150 | uint32_t (*set_bmr) (struct firewire_comm *, uint32_t); |
158 | int (*ioctl) (fw_dev_t, u_long, void *, int, fw_proc_t); | | 151 | int (*ioctl) (fw_dev_t, u_long, void *, int, fw_proc_t); |
159 | int (*irx_enable) (struct firewire_comm *, int); | | 152 | int (*irx_enable) (struct firewire_comm *, int); |
160 | int (*irx_disable) (struct firewire_comm *, int); | | 153 | int (*irx_disable) (struct firewire_comm *, int); |
161 | int (*itx_enable) (struct firewire_comm *, int); | | 154 | int (*itx_enable) (struct firewire_comm *, int); |
162 | int (*itx_disable) (struct firewire_comm *, int); | | 155 | int (*itx_disable) (struct firewire_comm *, int); |
163 | void (*timeout) (void *); | | 156 | void (*timeout) (void *); |
164 | void (*poll) (struct firewire_comm *, int, int); | | 157 | void (*poll) (struct firewire_comm *, int, int); |
165 | void (*set_intr) (struct firewire_comm *, int); | | 158 | void (*set_intr) (struct firewire_comm *, int); |
166 | void (*irx_post) (struct firewire_comm *, uint32_t *); | | 159 | void (*irx_post) (struct firewire_comm *, uint32_t *); |
167 | void (*itx_post) (struct firewire_comm *, uint32_t *); | | 160 | void (*itx_post) (struct firewire_comm *, uint32_t *); |
168 | const struct tcode_info *tcode; | | 161 | const struct tcode_info *tcode; |
169 | bus_dma_tag_t dmat; | | 162 | bus_dma_tag_t dmat; |
170 | fw_mtx_t mtx; | | 163 | fw_mtx_t mtx; |
171 | fw_mtx_t wait_lock; | | 164 | fw_mtx_t wait_lock; |
172 | struct taskqueue *taskqueue; | | 165 | struct taskqueue *taskqueue; |
173 | fw_proc_t probe_thread; | | 166 | fw_proc_t probe_thread; |
174 | }; | | 167 | }; |
175 | #define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4]) | | 168 | #define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4]) |
176 | | | 169 | |
177 | #define FW_GMTX(fc) (&(fc)->mtx) | | 170 | #define FW_GMTX(fc) (&(fc)->mtx) |
178 | #define FW_GLOCK(fc) fw_mtx_lock(FW_GMTX(fc)) | | 171 | #define FW_GLOCK(fc) fw_mtx_lock(FW_GMTX(fc)) |
179 | #define FW_GUNLOCK(fc) fw_mtx_unlock(FW_GMTX(fc)) | | 172 | #define FW_GUNLOCK(fc) fw_mtx_unlock(FW_GMTX(fc)) |
180 | #define FW_GLOCK_ASSERT(fc) fw_mtx_assert(FW_GMTX(fc), MA_OWNED) | | 173 | #define FW_GLOCK_ASSERT(fc) fw_mtx_assert(FW_GMTX(fc), MA_OWNED) |
181 | | | 174 | |
182 | struct fw_xferq { | | 175 | struct fw_xferq { |
183 | int flag; | | 176 | int flag; |
184 | #define FWXFERQ_CHTAGMASK 0xff | | 177 | #define FWXFERQ_CHTAGMASK 0xff |
185 | #define FWXFERQ_RUNNING (1 << 8) | | 178 | #define FWXFERQ_RUNNING (1 << 8) |
186 | #define FWXFERQ_STREAM (1 << 9) | | 179 | #define FWXFERQ_STREAM (1 << 9) |
187 | | | 180 | |
188 | #define FWXFERQ_BULK (1 << 11) | | 181 | #define FWXFERQ_BULK (1 << 11) |
189 | #define FWXFERQ_MODEMASK (7 << 10) | | 182 | #define FWXFERQ_MODEMASK (7 << 10) |
190 | | | 183 | |
191 | #define FWXFERQ_EXTBUF (1 << 13) | | 184 | #define FWXFERQ_EXTBUF (1 << 13) |
192 | #define FWXFERQ_OPEN (1 << 14) | | 185 | #define FWXFERQ_OPEN (1 << 14) |
193 | | | 186 | |
194 | #define FWXFERQ_HANDLER (1 << 16) | | 187 | #define FWXFERQ_HANDLER (1 << 16) |
195 | #define FWXFERQ_WAKEUP (1 << 17) | | 188 | #define FWXFERQ_WAKEUP (1 << 17) |
196 | void (*start) (struct firewire_comm*); | | 189 | void (*start) (struct firewire_comm*); |
197 | int dmach; | | 190 | int dmach; |
198 | struct fw_xferlist q; | | 191 | struct fw_xferlist q; |
199 | u_int queued; | | 192 | u_int queued; |
200 | u_int maxq; | | 193 | u_int maxq; |
201 | u_int psize; | | 194 | u_int psize; |
202 | struct fwdma_alloc_multi *buf; | | 195 | struct fwdma_alloc_multi *buf; |
203 | u_int bnchunk; | | 196 | u_int bnchunk; |
204 | u_int bnpacket; | | 197 | u_int bnpacket; |
205 | struct fw_bulkxfer *bulkxfer; | | 198 | struct fw_bulkxfer *bulkxfer; |
206 | STAILQ_HEAD(, fw_bulkxfer) stvalid; | | 199 | STAILQ_HEAD(, fw_bulkxfer) stvalid; |
207 | STAILQ_HEAD(, fw_bulkxfer) stfree; | | 200 | STAILQ_HEAD(, fw_bulkxfer) stfree; |
208 | STAILQ_HEAD(, fw_bulkxfer) stdma; | | 201 | STAILQ_HEAD(, fw_bulkxfer) stdma; |
209 | struct fw_bulkxfer *stproc; | | 202 | struct fw_bulkxfer *stproc; |
210 | struct selinfo rsel; | | 203 | struct selinfo rsel; |
211 | void *sc; | | 204 | void *sc; |
212 | void (*hand) (struct fw_xferq *); | | 205 | void (*hand) (struct fw_xferq *); |
213 | }; | | 206 | }; |
214 | | | 207 | |
215 | struct fw_bulkxfer{ | | 208 | struct fw_bulkxfer{ |
216 | int poffset; | | 209 | int poffset; |
217 | struct mbuf *mbuf; | | 210 | struct mbuf *mbuf; |
218 | STAILQ_ENTRY(fw_bulkxfer) link; | | 211 | STAILQ_ENTRY(fw_bulkxfer) link; |
219 | void *start; | | 212 | void *start; |
220 | void *end; | | 213 | void *end; |
221 | int resp; | | 214 | int resp; |
222 | }; | | 215 | }; |
223 | | | 216 | |
224 | struct fw_bind{ | | 217 | struct fw_bind{ |
225 | u_int64_t start; | | 218 | u_int64_t start; |
226 | u_int64_t end; | | 219 | u_int64_t end; |
227 | struct fw_xferlist xferlist; | | 220 | struct fw_xferlist xferlist; |
228 | STAILQ_ENTRY(fw_bind) fclist; | | 221 | STAILQ_ENTRY(fw_bind) fclist; |
229 | STAILQ_ENTRY(fw_bind) chlist; | | 222 | STAILQ_ENTRY(fw_bind) chlist; |
230 | void *sc; | | 223 | void *sc; |
231 | }; | | 224 | }; |
232 | | | 225 | |
233 | struct fw_xfer{ | | 226 | struct fw_xfer{ |
234 | void *sc; | | 227 | void *sc; |
235 | struct firewire_comm *fc; | | 228 | struct firewire_comm *fc; |
236 | struct fw_xferq *q; | | 229 | struct fw_xferq *q; |
237 | struct timeval tv; | | 230 | struct timeval tv; |
238 | int8_t resp; | | 231 | int8_t resp; |
239 | #define FWXF_INIT 0x00 | | 232 | #define FWXF_INIT 0x00 |
240 | #define FWXF_INQ 0x01 | | 233 | #define FWXF_INQ 0x01 |
241 | #define FWXF_START 0x02 | | 234 | #define FWXF_START 0x02 |
242 | #define FWXF_SENT 0x04 | | 235 | #define FWXF_SENT 0x04 |
243 | #define FWXF_SENTERR 0x08 | | 236 | #define FWXF_SENTERR 0x08 |
244 | #define FWXF_BUSY 0x10 | | 237 | #define FWXF_BUSY 0x10 |
245 | #define FWXF_RCVD 0x20 | | 238 | #define FWXF_RCVD 0x20 |
246 | | | 239 | |
247 | #define FWXF_WAKE 0x80 | | 240 | #define FWXF_WAKE 0x80 |
248 | uint8_t flag; | | 241 | uint8_t flag; |
249 | int8_t tl; | | 242 | int8_t tl; |
250 | void (*hand) (struct fw_xfer *); | | 243 | void (*hand) (struct fw_xfer *); |
251 | struct { | | 244 | struct { |
252 | struct fw_pkt hdr; | | 245 | struct fw_pkt hdr; |
253 | uint32_t *payload; | | 246 | uint32_t *payload; |
254 | uint16_t pay_len; | | 247 | uint16_t pay_len; |
255 | uint8_t spd; | | 248 | uint8_t spd; |
256 | } send, recv; | | 249 | } send, recv; |
257 | struct mbuf *mbuf; | | 250 | struct mbuf *mbuf; |
258 | STAILQ_ENTRY(fw_xfer) link; | | 251 | STAILQ_ENTRY(fw_xfer) link; |
259 | STAILQ_ENTRY(fw_xfer) tlabel; | | 252 | STAILQ_ENTRY(fw_xfer) tlabel; |
260 | struct malloc_type *malloc; | | 253 | struct malloc_type *malloc; |
261 | }; | | 254 | }; |
262 | | | 255 | |
263 | struct fw_rcv_buf { | | 256 | struct fw_rcv_buf { |
264 | struct firewire_comm *fc; | | 257 | struct firewire_comm *fc; |
265 | struct fw_xfer *xfer; | | 258 | struct fw_xfer *xfer; |
266 | struct iovec *vec; | | 259 | struct iovec *vec; |
267 | u_int nvec; | | 260 | u_int nvec; |
268 | uint8_t spd; | | 261 | uint8_t spd; |
269 | }; | | 262 | }; |
270 | | | 263 | |
271 | void fw_sidrcv (struct firewire_comm *, uint32_t *, u_int); | | 264 | void fw_sidrcv (struct firewire_comm *, uint32_t *, u_int); |
272 | void fw_rcv (struct fw_rcv_buf *); | | 265 | void fw_rcv (struct fw_rcv_buf *); |
273 | void fw_xfer_unload ( struct fw_xfer*); | | 266 | void fw_xfer_unload ( struct fw_xfer*); |
274 | void fw_xfer_free_buf ( struct fw_xfer*); | | 267 | void fw_xfer_free_buf ( struct fw_xfer*); |
275 | void fw_xfer_free ( struct fw_xfer*); | | 268 | void fw_xfer_free ( struct fw_xfer*); |
276 | struct fw_xfer *fw_xfer_alloc (struct malloc_type *); | | 269 | struct fw_xfer *fw_xfer_alloc (struct malloc_type *); |
277 | struct fw_xfer *fw_xfer_alloc_buf (struct malloc_type *, int, int); | | 270 | struct fw_xfer *fw_xfer_alloc_buf (struct malloc_type *, int, int); |
278 | void fw_init (struct firewire_comm *); | | 271 | void fw_init (struct firewire_comm *); |
279 | int fw_tbuf_update (struct firewire_comm *, int, int); | | 272 | int fw_tbuf_update (struct firewire_comm *, int, int); |
280 | int fw_rbuf_update (struct firewire_comm *, int, int); | | 273 | int fw_rbuf_update (struct firewire_comm *, int, int); |
281 | int fw_bindadd (struct firewire_comm *, struct fw_bind *); | | 274 | int fw_bindadd (struct firewire_comm *, struct fw_bind *); |
282 | int fw_bindremove (struct firewire_comm *, struct fw_bind *); | | 275 | int fw_bindremove (struct firewire_comm *, struct fw_bind *); |
283 | int fw_xferlist_add (struct fw_xferlist *, struct malloc_type *, int, int, int, | | 276 | int fw_xferlist_add (struct fw_xferlist *, struct malloc_type *, int, int, int, |
284 | struct firewire_comm *, void *, void (*)(struct fw_xfer *)); | | 277 | struct firewire_comm *, void *, void (*)(struct fw_xfer *)); |
285 | void fw_xferlist_remove (struct fw_xferlist *); | | 278 | void fw_xferlist_remove (struct fw_xferlist *); |
286 | int fw_asyreq (struct firewire_comm *, int, struct fw_xfer*); | | 279 | int fw_asyreq (struct firewire_comm *, int, struct fw_xfer*); |
287 | void fw_busreset (struct firewire_comm *, uint32_t); | | 280 | void fw_busreset (struct firewire_comm *, uint32_t); |
288 | uint16_t fw_crc16 (uint32_t *, uint32_t); | | 281 | uint16_t fw_crc16 (uint32_t *, uint32_t); |
289 | void fw_xfer_timeout (void *); | | 282 | void fw_xfer_timeout (void *); |
290 | void fw_xfer_done (struct fw_xfer *); | | 283 | void fw_xfer_done (struct fw_xfer *); |
291 | void fw_xferwake (struct fw_xfer *); | | 284 | void fw_xferwake (struct fw_xfer *); |
292 | int fw_xferwait (struct fw_xfer *); | | 285 | int fw_xferwait (struct fw_xfer *); |
293 | void fw_asy_callback_free (struct fw_xfer *); | | 286 | void fw_asy_callback_free (struct fw_xfer *); |
294 | struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int); | | 287 | struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int); |
295 | struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *); | | 288 | struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *); |
296 | struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t); | | 289 | struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t); |
297 | void fw_drain_txq (struct firewire_comm *); | | 290 | void fw_drain_txq (struct firewire_comm *); |
298 | int fwdev_makedev (struct firewire_softc *); | | 291 | int fwdev_makedev (struct firewire_softc *); |
299 | int fwdev_destroydev (struct firewire_softc *); | | 292 | int fwdev_destroydev (struct firewire_softc *); |
300 | #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 | | | |
301 | void fwdev_clone (void *, struct ucred *, char *, int, fw_dev_t *); | | | |
302 | #endif | | | |
303 | int fw_open_isodma(struct firewire_comm *, int); | | 293 | int fw_open_isodma(struct firewire_comm *, int); |
304 | | | 294 | |
305 | extern int firewire_debug; | | 295 | extern int firewire_debug; |
306 | #if defined(__FreeBSD__) | | | |
307 | extern devclass_t firewire_devclass; | | | |
308 | #elif defined(__NetBSD__) | | | |
309 | extern struct cfdriver ieee1394if_cd; | | 296 | extern struct cfdriver ieee1394if_cd; |
310 | #endif | | | |
311 | extern int firewire_phydma_enable; | | 297 | extern int firewire_phydma_enable; |
312 | | | 298 | |
313 | #ifdef __DragonFly__ | | | |
314 | #define FWPRI PCATCH | | | |
315 | #else | | | |
316 | #define FWPRI ((PZERO+8)|PCATCH) | | 299 | #define FWPRI ((PZERO+8)|PCATCH) |
317 | #endif | | | |
318 | | | 300 | |
319 | #if defined(__DragonFly__) || __FreeBSD_version < 500000 || defined(__NetBSD__) | | | |
320 | /* compatibility shim for 4.X */ | | 301 | /* compatibility shim for 4.X */ |
321 | #define bio buf | | 302 | #define bio buf |
322 | #define bio_bcount b_bcount | | 303 | #define bio_bcount b_bcount |
323 | #define bio_cmd b_flags | | 304 | #define bio_cmd b_flags |
324 | #define bio_count b_count | | 305 | #define bio_count b_count |
325 | #define bio_data b_data | | 306 | #define bio_data b_data |
326 | #define bio_dev b_dev | | 307 | #define bio_dev b_dev |
327 | #define bio_error b_error | | 308 | #define bio_error b_error |
328 | #define bio_flags b_flags | | 309 | #define bio_flags b_flags |
329 | #if defined(__FreeBSD__) | | | |
330 | #define bio_offset b_offset | | | |
331 | #elif defined(__NetBSD__) | | | |
332 | #define bio_offset b_blkno | | 310 | #define bio_offset b_blkno |
333 | #endif | | | |
334 | #define bio_resid b_resid | | 311 | #define bio_resid b_resid |
335 | #define BIO_READ B_READ | | 312 | #define BIO_READ B_READ |
336 | #define BIO_WRITE B_WRITE | | 313 | #define BIO_WRITE B_WRITE |
337 | #endif | | | |
338 | | | 314 | |
339 | MALLOC_DECLARE(M_FW); | | 315 | MALLOC_DECLARE(M_FW); |
340 | MALLOC_DECLARE(M_FWXFER); | | 316 | MALLOC_DECLARE(M_FWXFER); |