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