if_fwe.c revision 124169
1/*
2 * Copyright (c) 2002-2003
3 * 	Hidetoshi Shimokawa. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *
16 *	This product includes software developed by Hidetoshi Shimokawa.
17 *
18 * 4. Neither the name of the author nor the names of its contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * $FreeBSD: head/sys/dev/firewire/if_fwe.c 124169 2004-01-06 14:30:47Z simokawa $
35 */
36
37#include "opt_inet.h"
38
39#include <sys/param.h>
40#include <sys/kernel.h>
41#include <sys/malloc.h>
42#include <sys/mbuf.h>
43#include <sys/socket.h>
44#include <sys/sockio.h>
45#include <sys/sysctl.h>
46#include <sys/systm.h>
47#include <sys/module.h>
48#include <sys/bus.h>
49#include <machine/bus.h>
50
51#include <net/bpf.h>
52#include <net/ethernet.h>
53#include <net/if.h>
54#include <net/if_arp.h>
55#include <net/if_vlan_var.h>
56
57#include <dev/firewire/firewire.h>
58#include <dev/firewire/firewirereg.h>
59#include <dev/firewire/if_fwevar.h>
60
61#define FWEDEBUG	if (fwedebug) if_printf
62#define TX_MAX_QUEUE	(FWMAXQUEUE - 1)
63
64/* network interface */
65static void fwe_start (struct ifnet *);
66static int fwe_ioctl (struct ifnet *, u_long, caddr_t);
67static void fwe_init (void *);
68
69static void fwe_output_callback (struct fw_xfer *);
70static void fwe_as_output (struct fwe_softc *, struct ifnet *);
71static void fwe_as_input (struct fw_xferq *);
72
73static int fwedebug = 0;
74static int stream_ch = 1;
75static int tx_speed = 2;
76static int rx_queue_len = FWMAXQUEUE;
77
78MALLOC_DEFINE(M_FWE, "if_fwe", "Ethernet over FireWire interface");
79SYSCTL_INT(_debug, OID_AUTO, if_fwe_debug, CTLFLAG_RW, &fwedebug, 0, "");
80SYSCTL_DECL(_hw_firewire);
81SYSCTL_NODE(_hw_firewire, OID_AUTO, fwe, CTLFLAG_RD, 0,
82	"Ethernet emulation subsystem");
83SYSCTL_INT(_hw_firewire_fwe, OID_AUTO, stream_ch, CTLFLAG_RW, &stream_ch, 0,
84	"Stream channel to use");
85SYSCTL_INT(_hw_firewire_fwe, OID_AUTO, tx_speed, CTLFLAG_RW, &tx_speed, 0,
86	"Transmission speed");
87SYSCTL_INT(_hw_firewire_fwe, OID_AUTO, rx_queue_len, CTLFLAG_RW, &rx_queue_len,
88	0, "Length of the receive queue");
89
90TUNABLE_INT("hw.firewire.fwe.stream_ch", &stream_ch);
91TUNABLE_INT("hw.firewire.fwe.tx_speed", &tx_speed);
92TUNABLE_INT("hw.firewire.fwe.rx_queue_len", &rx_queue_len);
93
94#ifdef DEVICE_POLLING
95#define FWE_POLL_REGISTER(func, fwe, ifp)			\
96	if (ether_poll_register(func, ifp)) {			\
97		struct firewire_comm *fc = (fwe)->fd.fc;	\
98		fc->set_intr(fc, 0);				\
99	}
100
101#define FWE_POLL_DEREGISTER(fwe, ifp)				\
102	do {							\
103		struct firewire_comm *fc = (fwe)->fd.fc;	\
104		ether_poll_deregister(ifp);			\
105		fc->set_intr(fc, 1);				\
106	} while(0)						\
107
108static poll_handler_t fwe_poll;
109
110static void
111fwe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
112{
113	struct fwe_softc *fwe;
114	struct firewire_comm *fc;
115
116	fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
117	fc = fwe->fd.fc;
118	if (cmd == POLL_DEREGISTER) {
119		/* enable interrupts */
120		fc->set_intr(fc, 1);
121		return;
122	}
123	fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count);
124}
125#else
126#define FWE_POLL_REGISTER(func, fwe, ifp)
127#define FWE_POLL_DEREGISTER(fwe, ifp)
128#endif
129static void
130fwe_identify(driver_t *driver, device_t parent)
131{
132	BUS_ADD_CHILD(parent, 0, "fwe", device_get_unit(parent));
133}
134
135static int
136fwe_probe(device_t dev)
137{
138	device_t pa;
139
140	pa = device_get_parent(dev);
141	if(device_get_unit(dev) != device_get_unit(pa)){
142		return(ENXIO);
143	}
144
145	device_set_desc(dev, "Ethernet over FireWire");
146	return (0);
147}
148
149static int
150fwe_attach(device_t dev)
151{
152	struct fwe_softc *fwe;
153	struct ifnet *ifp;
154	int unit, s;
155	u_char *eaddr;
156	struct fw_eui64 *eui;
157
158	fwe = ((struct fwe_softc *)device_get_softc(dev));
159	unit = device_get_unit(dev);
160
161	bzero(fwe, sizeof(struct fwe_softc));
162	/* XXX */
163	fwe->stream_ch = stream_ch;
164	fwe->dma_ch = -1;
165
166	fwe->fd.fc = device_get_ivars(dev);
167	fwe->fd.dev = dev;
168	fwe->fd.post_explore = NULL;
169	fwe->eth_softc.fwe = fwe;
170
171	fwe->pkt_hdr.mode.stream.tcode = FWTCODE_STREAM;
172	fwe->pkt_hdr.mode.stream.sy = 0;
173	fwe->pkt_hdr.mode.stream.chtag = fwe->stream_ch;
174
175	/* generate fake MAC address: first and last 3bytes from eui64 */
176#define LOCAL (0x02)
177#define GROUP (0x01)
178	eaddr = &fwe->eth_softc.arpcom.ac_enaddr[0];
179
180	eui = &fwe->fd.fc->eui;
181	eaddr[0] = (FW_EUI64_BYTE(eui, 0) | LOCAL) & ~GROUP;
182	eaddr[1] = FW_EUI64_BYTE(eui, 1);
183	eaddr[2] = FW_EUI64_BYTE(eui, 2);
184	eaddr[3] = FW_EUI64_BYTE(eui, 5);
185	eaddr[4] = FW_EUI64_BYTE(eui, 6);
186	eaddr[5] = FW_EUI64_BYTE(eui, 7);
187	printf("if_fwe%d: Fake Ethernet address: "
188		"%02x:%02x:%02x:%02x:%02x:%02x\n", unit,
189		eaddr[0], eaddr[1], eaddr[2], eaddr[3], eaddr[4], eaddr[5]);
190
191	/* fill the rest and attach interface */
192	ifp = &fwe->fwe_if;
193	ifp->if_softc = &fwe->eth_softc;
194
195#if __FreeBSD_version >= 501113
196	if_initname(ifp, device_get_name(dev), unit);
197#else
198	ifp->if_unit = unit;
199	ifp->if_name = "fwe";
200#endif
201	ifp->if_init = fwe_init;
202	ifp->if_output = ether_output;
203	ifp->if_start = fwe_start;
204	ifp->if_ioctl = fwe_ioctl;
205	ifp->if_mtu = ETHERMTU;
206	ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST);
207	ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE;
208
209	s = splimp();
210#if __FreeBSD_version >= 500000
211	ether_ifattach(ifp, eaddr);
212#else
213	ether_ifattach(ifp, 1);
214#endif
215	splx(s);
216
217        /* Tell the upper layer(s) we support long frames. */
218	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
219#if __FreeBSD_version >= 500000
220	ifp->if_capabilities |= IFCAP_VLAN_MTU;
221#endif
222
223
224	FWEDEBUG(ifp, "interface created\n");
225	return 0;
226}
227
228static void
229fwe_stop(struct fwe_softc *fwe)
230{
231	struct firewire_comm *fc;
232	struct fw_xferq *xferq;
233	struct ifnet *ifp = &fwe->fwe_if;
234	struct fw_xfer *xfer, *next;
235	int i;
236
237	fc = fwe->fd.fc;
238
239	FWE_POLL_DEREGISTER(fwe, ifp);
240
241	if (fwe->dma_ch >= 0) {
242		xferq = fc->ir[fwe->dma_ch];
243
244		if (xferq->flag & FWXFERQ_RUNNING)
245			fc->irx_disable(fc, fwe->dma_ch);
246		xferq->flag &=
247			~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | FWXFERQ_STREAM |
248			FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_CHTAGMASK);
249		xferq->hand =  NULL;
250
251		for (i = 0; i < xferq->bnchunk; i ++)
252			m_freem(xferq->bulkxfer[i].mbuf);
253		free(xferq->bulkxfer, M_FWE);
254
255		for (xfer = STAILQ_FIRST(&fwe->xferlist); xfer != NULL;
256					xfer = next) {
257			next = STAILQ_NEXT(xfer, link);
258			fw_xfer_free(xfer);
259		}
260		STAILQ_INIT(&fwe->xferlist);
261
262		xferq->bulkxfer =  NULL;
263		fwe->dma_ch = -1;
264	}
265
266	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
267}
268
269static int
270fwe_detach(device_t dev)
271{
272	struct fwe_softc *fwe;
273	int s;
274
275	fwe = (struct fwe_softc *)device_get_softc(dev);
276	s = splimp();
277
278	fwe_stop(fwe);
279#if __FreeBSD_version >= 500000
280	ether_ifdetach(&fwe->fwe_if);
281#else
282	ether_ifdetach(&fwe->fwe_if, 1);
283#endif
284
285	splx(s);
286	return 0;
287}
288
289static void
290fwe_init(void *arg)
291{
292	struct fwe_softc *fwe = ((struct fwe_eth_softc *)arg)->fwe;
293	struct firewire_comm *fc;
294	struct ifnet *ifp = &fwe->fwe_if;
295	struct fw_xferq *xferq;
296	struct fw_xfer *xfer;
297	struct mbuf *m;
298	int i;
299
300	FWEDEBUG(ifp, "initializing\n");
301
302	/* XXX keep promiscoud mode */
303	ifp->if_flags |= IFF_PROMISC;
304
305	fc = fwe->fd.fc;
306#define START 0
307	if (fwe->dma_ch < 0) {
308		for (i = START; i < fc->nisodma; i ++) {
309			xferq = fc->ir[i];
310			if ((xferq->flag & FWXFERQ_OPEN) == 0)
311				goto found;
312		}
313		printf("no free dma channel\n");
314		return;
315found:
316		fwe->dma_ch = i;
317		fwe->stream_ch = stream_ch;
318		fwe->pkt_hdr.mode.stream.chtag = fwe->stream_ch;
319		/* allocate DMA channel and init packet mode */
320		xferq->flag |= FWXFERQ_OPEN | FWXFERQ_EXTBUF |
321				FWXFERQ_HANDLER | FWXFERQ_STREAM;
322		xferq->flag &= ~0xff;
323		xferq->flag |= fwe->stream_ch & 0xff;
324		/* register fwe_input handler */
325		xferq->sc = (caddr_t) fwe;
326		xferq->hand = fwe_as_input;
327		xferq->bnchunk = rx_queue_len;
328		xferq->bnpacket = 1;
329		xferq->psize = MCLBYTES;
330		xferq->queued = 0;
331		xferq->buf = NULL;
332		xferq->bulkxfer = (struct fw_bulkxfer *) malloc(
333			sizeof(struct fw_bulkxfer) * xferq->bnchunk,
334							M_FWE, M_WAITOK);
335		if (xferq->bulkxfer == NULL) {
336			printf("if_fwe: malloc failed\n");
337			return;
338		}
339		STAILQ_INIT(&xferq->stvalid);
340		STAILQ_INIT(&xferq->stfree);
341		STAILQ_INIT(&xferq->stdma);
342		xferq->stproc = NULL;
343		for (i = 0; i < xferq->bnchunk; i ++) {
344			m =
345#if __FreeBSD_version >= 500000
346				m_getcl(M_TRYWAIT, MT_DATA, M_PKTHDR);
347#else
348				m_getcl(M_WAIT, MT_DATA, M_PKTHDR);
349#endif
350			xferq->bulkxfer[i].mbuf = m;
351			if (m != NULL) {
352				m->m_len = m->m_pkthdr.len = m->m_ext.ext_size;
353				STAILQ_INSERT_TAIL(&xferq->stfree,
354						&xferq->bulkxfer[i], link);
355			} else
356				printf("fwe_as_input: m_getcl failed\n");
357		}
358		STAILQ_INIT(&fwe->xferlist);
359		for (i = 0; i < TX_MAX_QUEUE; i++) {
360			xfer = fw_xfer_alloc(M_FWE);
361			if (xfer == NULL)
362				break;
363			xfer->send.spd = tx_speed;
364			xfer->fc = fwe->fd.fc;
365			xfer->retry_req = fw_asybusy;
366			xfer->sc = (caddr_t)fwe;
367			xfer->act.hand = fwe_output_callback;
368			STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link);
369		}
370	} else
371		xferq = fc->ir[fwe->dma_ch];
372
373
374	/* start dma */
375	if ((xferq->flag & FWXFERQ_RUNNING) == 0)
376		fc->irx_enable(fc, fwe->dma_ch);
377
378	ifp->if_flags |= IFF_RUNNING;
379	ifp->if_flags &= ~IFF_OACTIVE;
380
381	FWE_POLL_REGISTER(fwe_poll, fwe, ifp);
382#if 0
383	/* attempt to start output */
384	fwe_start(ifp);
385#endif
386}
387
388
389static int
390fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
391{
392	struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
393	struct ifstat *ifs = NULL;
394	int s, error, len;
395
396	switch (cmd) {
397		case SIOCSIFFLAGS:
398			s = splimp();
399			if (ifp->if_flags & IFF_UP) {
400				if (!(ifp->if_flags & IFF_RUNNING))
401					fwe_init(&fwe->eth_softc);
402			} else {
403				if (ifp->if_flags & IFF_RUNNING)
404					fwe_stop(fwe);
405			}
406			/* XXX keep promiscoud mode */
407			ifp->if_flags |= IFF_PROMISC;
408			splx(s);
409			break;
410		case SIOCADDMULTI:
411		case SIOCDELMULTI:
412			break;
413
414		case SIOCGIFSTATUS:
415			s = splimp();
416			ifs = (struct ifstat *)data;
417			len = strlen(ifs->ascii);
418			if (len < sizeof(ifs->ascii))
419				snprintf(ifs->ascii + len,
420					sizeof(ifs->ascii) - len,
421					"\tch %d dma %d\n",
422						fwe->stream_ch, fwe->dma_ch);
423			splx(s);
424			break;
425#if __FreeBSD_version >= 500000
426		default:
427#else
428		case SIOCSIFADDR:
429		case SIOCGIFADDR:
430		case SIOCSIFMTU:
431#endif
432			s = splimp();
433			error = ether_ioctl(ifp, cmd, data);
434			splx(s);
435			return (error);
436#if __FreeBSD_version < 500000
437		default:
438			return (EINVAL);
439#endif
440	}
441
442	return (0);
443}
444
445static void
446fwe_output_callback(struct fw_xfer *xfer)
447{
448	struct fwe_softc *fwe;
449	struct ifnet *ifp;
450	int s;
451
452	fwe = (struct fwe_softc *)xfer->sc;
453	ifp = &fwe->fwe_if;
454	/* XXX error check */
455	FWEDEBUG(ifp, "resp = %d\n", xfer->resp);
456	if (xfer->resp != 0)
457		ifp->if_oerrors ++;
458
459	m_freem(xfer->mbuf);
460	fw_xfer_unload(xfer);
461
462	s = splimp();
463	STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link);
464	splx(s);
465
466	/* for queue full */
467	if (ifp->if_snd.ifq_head != NULL)
468		fwe_start(ifp);
469}
470
471static void
472fwe_start(struct ifnet *ifp)
473{
474	struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
475	int s;
476
477	FWEDEBUG(ifp, "starting\n");
478
479	if (fwe->dma_ch < 0) {
480		struct mbuf	*m = NULL;
481
482		FWEDEBUG(ifp, "not ready\n");
483
484		s = splimp();
485		do {
486			IF_DEQUEUE(&ifp->if_snd, m);
487			if (m != NULL)
488				m_freem(m);
489			ifp->if_oerrors ++;
490		} while (m != NULL);
491		splx(s);
492
493		return;
494	}
495
496	s = splimp();
497	ifp->if_flags |= IFF_OACTIVE;
498
499	if (ifp->if_snd.ifq_len != 0)
500		fwe_as_output(fwe, ifp);
501
502	ifp->if_flags &= ~IFF_OACTIVE;
503	splx(s);
504}
505
506#define HDR_LEN 4
507#ifndef ETHER_ALIGN
508#define ETHER_ALIGN 2
509#endif
510/* Async. stream output */
511static void
512fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp)
513{
514	struct mbuf *m;
515	struct fw_xfer *xfer;
516	struct fw_xferq *xferq;
517	struct fw_pkt *fp;
518	int i = 0;
519
520	xfer = NULL;
521	xferq = fwe->fd.fc->atq;
522	while (xferq->queued < xferq->maxq - 1) {
523		xfer = STAILQ_FIRST(&fwe->xferlist);
524		if (xfer == NULL) {
525			printf("if_fwe: lack of xfer\n");
526			return;
527		}
528		IF_DEQUEUE(&ifp->if_snd, m);
529		if (m == NULL)
530			break;
531		STAILQ_REMOVE_HEAD(&fwe->xferlist, link);
532#if __FreeBSD_version >= 500000
533		BPF_MTAP(ifp, m);
534#else
535		if (ifp->if_bpf != NULL)
536			bpf_mtap(ifp, m);
537#endif
538
539		/* keep ip packet alignment for alpha */
540		M_PREPEND(m, ETHER_ALIGN, M_DONTWAIT);
541		fp = &xfer->send.hdr;
542		*(u_int32_t *)&xfer->send.hdr = *(int32_t *)&fwe->pkt_hdr;
543		fp->mode.stream.len = m->m_pkthdr.len;
544		xfer->mbuf = m;
545		xfer->send.pay_len = m->m_pkthdr.len;
546
547		if (fw_asyreq(fwe->fd.fc, -1, xfer) != 0) {
548			/* error */
549			ifp->if_oerrors ++;
550			/* XXX set error code */
551			fwe_output_callback(xfer);
552		} else {
553			ifp->if_opackets ++;
554			i++;
555		}
556	}
557#if 0
558	if (i > 1)
559		printf("%d queued\n", i);
560#endif
561	if (i > 0)
562		xferq->start(fwe->fd.fc);
563}
564
565/* Async. stream output */
566static void
567fwe_as_input(struct fw_xferq *xferq)
568{
569	struct mbuf *m, *m0;
570	struct ifnet *ifp;
571	struct fwe_softc *fwe;
572	struct fw_bulkxfer *sxfer;
573	struct fw_pkt *fp;
574	u_char *c;
575#if __FreeBSD_version < 500000
576	struct ether_header *eh;
577#endif
578
579	fwe = (struct fwe_softc *)xferq->sc;
580	ifp = &fwe->fwe_if;
581#if 0
582	FWE_POLL_REGISTER(fwe_poll, fwe, ifp);
583#endif
584	while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) {
585		STAILQ_REMOVE_HEAD(&xferq->stvalid, link);
586		fp = mtod(sxfer->mbuf, struct fw_pkt *);
587		if (fwe->fd.fc->irx_post != NULL)
588			fwe->fd.fc->irx_post(fwe->fd.fc, fp->mode.ld);
589		m = sxfer->mbuf;
590
591		/* insert new rbuf */
592		sxfer->mbuf = m0 = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
593		if (m0 != NULL) {
594			m0->m_len = m0->m_pkthdr.len = m0->m_ext.ext_size;
595			STAILQ_INSERT_TAIL(&xferq->stfree, sxfer, link);
596		} else
597			printf("fwe_as_input: m_getcl failed\n");
598
599		if (sxfer->resp != 0 || fp->mode.stream.len <
600		    ETHER_ALIGN + sizeof(struct ether_header)) {
601			m_freem(m);
602			ifp->if_ierrors ++;
603			continue;
604		}
605
606		m->m_data += HDR_LEN + ETHER_ALIGN;
607		c = mtod(m, char *);
608#if __FreeBSD_version < 500000
609		eh = (struct ether_header *)c;
610		m->m_data += sizeof(struct ether_header);
611#endif
612		m->m_len = m->m_pkthdr.len =
613				fp->mode.stream.len - ETHER_ALIGN;
614		m->m_pkthdr.rcvif = ifp;
615#if 0
616		FWEDEBUG(ifp, "%02x %02x %02x %02x %02x %02x\n"
617			 "%02x %02x %02x %02x %02x %02x\n"
618			 "%02x %02x %02x %02x\n"
619			 "%02x %02x %02x %02x\n"
620			 "%02x %02x %02x %02x\n"
621			 "%02x %02x %02x %02x\n",
622			 c[0], c[1], c[2], c[3], c[4], c[5],
623			 c[6], c[7], c[8], c[9], c[10], c[11],
624			 c[12], c[13], c[14], c[15],
625			 c[16], c[17], c[18], c[19],
626			 c[20], c[21], c[22], c[23],
627			 c[20], c[21], c[22], c[23]
628		 );
629#endif
630#if __FreeBSD_version >= 500000
631		(*ifp->if_input)(ifp, m);
632#else
633		ether_input(ifp, eh, m);
634#endif
635		ifp->if_ipackets ++;
636	}
637	if (STAILQ_FIRST(&xferq->stfree) != NULL)
638		fwe->fd.fc->irx_enable(fwe->fd.fc, fwe->dma_ch);
639}
640
641
642static devclass_t fwe_devclass;
643
644static device_method_t fwe_methods[] = {
645	/* device interface */
646	DEVMETHOD(device_identify,	fwe_identify),
647	DEVMETHOD(device_probe,		fwe_probe),
648	DEVMETHOD(device_attach,	fwe_attach),
649	DEVMETHOD(device_detach,	fwe_detach),
650	{ 0, 0 }
651};
652
653static driver_t fwe_driver = {
654        "fwe",
655	fwe_methods,
656	sizeof(struct fwe_softc),
657};
658
659
660DRIVER_MODULE(fwe, firewire, fwe_driver, fwe_devclass, 0, 0);
661MODULE_VERSION(fwe, 1);
662MODULE_DEPEND(fwe, firewire, 1, 1, 1);
663