FreeBSD kernel usb device Code
if_kue.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-4-Clause
3 *
4 * Copyright (c) 1997, 1998, 1999, 2000
5 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Bill Paul.
18 * 4. Neither the name of the author nor the names of any co-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 Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD$");
37
38/*
39 * Kawasaki LSI KL5KUSB101B USB to ethernet adapter driver.
40 *
41 * Written by Bill Paul <wpaul@ee.columbia.edu>
42 * Electrical Engineering Department
43 * Columbia University, New York City
44 */
45
46/*
47 * The KLSI USB to ethernet adapter chip contains an USB serial interface,
48 * ethernet MAC and embedded microcontroller (called the QT Engine).
49 * The chip must have firmware loaded into it before it will operate.
50 * Packets are passed between the chip and host via bulk transfers.
51 * There is an interrupt endpoint mentioned in the software spec, however
52 * it's currently unused. This device is 10Mbps half-duplex only, hence
53 * there is no media selection logic. The MAC supports a 128 entry
54 * multicast filter, though the exact size of the filter can depend
55 * on the firmware. Curiously, while the software spec describes various
56 * ethernet statistics counters, my sample adapter and firmware combination
57 * claims not to support any statistics counters at all.
58 *
59 * Note that once we load the firmware in the device, we have to be
60 * careful not to load it again: if you restart your computer but
61 * leave the adapter attached to the USB controller, it may remain
62 * powered on and retain its firmware. In this case, we don't need
63 * to load the firmware a second time.
64 *
65 * Special thanks to Rob Furr for providing an ADS Technologies
66 * adapter for development and testing. No monkeys were harmed during
67 * the development of this driver.
68 */
69
70#include <sys/stdint.h>
71#include <sys/stddef.h>
72#include <sys/param.h>
73#include <sys/queue.h>
74#include <sys/types.h>
75#include <sys/systm.h>
76#include <sys/socket.h>
77#include <sys/kernel.h>
78#include <sys/bus.h>
79#include <sys/module.h>
80#include <sys/lock.h>
81#include <sys/mutex.h>
82#include <sys/condvar.h>
83#include <sys/sysctl.h>
84#include <sys/sx.h>
85#include <sys/unistd.h>
86#include <sys/callout.h>
87#include <sys/malloc.h>
88#include <sys/priv.h>
89
90#include <net/if.h>
91#include <net/if_var.h>
92
93#include <dev/usb/usb.h>
94#include <dev/usb/usbdi.h>
95#include <dev/usb/usbdi_util.h>
96#include "usbdevs.h"
97
98#define USB_DEBUG_VAR kue_debug
99#include <dev/usb/usb_debug.h>
100#include <dev/usb/usb_process.h>
101
104#include <dev/usb/net/if_kuefw.h>
105
106/*
107 * Various supported device vendors/products.
108 */
109static const STRUCT_USB_HOST_ID kue_devs[] = {
110#define KUE_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
111 KUE_DEV(3COM, 3C19250),
112 KUE_DEV(3COM, 3C460),
113 KUE_DEV(ABOCOM, URE450),
114 KUE_DEV(ADS, UBS10BT),
115 KUE_DEV(ADS, UBS10BTX),
116 KUE_DEV(AOX, USB101),
117 KUE_DEV(ASANTE, EA),
118 KUE_DEV(ATEN, DSB650C),
119 KUE_DEV(ATEN, UC10T),
120 KUE_DEV(COREGA, ETHER_USB_T),
121 KUE_DEV(DLINK, DSB650C),
122 KUE_DEV(ENTREGA, E45),
123 KUE_DEV(ENTREGA, XX1),
124 KUE_DEV(ENTREGA, XX2),
125 KUE_DEV(IODATA, USBETT),
126 KUE_DEV(JATON, EDA),
127 KUE_DEV(KINGSTON, XX1),
128 KUE_DEV(KLSI, DUH3E10BT),
129 KUE_DEV(KLSI, DUH3E10BTN),
130 KUE_DEV(LINKSYS, USB10T),
131 KUE_DEV(MOBILITY, EA),
132 KUE_DEV(NETGEAR, EA101),
133 KUE_DEV(NETGEAR, EA101X),
134 KUE_DEV(PERACOM, ENET),
135 KUE_DEV(PERACOM, ENET2),
136 KUE_DEV(PERACOM, ENET3),
137 KUE_DEV(PORTGEAR, EA8),
138 KUE_DEV(PORTGEAR, EA9),
139 KUE_DEV(PORTSMITH, EEA),
140 KUE_DEV(SHARK, PA),
141 KUE_DEV(SILICOM, GPE),
142 KUE_DEV(SILICOM, U2E),
143 KUE_DEV(SMC, 2102USB),
144#undef KUE_DEV
145};
146
147/* prototypes */
148
149static device_probe_t kue_probe;
150static device_attach_t kue_attach;
151static device_detach_t kue_detach;
152
155
162
163static int kue_do_request(struct kue_softc *,
164 struct usb_device_request *, void *);
165static int kue_setword(struct kue_softc *, uint8_t, uint16_t);
166static int kue_ctl(struct kue_softc *, uint8_t, uint8_t, uint16_t,
167 void *, int);
168static int kue_load_fw(struct kue_softc *);
169static void kue_reset(struct kue_softc *);
170
171#ifdef USB_DEBUG
172static int kue_debug = 0;
173
174static SYSCTL_NODE(_hw_usb, OID_AUTO, kue, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
175 "USB kue");
176SYSCTL_INT(_hw_usb_kue, OID_AUTO, debug, CTLFLAG_RWTUN, &kue_debug, 0,
177 "Debug level");
178#endif
179
180static const struct usb_config kue_config[KUE_N_TRANSFER] = {
181 [KUE_BULK_DT_WR] = {
182 .type = UE_BULK,
183 .endpoint = UE_ADDR_ANY,
184 .direction = UE_DIR_OUT,
185 .bufsize = (MCLBYTES + 2 + 64),
186 .flags = {.pipe_bof = 1,},
187 .callback = kue_bulk_write_callback,
188 .timeout = 10000, /* 10 seconds */
189 },
190
191 [KUE_BULK_DT_RD] = {
192 .type = UE_BULK,
193 .endpoint = UE_ADDR_ANY,
194 .direction = UE_DIR_IN,
195 .bufsize = (MCLBYTES + 2),
196 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
197 .callback = kue_bulk_read_callback,
198 .timeout = 0, /* no timeout */
199 },
200};
201
202static device_method_t kue_methods[] = {
203 /* Device interface */
204 DEVMETHOD(device_probe, kue_probe),
205 DEVMETHOD(device_attach, kue_attach),
206 DEVMETHOD(device_detach, kue_detach),
207
208 DEVMETHOD_END
209};
210
211static driver_t kue_driver = {
212 .name = "kue",
213 .methods = kue_methods,
214 .size = sizeof(struct kue_softc),
215};
216
217static devclass_t kue_devclass;
218
220MODULE_DEPEND(kue, uether, 1, 1, 1);
221MODULE_DEPEND(kue, usb, 1, 1, 1);
222MODULE_DEPEND(kue, ether, 1, 1, 1);
225
226static const struct usb_ether_methods kue_ue_methods = {
228 .ue_start = kue_start,
229 .ue_init = kue_init,
230 .ue_stop = kue_stop,
231 .ue_setmulti = kue_setmulti,
232 .ue_setpromisc = kue_setpromisc,
233};
234
235/*
236 * We have a custom do_request function which is almost like the
237 * regular do_request function, except it has a much longer timeout.
238 * Why? Because we need to make requests over the control endpoint
239 * to download the firmware to the device, which can take longer
240 * than the default timeout.
241 */
242static int
244 void *data)
245{
246 usb_error_t err;
247
248 err = uether_do_request(&sc->sc_ue, req, data, 60000);
249
250 return (err);
251}
252
253static int
254kue_setword(struct kue_softc *sc, uint8_t breq, uint16_t word)
255{
256 struct usb_device_request req;
257
258 req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
259 req.bRequest = breq;
260 USETW(req.wValue, word);
261 USETW(req.wIndex, 0);
262 USETW(req.wLength, 0);
263
264 return (kue_do_request(sc, &req, NULL));
265}
266
267static int
268kue_ctl(struct kue_softc *sc, uint8_t rw, uint8_t breq,
269 uint16_t val, void *data, int len)
270{
271 struct usb_device_request req;
272
273 if (rw == KUE_CTL_WRITE)
274 req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
275 else
276 req.bmRequestType = UT_READ_VENDOR_DEVICE;
277
278 req.bRequest = breq;
279 USETW(req.wValue, val);
280 USETW(req.wIndex, 0);
281 USETW(req.wLength, len);
282
283 return (kue_do_request(sc, &req, data));
284}
285
286static int
288{
289 struct usb_device_descriptor *dd;
290 uint16_t hwrev;
291 usb_error_t err;
292
294 hwrev = UGETW(dd->bcdDevice);
295
296 /*
297 * First, check if we even need to load the firmware.
298 * If the device was still attached when the system was
299 * rebooted, it may already have firmware loaded in it.
300 * If this is the case, we don't need to do it again.
301 * And in fact, if we try to load it again, we'll hang,
302 * so we have to avoid this condition if we don't want
303 * to look stupid.
304 *
305 * We can test this quickly by checking the bcdRevision
306 * code. The NIC will return a different revision code if
307 * it's probed while the firmware is still loaded and
308 * running.
309 */
310 if (hwrev == 0x0202)
311 return(0);
312
313 /* Load code segment */
315 0, kue_code_seg, sizeof(kue_code_seg));
316 if (err) {
317 device_printf(sc->sc_ue.ue_dev, "failed to load code segment: %s\n",
318 usbd_errstr(err));
319 return(ENXIO);
320 }
321
322 /* Load fixup segment */
324 0, kue_fix_seg, sizeof(kue_fix_seg));
325 if (err) {
326 device_printf(sc->sc_ue.ue_dev, "failed to load fixup segment: %s\n",
327 usbd_errstr(err));
328 return(ENXIO);
329 }
330
331 /* Send trigger command. */
333 0, kue_trig_seg, sizeof(kue_trig_seg));
334 if (err) {
335 device_printf(sc->sc_ue.ue_dev, "failed to load trigger segment: %s\n",
336 usbd_errstr(err));
337 return(ENXIO);
338 }
339
340 return (0);
341}
342
343static void
345{
346 struct kue_softc *sc = uether_getsc(ue);
347 struct ifnet *ifp = uether_getifp(ue);
348
349 KUE_LOCK_ASSERT(sc, MA_OWNED);
350
351 if (ifp->if_flags & IFF_PROMISC)
353 else
354 sc->sc_rxfilt &= ~KUE_RXFILT_PROMISC;
355
357}
358
359static u_int
360kue_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
361{
362 struct kue_softc *sc = arg;
363
364 if (cnt >= KUE_MCFILTCNT(sc))
365 return (1);
366
367 memcpy(KUE_MCFILT(sc, cnt), LLADDR(sdl), ETHER_ADDR_LEN);
368
369 return (1);
370}
371
372static void
374{
375 struct kue_softc *sc = uether_getsc(ue);
376 struct ifnet *ifp = uether_getifp(ue);
377 int i;
378
379 KUE_LOCK_ASSERT(sc, MA_OWNED);
380
381 if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
383 sc->sc_rxfilt &= ~KUE_RXFILT_MULTICAST;
385 return;
386 }
387
388 sc->sc_rxfilt &= ~KUE_RXFILT_ALLMULTI;
389
390 i = if_foreach_llmaddr(ifp, kue_copy_maddr, sc);
391
392 if (i >= KUE_MCFILTCNT(sc))
394 else {
397 i, sc->sc_mcfilters, i * ETHER_ADDR_LEN);
398 }
399
401}
402
403/*
404 * Issue a SET_CONFIGURATION command to reset the MAC. This should be
405 * done after the firmware is loaded into the adapter in order to
406 * bring it into proper operation.
407 */
408static void
410{
411 struct usb_config_descriptor *cd;
412 usb_error_t err;
413
415
416 err = usbd_req_set_config(sc->sc_ue.ue_udev, &sc->sc_mtx,
418 if (err)
419 DPRINTF("reset failed (ignored)\n");
420
421 /* wait a little while for the chip to get its brains in order */
422 uether_pause(&sc->sc_ue, hz / 100);
423}
424
425static void
427{
428 struct kue_softc *sc = uether_getsc(ue);
429 int error;
430
431 /* load the firmware into the NIC */
432 error = kue_load_fw(sc);
433 if (error) {
434 device_printf(sc->sc_ue.ue_dev, "could not load firmware\n");
435 /* ignore the error */
436 }
437
438 /* reset the adapter */
439 kue_reset(sc);
440
441 /* read ethernet descriptor */
443 0, &sc->sc_desc, sizeof(sc->sc_desc));
444
445 /* copy in ethernet address */
446 memcpy(ue->ue_eaddr, sc->sc_desc.kue_macaddr, sizeof(ue->ue_eaddr));
447}
448
449/*
450 * Probe for a KLSI chip.
451 */
452static int
453kue_probe(device_t dev)
454{
455 struct usb_attach_arg *uaa = device_get_ivars(dev);
456
457 if (uaa->usb_mode != USB_MODE_HOST)
458 return (ENXIO);
459 if (uaa->info.bConfigIndex != KUE_CONFIG_IDX)
460 return (ENXIO);
461 if (uaa->info.bIfaceIndex != KUE_IFACE_IDX)
462 return (ENXIO);
463
464 return (usbd_lookup_id_by_uaa(kue_devs, sizeof(kue_devs), uaa));
465}
466
467/*
468 * Attach the interface. Allocate softc structures, do
469 * setup and ethernet/BPF attach.
470 */
471static int
472kue_attach(device_t dev)
473{
474 struct usb_attach_arg *uaa = device_get_ivars(dev);
475 struct kue_softc *sc = device_get_softc(dev);
476 struct usb_ether *ue = &sc->sc_ue;
477 uint8_t iface_index;
478 int error;
479
481 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
482
483 iface_index = KUE_IFACE_IDX;
484 error = usbd_transfer_setup(uaa->device, &iface_index,
485 sc->sc_xfer, kue_config, KUE_N_TRANSFER, sc, &sc->sc_mtx);
486 if (error) {
487 device_printf(dev, "allocating USB transfers failed\n");
488 goto detach;
489 }
490
491 sc->sc_mcfilters = malloc(KUE_MCFILTCNT(sc) * ETHER_ADDR_LEN,
492 M_USBDEV, M_WAITOK);
493 if (sc->sc_mcfilters == NULL) {
494 device_printf(dev, "failed allocating USB memory\n");
495 goto detach;
496 }
497
498 ue->ue_sc = sc;
499 ue->ue_dev = dev;
500 ue->ue_udev = uaa->device;
501 ue->ue_mtx = &sc->sc_mtx;
503
505 if (error) {
506 device_printf(dev, "could not attach interface\n");
507 goto detach;
508 }
509 return (0); /* success */
510
511detach:
513 return (ENXIO); /* failure */
514}
515
516static int
517kue_detach(device_t dev)
518{
519 struct kue_softc *sc = device_get_softc(dev);
520 struct usb_ether *ue = &sc->sc_ue;
521
523 uether_ifdetach(ue);
524 mtx_destroy(&sc->sc_mtx);
525 free(sc->sc_mcfilters, M_USBDEV);
526
527 return (0);
528}
529
530/*
531 * A frame has been uploaded: pass the resulting mbuf chain up to
532 * the higher level protocols.
533 */
534static void
536{
537 struct kue_softc *sc = usbd_xfer_softc(xfer);
538 struct usb_ether *ue = &sc->sc_ue;
539 struct ifnet *ifp = uether_getifp(ue);
540 struct usb_page_cache *pc;
541 uint8_t buf[2];
542 int len;
543 int actlen;
544
545 usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
546
547 switch (USB_GET_STATE(xfer)) {
549
550 if (actlen <= (int)(2 + sizeof(struct ether_header))) {
551 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
552 goto tr_setup;
553 }
554 pc = usbd_xfer_get_frame(xfer, 0);
555 usbd_copy_out(pc, 0, buf, 2);
556 actlen -= 2;
557 len = buf[0] | (buf[1] << 8);
558 len = min(actlen, len);
559
560 uether_rxbuf(ue, pc, 2, len);
561 /* FALLTHROUGH */
562 case USB_ST_SETUP:
563tr_setup:
566 uether_rxflush(ue);
567 return;
568
569 default: /* Error */
570 DPRINTF("bulk read error, %s\n",
572
573 if (error != USB_ERR_CANCELLED) {
574 /* try to clear stall first */
576 goto tr_setup;
577 }
578 return;
579 }
580}
581
582static void
584{
585 struct kue_softc *sc = usbd_xfer_softc(xfer);
586 struct ifnet *ifp = uether_getifp(&sc->sc_ue);
587 struct usb_page_cache *pc;
588 struct mbuf *m;
589 int total_len;
590 int temp_len;
591 uint8_t buf[2];
592
593 switch (USB_GET_STATE(xfer)) {
595 DPRINTFN(11, "transfer complete\n");
596 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
597
598 /* FALLTHROUGH */
599 case USB_ST_SETUP:
600tr_setup:
601 IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
602
603 if (m == NULL)
604 return;
605 if (m->m_pkthdr.len > MCLBYTES)
606 m->m_pkthdr.len = MCLBYTES;
607 temp_len = (m->m_pkthdr.len + 2);
608 total_len = (temp_len + (64 - (temp_len % 64)));
609
610 /* the first two bytes are the frame length */
611
612 buf[0] = (uint8_t)(m->m_pkthdr.len);
613 buf[1] = (uint8_t)(m->m_pkthdr.len >> 8);
614
615 pc = usbd_xfer_get_frame(xfer, 0);
616 usbd_copy_in(pc, 0, buf, 2);
617 usbd_m_copy_in(pc, 2, m, 0, m->m_pkthdr.len);
618
619 usbd_frame_zero(pc, temp_len, total_len - temp_len);
620 usbd_xfer_set_frame_len(xfer, 0, total_len);
621
622 /*
623 * if there's a BPF listener, bounce a copy
624 * of this frame to him:
625 */
626 BPF_MTAP(ifp, m);
627
628 m_freem(m);
629
631
632 return;
633
634 default: /* Error */
635 DPRINTFN(11, "transfer error, %s\n",
637
638 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
639
640 if (error != USB_ERR_CANCELLED) {
641 /* try to clear stall first */
643 goto tr_setup;
644 }
645 return;
646 }
647}
648
649static void
651{
652 struct kue_softc *sc = uether_getsc(ue);
653
654 /*
655 * start the USB transfers, if not already started:
656 */
659}
660
661static void
663{
664 struct kue_softc *sc = uether_getsc(ue);
665 struct ifnet *ifp = uether_getifp(ue);
666
667 KUE_LOCK_ASSERT(sc, MA_OWNED);
668
669 /* set MAC address */
671 0, IF_LLADDR(ifp), ETHER_ADDR_LEN);
672
673 /* I'm not sure how to tune these. */
674#if 0
675 /*
676 * Leave this one alone for now; setting it
677 * wrong causes lockups on some machines/controllers.
678 */
680#endif
682
683 /* load the multicast filter */
684 kue_setpromisc(ue);
685
687
688 ifp->if_drv_flags |= IFF_DRV_RUNNING;
689 kue_start(ue);
690}
691
692static void
694{
695 struct kue_softc *sc = uether_getsc(ue);
696 struct ifnet *ifp = uether_getifp(ue);
697
698 KUE_LOCK_ASSERT(sc, MA_OWNED);
699
700 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
701
702 /*
703 * stop all the transfers, if not already stopped:
704 */
707}
static int debug
Definition: cfumass.c:73
static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB DWC OTG")
SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN, &dwc_otg_phy_type, 0, "DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+")
uint16_t len
Definition: ehci.h:41
static uether_fn_t kue_setpromisc
Definition: if_kue.c:161
static const struct usb_ether_methods kue_ue_methods
Definition: if_kue.c:226
static int kue_load_fw(struct kue_softc *)
Definition: if_kue.c:287
MODULE_DEPEND(kue, uether, 1, 1, 1)
static int kue_ctl(struct kue_softc *, uint8_t, uint8_t, uint16_t, void *, int)
Definition: if_kue.c:268
static uether_fn_t kue_attach_post
Definition: if_kue.c:156
static uether_fn_t kue_start
Definition: if_kue.c:159
static device_method_t kue_methods[]
Definition: if_kue.c:202
MODULE_VERSION(kue, 1)
static const STRUCT_USB_HOST_ID kue_devs[]
Definition: if_kue.c:109
static driver_t kue_driver
Definition: if_kue.c:211
static device_attach_t kue_attach
Definition: if_kue.c:150
static device_detach_t kue_detach
Definition: if_kue.c:151
static const struct usb_config kue_config[KUE_N_TRANSFER]
Definition: if_kue.c:180
static usb_callback_t kue_bulk_read_callback
Definition: if_kue.c:153
static uether_fn_t kue_stop
Definition: if_kue.c:158
static void kue_reset(struct kue_softc *)
Definition: if_kue.c:409
__FBSDID("$FreeBSD$")
static uether_fn_t kue_setmulti
Definition: if_kue.c:160
static uether_fn_t kue_init
Definition: if_kue.c:157
static devclass_t kue_devclass
Definition: if_kue.c:217
static int kue_setword(struct kue_softc *, uint8_t, uint16_t)
Definition: if_kue.c:254
DRIVER_MODULE(kue, uhub, kue_driver, kue_devclass, NULL, 0)
static usb_callback_t kue_bulk_write_callback
Definition: if_kue.c:154
#define KUE_DEV(v, p)
static device_probe_t kue_probe
Definition: if_kue.c:149
static int kue_do_request(struct kue_softc *, struct usb_device_request *, void *)
Definition: if_kue.c:243
USB_PNP_HOST_INFO(kue_devs)
static u_int kue_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
Definition: if_kue.c:360
static unsigned char kue_code_seg[]
Definition: if_kuefw.h:90
static unsigned char kue_fix_seg[]
Definition: if_kuefw.h:582
static unsigned char kue_trig_seg[]
Definition: if_kuefw.h:685
#define KUE_CONFIG_IDX
Definition: if_kuereg.h:117
#define KUE_MCFILT(x, y)
Definition: if_kuereg.h:72
#define KUE_CMD_GET_ETHER_DESCRIPTOR
Definition: if_kuereg.h:45
@ KUE_BULK_DT_WR
Definition: if_kuereg.h:123
@ KUE_BULK_DT_RD
Definition: if_kuereg.h:124
@ KUE_N_TRANSFER
Definition: if_kuereg.h:125
#define KUE_CMD_SET_URB_SIZE
Definition: if_kuereg.h:53
#define KUE_CTL_WRITE
Definition: if_kuereg.h:115
#define KUE_IFACE_IDX
Definition: if_kuereg.h:118
#define KUE_CMD_SET_PKT_FILTER
Definition: if_kuereg.h:47
#define KUE_MCFILTCNT(x)
Definition: if_kuereg.h:71
#define KUE_CMD_SET_MAC
Definition: if_kuereg.h:51
#define KUE_CMD_SEND_SCAN
Definition: if_kuereg.h:56
#define KUE_RXFILT_PROMISC
Definition: if_kuereg.h:105
#define KUE_CTL_READ
Definition: if_kuereg.h:114
#define KUE_LOCK_ASSERT(_sc, t)
Definition: if_kuereg.h:143
#define KUE_CMD_SET_MCAST_FILTERS
Definition: if_kuereg.h:46
#define KUE_CMD_SET_SOFS
Definition: if_kuereg.h:54
#define KUE_RXFILT_MULTICAST
Definition: if_kuereg.h:109
#define KUE_RXFILT_ALLMULTI
Definition: if_kuereg.h:106
uint32_t val
Definition: if_rum.c:284
struct @109 error
uint16_t data
device_t dev
uint8_t kue_macaddr[ETHER_ADDR_LEN]
Definition: if_kuereg.h:62
struct usb_ether sc_ue
Definition: if_kuereg.h:129
struct kue_ether_desc sc_desc
Definition: if_kuereg.h:131
uint16_t sc_rxfilt
Definition: if_kuereg.h:138
struct usb_xfer * sc_xfer[KUE_N_TRANSFER]
Definition: if_kuereg.h:132
struct mtx sc_mtx
Definition: if_kuereg.h:130
uint8_t * sc_mcfilters
Definition: if_kuereg.h:133
enum usb_hc_mode usb_mode
Definition: usbdi.h:432
struct usbd_lookup_info info
Definition: usbdi.h:426
struct usb_device * device
Definition: usbdi.h:430
uByte bConfigurationValue
Definition: usb.h:390
struct usb_xfer_flags flags
Definition: usbdi.h:235
uint8_t type
Definition: usbdi.h:238
uether_fn_t * ue_attach_post
Definition: usb_ethernet.h:58
const struct usb_ether_methods * ue_methods
Definition: usb_ethernet.h:81
struct usb_device * ue_udev
Definition: usb_ethernet.h:84
uint8_t ue_eaddr[ETHER_ADDR_LEN]
Definition: usb_ethernet.h:101
device_t ue_dev
Definition: usb_ethernet.h:85
struct mtx * ue_mtx
Definition: usb_ethernet.h:80
void * ue_sc
Definition: usb_ethernet.h:83
uint8_t pipe_bof
Definition: usbdi.h:200
uint8_t bIfaceIndex
Definition: usbdi.h:417
uint8_t bConfigIndex
Definition: usbdi.h:419
#define DPRINTF(...)
Definition: umass.c:179
#define UE_ADDR_ANY
Definition: usb.h:537
#define UE_BULK
Definition: usb.h:543
#define UT_WRITE_VENDOR_DEVICE
Definition: usb.h:184
#define UT_READ_VENDOR_DEVICE
Definition: usb.h:180
#define UE_DIR_IN
Definition: usb.h:531
#define UE_DIR_OUT
Definition: usb.h:532
@ USB_MODE_HOST
Definition: usb.h:778
void usbd_frame_zero(struct usb_page_cache *cache, usb_frlength_t offset, usb_frlength_t len)
Definition: usb_busdma.c:339
void usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset, const void *ptr, usb_frlength_t len)
Definition: usb_busdma.c:166
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, void *ptr, usb_frlength_t len)
Definition: usb_busdma.c:283
struct usb_config_descriptor * usbd_get_config_descriptor(struct usb_device *udev)
Definition: usb_device.c:2616
struct usb_device_descriptor * usbd_get_device_descriptor(struct usb_device *udev)
Definition: usb_device.c:2608
#define USETW(w, v)
Definition: usb_endian.h:77
#define UGETW(w)
Definition: usb_endian.h:53
const char * usbd_errstr(usb_error_t err)
Definition: usb_error.c:93
void uether_rxflush(struct usb_ether *ue)
Definition: usb_ethernet.c:646
void uether_ifdetach(struct usb_ether *ue)
Definition: usb_ethernet.c:302
void * uether_getsc(struct usb_ether *ue)
Definition: usb_ethernet.c:148
int uether_rxbuf(struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset, unsigned int len)
Definition: usb_ethernet.c:616
struct ifnet * uether_getifp(struct usb_ether *ue)
Definition: usb_ethernet.c:136
uint8_t uether_pause(struct usb_ether *ue, unsigned int _ticks)
Definition: usb_ethernet.c:94
int uether_ifattach(struct usb_ether *ue)
Definition: usb_ethernet.c:164
#define uether_do_request(ue, req, data, timo)
Definition: usb_ethernet.h:104
void() uether_fn_t(struct usb_ether *)
Definition: usb_ethernet.h:55
const void * req
Definition: usb_if.m:51
INTERFACE usb
Definition: usb_if.m:35
int usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, struct usb_attach_arg *uaa)
Definition: usb_lookup.c:143
usb_error_t usbd_req_set_config(struct usb_device *udev, struct mtx *mtx, uint8_t conf)
Definition: usb_request.c:1920
void usbd_transfer_submit(struct usb_xfer *xfer)
void usbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup)
void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len)
struct usb_page_cache * usbd_xfer_get_frame(struct usb_xfer *xfer, usb_frcount_t frindex)
usb_error_t usbd_transfer_setup(struct usb_device *udev, const uint8_t *ifaces, struct usb_xfer **ppxfer, const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx)
Definition: usb_transfer.c:987
void usbd_transfer_start(struct usb_xfer *xfer)
void * usbd_xfer_softc(struct usb_xfer *xfer)
void usbd_xfer_set_stall(struct usb_xfer *xfer)
void usbd_transfer_stop(struct usb_xfer *xfer)
void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes, int *nframes)
usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer)
void device_set_usb_desc(device_t dev)
Definition: usb_util.c:73
#define USB_ST_SETUP
Definition: usbdi.h:502
usb_error_t
Definition: usbdi.h:45
@ USB_ERR_CANCELLED
Definition: usbdi.h:51
#define USB_ST_TRANSFERRED
Definition: usbdi.h:503
void usbd_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset, struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len)
void() usb_callback_t(struct usb_xfer *, usb_error_t)
Definition: usbdi.h:94
#define STRUCT_USB_HOST_ID
Definition: usbdi.h:258
#define USB_GET_STATE(xfer)
Definition: usbdi.h:515