freebsd-dev/sys/dev/usb/controller/generic_ehci_acpi.c
Emmanuel Vadot 7a58744fd0 Split out the attachment from the generic-ehci driver
Create an attachment file for the existing ACPI attachment, and create a
new FDT attachment for the generic-ehci driver.

Submitted by:	andrew (Original version)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19389
2019-10-03 18:53:03 +00:00

87 lines
2.7 KiB
C

/*-
* Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@freebsd.org>
* Copyright (c) 2016 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Andrew Turner under
* sponsorship from the FreeBSD Foundation.
*
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_bus.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/condvar.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
#include <dev/usb/controller/ehci.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <dev/acpica/acpivar.h>
#include "generic_ehci.h"
static int
generic_ehci_acpi_probe(device_t self)
{
ACPI_HANDLE h;
if ((h = acpi_get_handle(self)) == NULL ||
!acpi_MatchHid(h, "PNP0D20"))
return (ENXIO);
device_set_desc(self, "Generic EHCI Controller");
return (BUS_PROBE_DEFAULT);
}
static device_method_t ehci_acpi_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, generic_ehci_acpi_probe),
DEVMETHOD_END
};
DEFINE_CLASS_1(ehci, ehci_acpi_driver, ehci_acpi_methods,
sizeof(ehci_softc_t), generic_ehci_driver);
static devclass_t ehci_acpi_devclass;
DRIVER_MODULE(ehci, acpi, ehci_acpi_driver, ehci_acpi_devclass, 0, 0);
MODULE_DEPEND(ehci, usb, 1, 1, 1);