diff --git a/sys/dev/usb/controller/generic_ohci.h b/sys/dev/usb/controller/generic_ohci.h --- /dev/null +++ b/sys/dev/usb/controller/generic_ohci.h @@ -0,0 +1,41 @@ +/*- + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Sergey Tyuryukanov + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _GENERIC_OHCI_H_ +#define _GENERIC_OHCI_H_ + +extern driver_t generic_ohci_driver; + +device_attach_t generic_ohci_attach; +device_detach_t generic_ohci_detach; + +#endif /* !_GENERIC_OHCI_H_ */ diff --git a/sys/dev/usb/controller/generic_ohci_acpi.c b/sys/dev/usb/controller/generic_ohci_acpi.c --- /dev/null +++ b/sys/dev/usb/controller/generic_ohci_acpi.c @@ -0,0 +1,92 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2012 Ganbold Tsagaankhuu + * Copyright (c) 2023 Sergey Tyuryukanov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "generic_ohci.h" + +static const struct acpi_compat_data compat_data[] = { + {"generic-ohci", 1}, + { NULL, 0 } +}; + +static int +generic_ohci_acpi_probe(device_t self) +{ + ACPI_HANDLE h; + + if ((h = acpi_get_handle(self)) == NULL || + !acpi_MatchHid(h, "PRP0001")) + return (ENXIO); + + if (acpi_dsd_search_compatible(self, compat_data)->acd_data == 0) + return (ENXIO); + + device_set_desc(self, "Generic OHCI Controller"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t ohci_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, generic_ohci_acpi_probe), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(ohci, ohci_acpi_driver, ohci_acpi_methods, + sizeof(ohci_softc_t), generic_ohci_driver); + +DRIVER_MODULE(ohci, acpi, ohci_acpi_driver, 0, 0); +MODULE_DEPEND(ohci, usb, 1, 1, 1);