Lines Matching +full:pch +full:- +full:msi +full:- +full:1

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2010-2022 Hans Petter Selasky
9 * 1. Redistributions of source code must retain the above copyright
88 MODULE_DEPEND(xhci, usb, 1, 1, 1);
176 return ("Intel Ice Lake-LP USB 3.1 controller"); in xhci_pci_match()
178 return ("Intel Tiger Lake-H USB 3.2 controller"); in xhci_pci_match()
180 return ("Intel Alder Lake-P Thunderbolt 4 USB controller"); in xhci_pci_match()
196 return ("Intel Tiger Lake-LP Thunderbolt 4 USB controller"); in xhci_pci_match()
198 return ("Intel Tiger Lake-H Thunderbolt 4 USB controller"); in xhci_pci_match()
200 return ("Broadwell Integrated PCH-LP chipset USB 3.0 controller"); in xhci_pci_match()
202 return ("Intel Sunrise Point-LP USB 3.0 controller"); in xhci_pci_match()
204 return ("Intel Tiger Lake-LP USB 3.2 controller"); in xhci_pci_match()
221 return ("Zhaoxin ZX-100 USB 3.0 controller"); in xhci_pci_match()
223 return ("Zhaoxin ZX-200 USB 3.0 controller"); in xhci_pci_match()
225 return ("Zhaoxin ZX-E USB 3.0 controller"); in xhci_pci_match()
252 static int xhci_use_msi = 1;
253 TUNABLE_INT("hw.usb.xhci.msi", &xhci_use_msi);
254 static int xhci_use_msix = 1;
261 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_interrupt_poll()
263 USB_BUS_LOCK(&sc->sc_bus); in xhci_interrupt_poll()
264 usb_callout_reset(&sc->sc_callout, 1, (void *)&xhci_interrupt_poll, sc); in xhci_interrupt_poll()
297 uint8_t usemsi = 1; in xhci_pci_attach()
301 sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, in xhci_pci_attach()
303 if (!sc->sc_io_res) { in xhci_pci_attach()
307 sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); in xhci_pci_attach()
308 sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); in xhci_pci_attach()
309 sc->sc_io_size = rman_get_size(sc->sc_io_res); in xhci_pci_attach()
314 sc->sc_no_deconfigure = 1; in xhci_pci_attach()
318 /* Don't use 64-bit DMA on these controllers. */ in xhci_pci_attach()
319 usedma32 = 1; in xhci_pci_attach()
322 /* Fresco Logic host doesn't support MSI. */ in xhci_pci_attach()
335 sc->sc_port_route = &xhci_pci_port_route; in xhci_pci_attach()
336 sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; in xhci_pci_attach()
337 sc->sc_ctlstep = 1; in xhci_pci_attach()
346 sc->sc_io_res); in xhci_pci_attach()
352 usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0); in xhci_pci_attach()
357 sc->sc_msix_res = sc->sc_io_res; in xhci_pci_attach()
359 sc->sc_msix_res = bus_alloc_resource_any(self, in xhci_pci_attach()
361 if (sc->sc_msix_res == NULL) { in xhci_pci_attach()
364 "Unable to map MSI-X table\n"); in xhci_pci_attach()
367 if (sc->sc_msix_res != NULL) { in xhci_pci_attach()
368 count = 1; in xhci_pci_attach()
371 device_printf(self, "MSI-X enabled\n"); in xhci_pci_attach()
372 rid = 1; in xhci_pci_attach()
374 if (sc->sc_msix_res != sc->sc_io_res) { in xhci_pci_attach()
377 msix_table, sc->sc_msix_res); in xhci_pci_attach()
379 sc->sc_msix_res = NULL; in xhci_pci_attach()
384 count = 1; in xhci_pci_attach()
387 device_printf(self, "MSI enabled\n"); in xhci_pci_attach()
388 rid = 1; in xhci_pci_attach()
391 sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, in xhci_pci_attach()
393 if (sc->sc_irq_res == NULL) { in xhci_pci_attach()
396 /* goto error; FALLTHROUGH - use polling */ in xhci_pci_attach()
398 sc->sc_bus.bdev = device_add_child(self, "usbus", DEVICE_UNIT_ANY); in xhci_pci_attach()
399 if (sc->sc_bus.bdev == NULL) { in xhci_pci_attach()
403 device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); in xhci_pci_attach()
407 strlcpy(sc->sc_vendor, "AMD", sizeof(sc->sc_vendor)); in xhci_pci_attach()
410 strlcpy(sc->sc_vendor, "Intel", sizeof(sc->sc_vendor)); in xhci_pci_attach()
413 strlcpy(sc->sc_vendor, "VMware", sizeof(sc->sc_vendor)); in xhci_pci_attach()
416 strlcpy(sc->sc_vendor, "Zhaoxin", sizeof(sc->sc_vendor)); in xhci_pci_attach()
422 snprintf(sc->sc_vendor, sizeof(sc->sc_vendor), in xhci_pci_attach()
427 if (sc->sc_irq_res != NULL && xhci_use_polling() == 0) { in xhci_pci_attach()
428 err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, in xhci_pci_attach()
429 NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); in xhci_pci_attach()
432 rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); in xhci_pci_attach()
433 sc->sc_irq_res = NULL; in xhci_pci_attach()
436 sc->sc_intr_hdl = NULL; in xhci_pci_attach()
439 if (sc->sc_irq_res == NULL || sc->sc_intr_hdl == NULL) { in xhci_pci_attach()
442 USB_BUS_LOCK(&sc->sc_bus); in xhci_pci_attach()
444 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_pci_attach()
457 err = device_probe_and_attach(sc->sc_bus.bdev); in xhci_pci_attach()
481 usb_callout_drain(&sc->sc_callout); in xhci_pci_detach()
487 if (sc->sc_irq_res && sc->sc_intr_hdl) { in xhci_pci_detach()
488 bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intr_hdl); in xhci_pci_detach()
489 sc->sc_intr_hdl = NULL; in xhci_pci_detach()
491 if (sc->sc_irq_res) { in xhci_pci_detach()
493 rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); in xhci_pci_detach()
494 sc->sc_irq_res = NULL; in xhci_pci_detach()
497 if (sc->sc_msix_res != NULL && sc->sc_msix_res != sc->sc_io_res) { in xhci_pci_detach()
499 rman_get_rid(sc->sc_msix_res), sc->sc_msix_res); in xhci_pci_detach()
500 sc->sc_msix_res = NULL; in xhci_pci_detach()
502 if (sc->sc_io_res) { in xhci_pci_detach()
504 sc->sc_io_res); in xhci_pci_detach()
505 sc->sc_io_res = NULL; in xhci_pci_detach()
525 eec = -1; in xhci_pci_take_controller()
538 device_printf(sc->sc_bus.bdev, "waiting for BIOS " in xhci_pci_take_controller()
541 XHCI_XECP_OS_SEM, 1); in xhci_pci_take_controller()
543 while (1) { in xhci_pci_take_controller()
549 if (--to == 0) { in xhci_pci_take_controller()
550 device_printf(sc->sc_bus.bdev, in xhci_pci_take_controller()