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