1052073c3SEmmanuel Vadot /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
3052073c3SEmmanuel Vadot *
40b453151SVal Packett * Copyright (c) 2019 Val Packett <val@packett.cool>
5052073c3SEmmanuel Vadot *
6052073c3SEmmanuel Vadot * Redistribution and use in source and binary forms, with or without
7052073c3SEmmanuel Vadot * modification, are permitted provided that the following conditions
8052073c3SEmmanuel Vadot * are met:
9052073c3SEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright
10052073c3SEmmanuel Vadot * notice, this list of conditions and the following disclaimer.
11052073c3SEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright
12052073c3SEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the
13052073c3SEmmanuel Vadot * documentation and/or other materials provided with the distribution.
14052073c3SEmmanuel Vadot *
15052073c3SEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16052073c3SEmmanuel Vadot * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17052073c3SEmmanuel Vadot * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18052073c3SEmmanuel Vadot * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19052073c3SEmmanuel Vadot * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20052073c3SEmmanuel Vadot * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21052073c3SEmmanuel Vadot * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22052073c3SEmmanuel Vadot * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23052073c3SEmmanuel Vadot * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24052073c3SEmmanuel Vadot * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25052073c3SEmmanuel Vadot * SUCH DAMAGE.
26052073c3SEmmanuel Vadot */
27052073c3SEmmanuel Vadot
28052073c3SEmmanuel Vadot #include "opt_acpi.h"
29052073c3SEmmanuel Vadot
30052073c3SEmmanuel Vadot #include <sys/param.h>
31052073c3SEmmanuel Vadot #include <sys/systm.h>
32052073c3SEmmanuel Vadot #include <sys/bus.h>
33052073c3SEmmanuel Vadot #include <sys/condvar.h>
34052073c3SEmmanuel Vadot #include <sys/kernel.h>
35052073c3SEmmanuel Vadot #include <sys/module.h>
36052073c3SEmmanuel Vadot
37052073c3SEmmanuel Vadot #include <dev/usb/usb.h>
38052073c3SEmmanuel Vadot #include <dev/usb/usbdi.h>
39052073c3SEmmanuel Vadot
40052073c3SEmmanuel Vadot #include <dev/usb/usb_core.h>
41052073c3SEmmanuel Vadot #include <dev/usb/usb_busdma.h>
42052073c3SEmmanuel Vadot #include <dev/usb/usb_process.h>
43052073c3SEmmanuel Vadot
44052073c3SEmmanuel Vadot #include <dev/usb/usb_controller.h>
45052073c3SEmmanuel Vadot #include <dev/usb/usb_bus.h>
46052073c3SEmmanuel Vadot #include <dev/usb/controller/xhci.h>
47052073c3SEmmanuel Vadot
48052073c3SEmmanuel Vadot #include <contrib/dev/acpica/include/acpi.h>
49052073c3SEmmanuel Vadot #include <dev/acpica/acpivar.h>
50052073c3SEmmanuel Vadot
51052073c3SEmmanuel Vadot #include "generic_xhci.h"
52052073c3SEmmanuel Vadot
538793196cSAndrew Turner static char *xhci_ids[] = {
548793196cSAndrew Turner "PNP0D10",
558793196cSAndrew Turner "PNP0D15",
568793196cSAndrew Turner NULL,
578793196cSAndrew Turner };
588793196cSAndrew Turner
59052073c3SEmmanuel Vadot static int
generic_xhci_acpi_probe(device_t dev)60052073c3SEmmanuel Vadot generic_xhci_acpi_probe(device_t dev)
61052073c3SEmmanuel Vadot {
628793196cSAndrew Turner if (ACPI_ID_PROBE(device_get_parent(dev), dev, xhci_ids, NULL) >= 0)
63052073c3SEmmanuel Vadot return (ENXIO);
64052073c3SEmmanuel Vadot
65052073c3SEmmanuel Vadot device_set_desc(dev, XHCI_HC_DEVSTR);
66052073c3SEmmanuel Vadot
6776f3b8cbSBjoern A. Zeeb return (BUS_PROBE_GENERIC);
68052073c3SEmmanuel Vadot }
69052073c3SEmmanuel Vadot
70052073c3SEmmanuel Vadot static device_method_t xhci_acpi_methods[] = {
71052073c3SEmmanuel Vadot /* Device interface */
72052073c3SEmmanuel Vadot DEVMETHOD(device_probe, generic_xhci_acpi_probe),
73052073c3SEmmanuel Vadot
74052073c3SEmmanuel Vadot DEVMETHOD_END
75052073c3SEmmanuel Vadot };
76052073c3SEmmanuel Vadot
77052073c3SEmmanuel Vadot DEFINE_CLASS_1(xhci, xhci_acpi_driver, xhci_acpi_methods,
78052073c3SEmmanuel Vadot sizeof(struct xhci_softc), generic_xhci_driver);
79052073c3SEmmanuel Vadot
80bc9372d7SJohn Baldwin DRIVER_MODULE(xhci, acpi, xhci_acpi_driver, 0, 0);
81052073c3SEmmanuel Vadot MODULE_DEPEND(xhci, usb, 1, 1, 1);
82