Lines Matching +full:usb +full:- +full:controller

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2010-2022 Hans Petter Selasky
48 #include <dev/usb/usb.h>
49 #include <dev/usb/usbdi.h>
51 #include <dev/usb/usb_core.h>
52 #include <dev/usb/usb_busdma.h>
53 #include <dev/usb/usb_process.h>
54 #include <dev/usb/usb_util.h>
56 #include <dev/usb/usb_controller.h>
57 #include <dev/usb/usb_bus.h>
58 #include <dev/usb/usb_pci.h>
59 #include <dev/usb/controller/xhci.h>
60 #include <dev/usb/controller/xhcireg.h>
89 MODULE_DEPEND(xhci, usb, 1, 1, 1);
98 return ("AMD KERNCZ USB 3.0 controller");
100 return ("AMD Starship USB 3.0 controller");
102 return ("AMD Matisse USB 3.0 controller");
105 return ("AMD Raven USB 3.1 controller");
107 return ("AMD X399 USB 3.0 controller");
110 return ("AMD 300 Series USB 3.1 controller");
112 return ("AMD 400 Series USB 3.1 controller");
116 return ("AMD FCH USB 3.0 controller");
120 return ("VMware USB 3.0 controller");
123 return ("Hygon USB 3.0 controller");
126 return ("NEC uPD720200 USB 3.0 controller");
128 return ("NEC uPD720202 USB 3.0 controller");
131 return ("Fresco Logic FL1000G USB 3.0 controller");
133 return ("Fresco Logic FL1009 USB 3.0 controller");
135 return ("Fresco Logic FL1100 USB 3.0 controller");
138 return ("ASMedia ASM1042 USB 3.0 controller");
140 return ("ASMedia ASM1042A USB 3.0 controller");
142 return ("ASMedia ASM1143 USB 3.1 controller");
144 return ("ASMedia ASM3242 USB 3.2 controller");
147 return ("Intel Goshen Ridge Thunderbolt 4 USB controller");
149 return ("Intel BayTrail USB 3.0 controller");
151 return ("Intel Maple Ridge Thunderbolt 4 USB controller");
155 return ("Intel Alpine Ridge Thunderbolt 3 USB controller");
159 return ("Intel Titan Ridge Thunderbolt 3 USB controller");
161 return ("Intel Denverton USB 3.0 controller");
164 return ("Intel Panther Point USB 3.0 controller");
166 return ("Intel Braswell USB 3.0 controller");
168 return ("Intel Gemini Lake USB 3.0 controller");
170 return ("Intel Ice Lake-LP USB 3.1 controller");
172 return ("Intel Tiger Lake-H USB 3.2 controller");
174 return ("Intel Alder Lake-P Thunderbolt 4 USB controller");
176 return ("Intel Alder Lake USB 3.2 controller");
178 return ("Intel Apollo Lake USB 3.0 controller");
180 return ("Intel Alder Lake USB 3.2 controller");
182 return ("Intel Ice Lake Thunderbolt 3 USB controller");
184 return ("Intel Lynx Point USB 3.0 controller");
186 return ("Intel Wildcat Point USB 3.0 controller");
188 return ("Intel Wellsburg USB 3.0 controller");
190 return ("Intel Tiger Lake-LP Thunderbolt 4 USB controller");
192 return ("Intel Tiger Lake-H Thunderbolt 4 USB controller");
194 return ("Broadwell Integrated PCH-LP chipset USB 3.0 controller");
196 return ("Intel Sunrise Point-LP USB 3.0 controller");
198 return ("Intel Tiger Lake-LP USB 3.2 controller");
200 return ("Intel Sunrise Point USB 3.0 controller");
202 return ("Intel Lewisburg USB 3.0 controller");
204 return ("Intel Union Point USB 3.0 controller");
206 return ("Intel Cannon Lake USB 3.1 controller");
209 return ("Cavium ThunderX USB 3.0 controller");
212 return ("NVIDIA TU106 USB 3.1 controller");
215 return ("Zhaoxin ZX-100 USB 3.0 controller");
217 return ("Zhaoxin ZX-200 USB 3.0 controller");
219 return ("Zhaoxin ZX-E USB 3.0 controller");
228 return ("XHCI (generic) USB 3.0 controller");
247 TUNABLE_INT("hw.usb.xhci.msi", &xhci_use_msi);
249 TUNABLE_INT("hw.usb.xhci.msix", &xhci_use_msix);
255 USB_BUS_UNLOCK(&sc->sc_bus);
257 USB_BUS_LOCK(&sc->sc_bus);
258 usb_callout_reset(&sc->sc_callout, 1, (void *)&xhci_interrupt_poll, sc);
295 sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
297 if (!sc->sc_io_res) {
301 sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
302 sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
303 sc->sc_io_size = rman_get_size(sc->sc_io_res);
306 case 0x10091b73: /* Fresco Logic FL1009 USB3.0 xHCI Controller */
307 case 0x8241104c: /* TUSB73x0 USB3.0 xHCI Controller */
308 sc->sc_no_deconfigure = 1;
310 case 0x01941033: /* NEC uPD720200 USB 3.0 controller */
311 case 0x00141912: /* NEC uPD720201 USB 3.0 controller */
312 /* Don't use 64-bit DMA on these controllers. */
327 * controller and use a different IMOD value.
329 sc->sc_port_route = &xhci_pci_port_route;
330 sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP;
331 sc->sc_ctlstep = 1;
340 sc->sc_io_res);
346 usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0);
351 sc->sc_msix_res = sc->sc_io_res;
353 sc->sc_msix_res = bus_alloc_resource_any(self,
355 if (sc->sc_msix_res == NULL) {
358 "Unable to map MSI-X table\n");
361 if (sc->sc_msix_res != NULL) {
365 device_printf(self, "MSI-X enabled\n");
368 if (sc->sc_msix_res != sc->sc_io_res) {
371 msix_table, sc->sc_msix_res);
373 sc->sc_msix_res = NULL;
385 sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
387 if (sc->sc_irq_res == NULL) {
390 /* goto error; FALLTHROUGH - use polling */
392 sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY);
393 if (sc->sc_bus.bdev == NULL) {
394 device_printf(self, "Could not add USB device\n");
397 device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
401 strlcpy(sc->sc_vendor, "AMD", sizeof(sc->sc_vendor));
404 strlcpy(sc->sc_vendor, "Intel", sizeof(sc->sc_vendor));
407 strlcpy(sc->sc_vendor, "VMware", sizeof(sc->sc_vendor));
410 strlcpy(sc->sc_vendor, "Zhaoxin", sizeof(sc->sc_vendor));
416 snprintf(sc->sc_vendor, sizeof(sc->sc_vendor),
421 if (sc->sc_irq_res != NULL && xhci_use_polling() == 0) {
422 err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
423 NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl);
426 rman_get_rid(sc->sc_irq_res), sc->sc_irq_res);
427 sc->sc_irq_res = NULL;
430 sc->sc_intr_hdl = NULL;
433 if (sc->sc_irq_res == NULL || sc->sc_intr_hdl == NULL) {
436 USB_BUS_LOCK(&sc->sc_bus);
438 USB_BUS_UNLOCK(&sc->sc_bus);
451 err = device_probe_and_attach(sc->sc_bus.bdev);
475 usb_callout_drain(&sc->sc_callout);
481 if (sc->sc_irq_res && sc->sc_intr_hdl) {
482 bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl);
483 sc->sc_intr_hdl = NULL;
485 if (sc->sc_irq_res) {
487 rman_get_rid(sc->sc_irq_res), sc->sc_irq_res);
488 sc->sc_irq_res = NULL;
491 if (sc->sc_msix_res != NULL && sc->sc_msix_res != sc->sc_io_res) {
493 rman_get_rid(sc->sc_msix_res), sc->sc_msix_res);
494 sc->sc_msix_res = NULL;
496 if (sc->sc_io_res) {
498 sc->sc_io_res);
499 sc->sc_io_res = NULL;
519 eec = -1;
521 /* Synchronise with the BIOS if it owns the controller. */
532 device_printf(sc->sc_bus.bdev, "waiting for BIOS "
543 if (--to == 0) {
544 device_printf(sc->sc_bus.bdev,