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