Deleted Added
full compact
firewirereg.h (127468) firewirereg.h (129585)
1/*
2 * Copyright (c) 2003 Hidetoshi Shimokawa
3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 17 unchanged lines hidden (view full) ---

26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
1/*
2 * Copyright (c) 2003 Hidetoshi Shimokawa
3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 17 unchanged lines hidden (view full) ---

26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * $FreeBSD: head/sys/dev/firewire/firewirereg.h 127468 2004-03-26 23:17:10Z simokawa $
34 * $FreeBSD: head/sys/dev/firewire/firewirereg.h 129585 2004-05-22 16:14:17Z dfr $
35 *
36 */
37
38#ifdef __DragonFly__
39typedef d_thread_t fw_proc;
40#include <sys/select.h>
41#elif __FreeBSD_version >= 500000
42typedef struct thread fw_proc;
43#include <sys/selinfo.h>
44#else
45typedef struct proc fw_proc;
46#include <sys/select.h>
47#endif
48
49#include <sys/uio.h>
50
51#define splfw splimp
52
53struct fw_device{
35 *
36 */
37
38#ifdef __DragonFly__
39typedef d_thread_t fw_proc;
40#include <sys/select.h>
41#elif __FreeBSD_version >= 500000
42typedef struct thread fw_proc;
43#include <sys/selinfo.h>
44#else
45typedef struct proc fw_proc;
46#include <sys/select.h>
47#endif
48
49#include <sys/uio.h>
50
51#define splfw splimp
52
53struct fw_device{
54 u_int16_t dst;
54 uint16_t dst;
55 struct fw_eui64 eui;
55 struct fw_eui64 eui;
56 u_int8_t speed;
57 u_int8_t maxrec;
58 u_int8_t nport;
59 u_int8_t power;
56 uint8_t speed;
57 uint8_t maxrec;
58 uint8_t nport;
59 uint8_t power;
60#define CSRROMOFF 0x400
61#define CSRROMSIZE 0x400
62 int rommax; /* offset from 0xffff f000 0000 */
60#define CSRROMOFF 0x400
61#define CSRROMSIZE 0x400
62 int rommax; /* offset from 0xffff f000 0000 */
63 u_int32_t csrrom[CSRROMSIZE/4];
63 uint32_t csrrom[CSRROMSIZE/4];
64 int rcnt;
65 struct firewire_comm *fc;
64 int rcnt;
65 struct firewire_comm *fc;
66 u_int32_t status;
66 uint32_t status;
67#define FWDEVINIT 1
68#define FWDEVATTACHED 2
69#define FWDEVINVAL 3
70 STAILQ_ENTRY(fw_device) link;
71};
72
73struct firewire_softc {
74#if defined(__FreeBSD__) && __FreeBSD_version >= 500000

--- 21 unchanged lines hidden (view full) ---

96#define FWTI_TLABEL (1 << 2)
97#define FWTI_BLOCK_STR (1 << 3)
98#define FWTI_BLOCK_ASY (1 << 4)
99};
100
101struct firewire_comm{
102 device_t dev;
103 device_t bdev;
67#define FWDEVINIT 1
68#define FWDEVATTACHED 2
69#define FWDEVINVAL 3
70 STAILQ_ENTRY(fw_device) link;
71};
72
73struct firewire_softc {
74#if defined(__FreeBSD__) && __FreeBSD_version >= 500000

--- 21 unchanged lines hidden (view full) ---

96#define FWTI_TLABEL (1 << 2)
97#define FWTI_BLOCK_STR (1 << 3)
98#define FWTI_BLOCK_ASY (1 << 4)
99};
100
101struct firewire_comm{
102 device_t dev;
103 device_t bdev;
104 u_int16_t busid:10,
104 uint16_t busid:10,
105 nodeid:6;
106 u_int mode;
107 u_int nport;
108 u_int speed;
109 u_int maxrec;
110 u_int irm;
111 u_int max_node;
112 u_int max_hop;
113 u_int max_asyretry;
114#define FWPHYASYST (1 << 0)
115 u_int retry_count;
105 nodeid:6;
106 u_int mode;
107 u_int nport;
108 u_int speed;
109 u_int maxrec;
110 u_int irm;
111 u_int max_node;
112 u_int max_hop;
113 u_int max_asyretry;
114#define FWPHYASYST (1 << 0)
115 u_int retry_count;
116 u_int32_t ongobus:10,
116 uint32_t ongobus:10,
117 ongonode:6,
118 ongoaddr:16;
119 struct fw_device *ongodev;
120 struct fw_eui64 ongoeui;
121#define FWMAXCSRDIR 16
122 SLIST_HEAD(, csrdir) ongocsr;
123 SLIST_HEAD(, csrdir) csrfree;
117 ongonode:6,
118 ongoaddr:16;
119 struct fw_device *ongodev;
120 struct fw_eui64 ongoeui;
121#define FWMAXCSRDIR 16
122 SLIST_HEAD(, csrdir) ongocsr;
123 SLIST_HEAD(, csrdir) csrfree;
124 u_int32_t status;
124 uint32_t status;
125#define FWBUSNOTREADY (-1)
126#define FWBUSRESET 0
127#define FWBUSINIT 1
128#define FWBUSCYMELECT 2
129#define FWBUSMGRELECT 3
130#define FWBUSMGRDONE 4
131#define FWBUSEXPLORE 5
132#define FWBUSPHYCONF 6
133#define FWBUSEXPDONE 7
134#define FWBUSCOMPLETION 10
135 int nisodma;
136 struct fw_eui64 eui;
137 struct fw_xferq
138 *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH];
139 STAILQ_HEAD(, tlabel) tlabels[0x40];
140 STAILQ_HEAD(, fw_bind) binds;
141 STAILQ_HEAD(, fw_device) devices;
142 u_int sid_cnt;
143#define CSRSIZE 0x4000
125#define FWBUSNOTREADY (-1)
126#define FWBUSRESET 0
127#define FWBUSINIT 1
128#define FWBUSCYMELECT 2
129#define FWBUSMGRELECT 3
130#define FWBUSMGRDONE 4
131#define FWBUSEXPLORE 5
132#define FWBUSPHYCONF 6
133#define FWBUSEXPDONE 7
134#define FWBUSCOMPLETION 10
135 int nisodma;
136 struct fw_eui64 eui;
137 struct fw_xferq
138 *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH];
139 STAILQ_HEAD(, tlabel) tlabels[0x40];
140 STAILQ_HEAD(, fw_bind) binds;
141 STAILQ_HEAD(, fw_device) devices;
142 u_int sid_cnt;
143#define CSRSIZE 0x4000
144 u_int32_t csr_arc[CSRSIZE/4];
144 uint32_t csr_arc[CSRSIZE/4];
145#define CROMSIZE 0x400
145#define CROMSIZE 0x400
146 u_int32_t *config_rom;
146 uint32_t *config_rom;
147 struct crom_src_buf *crom_src_buf;
148 struct crom_src *crom_src;
149 struct crom_chunk *crom_root;
150 struct fw_topology_map *topology_map;
151 struct fw_speed_map *speed_map;
152 struct callout busprobe_callout;
153 struct callout bmr_callout;
154 struct callout timeout_callout;
155 struct callout retry_probe_callout;
147 struct crom_src_buf *crom_src_buf;
148 struct crom_src *crom_src;
149 struct crom_chunk *crom_root;
150 struct fw_topology_map *topology_map;
151 struct fw_speed_map *speed_map;
152 struct callout busprobe_callout;
153 struct callout bmr_callout;
154 struct callout timeout_callout;
155 struct callout retry_probe_callout;
156 u_int32_t (*cyctimer) (struct firewire_comm *);
156 uint32_t (*cyctimer) (struct firewire_comm *);
157 void (*ibr) (struct firewire_comm *);
157 void (*ibr) (struct firewire_comm *);
158 u_int32_t (*set_bmr) (struct firewire_comm *, u_int32_t);
158 uint32_t (*set_bmr) (struct firewire_comm *, uint32_t);
159 int (*ioctl) (dev_t, u_long, caddr_t, int, fw_proc *);
160 int (*irx_enable) (struct firewire_comm *, int);
161 int (*irx_disable) (struct firewire_comm *, int);
162 int (*itx_enable) (struct firewire_comm *, int);
163 int (*itx_disable) (struct firewire_comm *, int);
164 void (*timeout) (void *);
165 void (*poll) (struct firewire_comm *, int, int);
166 void (*set_intr) (struct firewire_comm *, int);
159 int (*ioctl) (dev_t, u_long, caddr_t, int, fw_proc *);
160 int (*irx_enable) (struct firewire_comm *, int);
161 int (*irx_disable) (struct firewire_comm *, int);
162 int (*itx_enable) (struct firewire_comm *, int);
163 int (*itx_disable) (struct firewire_comm *, int);
164 void (*timeout) (void *);
165 void (*poll) (struct firewire_comm *, int, int);
166 void (*set_intr) (struct firewire_comm *, int);
167 void (*irx_post) (struct firewire_comm *, u_int32_t *);
168 void (*itx_post) (struct firewire_comm *, u_int32_t *);
167 void (*irx_post) (struct firewire_comm *, uint32_t *);
168 void (*itx_post) (struct firewire_comm *, uint32_t *);
169 struct tcode_info *tcode;
170 bus_dma_tag_t dmat;
171};
172#define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4])
173
174struct csrdir{
169 struct tcode_info *tcode;
170 bus_dma_tag_t dmat;
171};
172#define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4])
173
174struct csrdir{
175 u_int32_t ongoaddr;
176 u_int32_t off;
175 uint32_t ongoaddr;
176 uint32_t off;
177 SLIST_ENTRY(csrdir) link;
178};
179
180struct fw_xferq {
181 int flag;
182#define FWXFERQ_CHTAGMASK 0xff
183#define FWXFERQ_RUNNING (1 << 8)
184#define FWXFERQ_STREAM (1 << 9)

--- 44 unchanged lines hidden (view full) ---

229 u_int64_t start;
230 u_int64_t end;
231 STAILQ_HEAD(, fw_xfer) xferlist;
232 STAILQ_ENTRY(fw_bind) fclist;
233 STAILQ_ENTRY(fw_bind) chlist;
234#define FWACT_NULL 0
235#define FWACT_XFER 2
236#define FWACT_CH 3
177 SLIST_ENTRY(csrdir) link;
178};
179
180struct fw_xferq {
181 int flag;
182#define FWXFERQ_CHTAGMASK 0xff
183#define FWXFERQ_RUNNING (1 << 8)
184#define FWXFERQ_STREAM (1 << 9)

--- 44 unchanged lines hidden (view full) ---

229 u_int64_t start;
230 u_int64_t end;
231 STAILQ_HEAD(, fw_xfer) xferlist;
232 STAILQ_ENTRY(fw_bind) fclist;
233 STAILQ_ENTRY(fw_bind) chlist;
234#define FWACT_NULL 0
235#define FWACT_XFER 2
236#define FWACT_CH 3
237 u_int8_t act_type;
238 u_int8_t sub;
237 uint8_t act_type;
238 uint8_t sub;
239};
240
241struct fw_xfer{
242 caddr_t sc;
243 struct firewire_comm *fc;
244 struct fw_xferq *q;
245 struct timeval tv;
246 int8_t resp;
247#define FWXF_INIT 0
248#define FWXF_INQ 1
249#define FWXF_START 2
250#define FWXF_SENT 3
251#define FWXF_SENTERR 4
252#define FWXF_BUSY 8
253#define FWXF_RCVD 10
239};
240
241struct fw_xfer{
242 caddr_t sc;
243 struct firewire_comm *fc;
244 struct fw_xferq *q;
245 struct timeval tv;
246 int8_t resp;
247#define FWXF_INIT 0
248#define FWXF_INQ 1
249#define FWXF_START 2
250#define FWXF_SENT 3
251#define FWXF_SENTERR 4
252#define FWXF_BUSY 8
253#define FWXF_RCVD 10
254 u_int8_t state;
255 u_int8_t retry;
256 u_int8_t tl;
254 uint8_t state;
255 uint8_t retry;
256 uint8_t tl;
257 void (*retry_req) (struct fw_xfer *);
258 union{
259 void (*hand) (struct fw_xfer *);
260 } act;
261 struct {
262 struct fw_pkt hdr;
257 void (*retry_req) (struct fw_xfer *);
258 union{
259 void (*hand) (struct fw_xfer *);
260 } act;
261 struct {
262 struct fw_pkt hdr;
263 u_int32_t *payload;
264 u_int16_t pay_len;
265 u_int8_t spd;
263 uint32_t *payload;
264 uint16_t pay_len;
265 uint8_t spd;
266 } send, recv;
267 struct mbuf *mbuf;
268 STAILQ_ENTRY(fw_xfer) link;
269 struct malloc_type *malloc;
270};
271
272struct fw_rcv_buf {
273 struct firewire_comm *fc;
274 struct fw_xfer *xfer;
275 struct iovec *vec;
276 u_int nvec;
266 } send, recv;
267 struct mbuf *mbuf;
268 STAILQ_ENTRY(fw_xfer) link;
269 struct malloc_type *malloc;
270};
271
272struct fw_rcv_buf {
273 struct firewire_comm *fc;
274 struct fw_xfer *xfer;
275 struct iovec *vec;
276 u_int nvec;
277 u_int8_t spd;
277 uint8_t spd;
278};
279
278};
279
280void fw_sidrcv (struct firewire_comm *, u_int32_t *, u_int);
280void fw_sidrcv (struct firewire_comm *, uint32_t *, u_int);
281void fw_rcv (struct fw_rcv_buf *);
282void fw_xfer_unload ( struct fw_xfer*);
283void fw_xfer_free_buf ( struct fw_xfer*);
284void fw_xfer_free ( struct fw_xfer*);
285struct fw_xfer *fw_xfer_alloc (struct malloc_type *);
286struct fw_xfer *fw_xfer_alloc_buf (struct malloc_type *, int, int);
287void fw_init (struct firewire_comm *);
288int fw_tbuf_update (struct firewire_comm *, int, int);
289int fw_rbuf_update (struct firewire_comm *, int, int);
290void fw_asybusy (struct fw_xfer *);
291int fw_bindadd (struct firewire_comm *, struct fw_bind *);
292int fw_bindremove (struct firewire_comm *, struct fw_bind *);
293int fw_asyreq (struct firewire_comm *, int, struct fw_xfer*);
294void fw_busreset (struct firewire_comm *);
281void fw_rcv (struct fw_rcv_buf *);
282void fw_xfer_unload ( struct fw_xfer*);
283void fw_xfer_free_buf ( struct fw_xfer*);
284void fw_xfer_free ( struct fw_xfer*);
285struct fw_xfer *fw_xfer_alloc (struct malloc_type *);
286struct fw_xfer *fw_xfer_alloc_buf (struct malloc_type *, int, int);
287void fw_init (struct firewire_comm *);
288int fw_tbuf_update (struct firewire_comm *, int, int);
289int fw_rbuf_update (struct firewire_comm *, int, int);
290void fw_asybusy (struct fw_xfer *);
291int fw_bindadd (struct firewire_comm *, struct fw_bind *);
292int fw_bindremove (struct firewire_comm *, struct fw_bind *);
293int fw_asyreq (struct firewire_comm *, int, struct fw_xfer*);
294void fw_busreset (struct firewire_comm *);
295u_int16_t fw_crc16 (u_int32_t *, u_int32_t);
295uint16_t fw_crc16 (uint32_t *, uint32_t);
296void fw_xfer_timeout (void *);
297void fw_xfer_done (struct fw_xfer *);
298void fw_asy_callback (struct fw_xfer *);
299void fw_asy_callback_free (struct fw_xfer *);
300struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int);
301struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *);
296void fw_xfer_timeout (void *);
297void fw_xfer_done (struct fw_xfer *);
298void fw_asy_callback (struct fw_xfer *);
299void fw_asy_callback_free (struct fw_xfer *);
300struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int);
301struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *);
302struct fw_bind *fw_bindlookup (struct firewire_comm *, u_int16_t, u_int32_t);
302struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t);
303void fw_drain_txq (struct firewire_comm *);
304int fwdev_makedev (struct firewire_softc *);
305int fwdev_destroydev (struct firewire_softc *);
306void fwdev_clone (void *, char *, int, dev_t *);
307
308extern int firewire_debug;
309extern devclass_t firewire_devclass;
310

--- 33 unchanged lines hidden ---
303void fw_drain_txq (struct firewire_comm *);
304int fwdev_makedev (struct firewire_softc *);
305int fwdev_destroydev (struct firewire_softc *);
306void fwdev_clone (void *, char *, int, dev_t *);
307
308extern int firewire_debug;
309extern devclass_t firewire_devclass;
310

--- 33 unchanged lines hidden ---