17a58744fSEmmanuel Vadot /*-
27a58744fSEmmanuel Vadot * Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@freebsd.org>
37a58744fSEmmanuel Vadot * Copyright (c) 2016 The FreeBSD Foundation
47a58744fSEmmanuel Vadot * All rights reserved.
57a58744fSEmmanuel Vadot *
67a58744fSEmmanuel Vadot * This software was developed by Andrew Turner under
77a58744fSEmmanuel Vadot * sponsorship from the FreeBSD Foundation.
87a58744fSEmmanuel Vadot *
97a58744fSEmmanuel Vadot * Redistribution and use in source and binary forms, with or without
107a58744fSEmmanuel Vadot * modification, are permitted provided that the following conditions
117a58744fSEmmanuel Vadot * are met:
127a58744fSEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright
137a58744fSEmmanuel Vadot * notice, this list of conditions and the following disclaimer.
147a58744fSEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright
157a58744fSEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the
167a58744fSEmmanuel Vadot * documentation and/or other materials provided with the distribution.
177a58744fSEmmanuel Vadot *
187a58744fSEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
197a58744fSEmmanuel Vadot * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
207a58744fSEmmanuel Vadot * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
217a58744fSEmmanuel Vadot * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
227a58744fSEmmanuel Vadot * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
237a58744fSEmmanuel Vadot * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
247a58744fSEmmanuel Vadot * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
257a58744fSEmmanuel Vadot * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
267a58744fSEmmanuel Vadot * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
277a58744fSEmmanuel Vadot * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
287a58744fSEmmanuel Vadot * SUCH DAMAGE.
297a58744fSEmmanuel Vadot */
307a58744fSEmmanuel Vadot
317a58744fSEmmanuel Vadot #include <sys/cdefs.h>
327a58744fSEmmanuel Vadot #include "opt_bus.h"
337a58744fSEmmanuel Vadot
347a58744fSEmmanuel Vadot #include <sys/param.h>
357a58744fSEmmanuel Vadot #include <sys/systm.h>
367a58744fSEmmanuel Vadot #include <sys/bus.h>
377a58744fSEmmanuel Vadot #include <sys/condvar.h>
387a58744fSEmmanuel Vadot #include <sys/kernel.h>
397a58744fSEmmanuel Vadot #include <sys/module.h>
407a58744fSEmmanuel Vadot
417a58744fSEmmanuel Vadot #include <dev/usb/usb.h>
427a58744fSEmmanuel Vadot #include <dev/usb/usbdi.h>
437a58744fSEmmanuel Vadot
447a58744fSEmmanuel Vadot #include <dev/usb/usb_core.h>
457a58744fSEmmanuel Vadot #include <dev/usb/usb_busdma.h>
467a58744fSEmmanuel Vadot #include <dev/usb/usb_process.h>
477a58744fSEmmanuel Vadot
487a58744fSEmmanuel Vadot #include <dev/usb/usb_controller.h>
497a58744fSEmmanuel Vadot #include <dev/usb/usb_bus.h>
507a58744fSEmmanuel Vadot #include <dev/usb/controller/ehci.h>
517a58744fSEmmanuel Vadot
527a58744fSEmmanuel Vadot #include <contrib/dev/acpica/include/acpi.h>
537a58744fSEmmanuel Vadot #include <contrib/dev/acpica/include/accommon.h>
547a58744fSEmmanuel Vadot #include <dev/acpica/acpivar.h>
557a58744fSEmmanuel Vadot
567a58744fSEmmanuel Vadot #include "generic_ehci.h"
577a58744fSEmmanuel Vadot
587a58744fSEmmanuel Vadot static int
generic_ehci_acpi_probe(device_t self)597a58744fSEmmanuel Vadot generic_ehci_acpi_probe(device_t self)
607a58744fSEmmanuel Vadot {
617a58744fSEmmanuel Vadot ACPI_HANDLE h;
627a58744fSEmmanuel Vadot
637a58744fSEmmanuel Vadot if ((h = acpi_get_handle(self)) == NULL ||
647a58744fSEmmanuel Vadot !acpi_MatchHid(h, "PNP0D20"))
657a58744fSEmmanuel Vadot return (ENXIO);
667a58744fSEmmanuel Vadot
677a58744fSEmmanuel Vadot device_set_desc(self, "Generic EHCI Controller");
687a58744fSEmmanuel Vadot return (BUS_PROBE_DEFAULT);
697a58744fSEmmanuel Vadot }
707a58744fSEmmanuel Vadot
717a58744fSEmmanuel Vadot static device_method_t ehci_acpi_methods[] = {
727a58744fSEmmanuel Vadot /* Device interface */
737a58744fSEmmanuel Vadot DEVMETHOD(device_probe, generic_ehci_acpi_probe),
747a58744fSEmmanuel Vadot
757a58744fSEmmanuel Vadot DEVMETHOD_END
767a58744fSEmmanuel Vadot };
777a58744fSEmmanuel Vadot
787a58744fSEmmanuel Vadot DEFINE_CLASS_1(ehci, ehci_acpi_driver, ehci_acpi_methods,
797a58744fSEmmanuel Vadot sizeof(ehci_softc_t), generic_ehci_driver);
807a58744fSEmmanuel Vadot
81*bc9372d7SJohn Baldwin DRIVER_MODULE(ehci, acpi, ehci_acpi_driver, 0, 0);
827a58744fSEmmanuel Vadot MODULE_DEPEND(ehci, usb, 1, 1, 1);
83