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 "opt_bus.h"
327a58744fSEmmanuel Vadot
337a58744fSEmmanuel Vadot #include <sys/param.h>
347a58744fSEmmanuel Vadot #include <sys/systm.h>
357a58744fSEmmanuel Vadot #include <sys/bus.h>
367a58744fSEmmanuel Vadot #include <sys/condvar.h>
377a58744fSEmmanuel Vadot #include <sys/kernel.h>
387a58744fSEmmanuel Vadot #include <sys/module.h>
397a58744fSEmmanuel Vadot
407a58744fSEmmanuel Vadot #include <dev/usb/usb.h>
417a58744fSEmmanuel Vadot #include <dev/usb/usbdi.h>
427a58744fSEmmanuel Vadot
437a58744fSEmmanuel Vadot #include <dev/usb/usb_core.h>
447a58744fSEmmanuel Vadot #include <dev/usb/usb_busdma.h>
457a58744fSEmmanuel Vadot #include <dev/usb/usb_process.h>
467a58744fSEmmanuel Vadot
477a58744fSEmmanuel Vadot #include <dev/usb/usb_controller.h>
487a58744fSEmmanuel Vadot #include <dev/usb/usb_bus.h>
497a58744fSEmmanuel Vadot #include <dev/usb/controller/ehci.h>
507a58744fSEmmanuel Vadot
517a58744fSEmmanuel Vadot #include <contrib/dev/acpica/include/acpi.h>
527a58744fSEmmanuel Vadot #include <contrib/dev/acpica/include/accommon.h>
537a58744fSEmmanuel Vadot #include <dev/acpica/acpivar.h>
547a58744fSEmmanuel Vadot
557a58744fSEmmanuel Vadot #include "generic_ehci.h"
567a58744fSEmmanuel Vadot
577a58744fSEmmanuel Vadot static int
generic_ehci_acpi_probe(device_t self)587a58744fSEmmanuel Vadot generic_ehci_acpi_probe(device_t self)
597a58744fSEmmanuel Vadot {
607a58744fSEmmanuel Vadot ACPI_HANDLE h;
617a58744fSEmmanuel Vadot
627a58744fSEmmanuel Vadot if ((h = acpi_get_handle(self)) == NULL ||
637a58744fSEmmanuel Vadot !acpi_MatchHid(h, "PNP0D20"))
647a58744fSEmmanuel Vadot return (ENXIO);
657a58744fSEmmanuel Vadot
667a58744fSEmmanuel Vadot device_set_desc(self, "Generic EHCI Controller");
677a58744fSEmmanuel Vadot return (BUS_PROBE_DEFAULT);
687a58744fSEmmanuel Vadot }
697a58744fSEmmanuel Vadot
707a58744fSEmmanuel Vadot static device_method_t ehci_acpi_methods[] = {
717a58744fSEmmanuel Vadot /* Device interface */
727a58744fSEmmanuel Vadot DEVMETHOD(device_probe, generic_ehci_acpi_probe),
737a58744fSEmmanuel Vadot
747a58744fSEmmanuel Vadot DEVMETHOD_END
757a58744fSEmmanuel Vadot };
767a58744fSEmmanuel Vadot
777a58744fSEmmanuel Vadot DEFINE_CLASS_1(ehci, ehci_acpi_driver, ehci_acpi_methods,
787a58744fSEmmanuel Vadot sizeof(ehci_softc_t), generic_ehci_driver);
797a58744fSEmmanuel Vadot
80*bc9372d7SJohn Baldwin DRIVER_MODULE(ehci, acpi, ehci_acpi_driver, 0, 0);
817a58744fSEmmanuel Vadot MODULE_DEPEND(ehci, usb, 1, 1, 1);
82