From 7fe671dc9b849e295cf04db354fc12c42a2e1c78 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Mon, 8 Jul 2019 20:53:25 +0000 Subject: [PATCH] Put USB ACPI code into own module, uacpi.ko. The code needs more testing before being enabled by default. Sponsored by: Mellanox Technologies --- sys/conf/files | 2 +- sys/dev/usb/usb_hub_acpi.c | 10 +++++++--- sys/modules/usb/Makefile | 6 ++++++ sys/modules/usb/uacpi/Makefile | 36 ++++++++++++++++++++++++++++++++++ sys/modules/usb/usb/Makefile | 9 +-------- 5 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 sys/modules/usb/uacpi/Makefile diff --git a/sys/conf/files b/sys/conf/files index 88dfdbbe8926..d0ccbde4163b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3221,7 +3221,7 @@ dev/usb/usb_generic.c optional usb dev/usb/usb_handle_request.c optional usb dev/usb/usb_hid.c optional usb dev/usb/usb_hub.c optional usb -dev/usb/usb_hub_acpi.c optional usb acpi +dev/usb/usb_hub_acpi.c optional uacpi acpi dev/usb/usb_if.m optional usb dev/usb/usb_lookup.c optional usb dev/usb/usb_mbuf.c optional usb diff --git a/sys/dev/usb/usb_hub_acpi.c b/sys/dev/usb/usb_hub_acpi.c index 33d10b5cfedb..07164ae76db1 100644 --- a/sys/dev/usb/usb_hub_acpi.c +++ b/sys/dev/usb/usb_hub_acpi.c @@ -440,6 +440,10 @@ static driver_t acpi_uhub_root_driver = { .baseclasses = uhub_baseclasses, }; -DRIVER_MODULE(acpi_uhub, uhub, acpi_uhub_driver, uhub_devclass, 0, 0); -MODULE_DEPEND(acpi_uhub, acpi, 1, 1, 1); -DRIVER_MODULE(acpi_uhub, usbus, acpi_uhub_root_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uacpi, uhub, acpi_uhub_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uacpi, usbus, acpi_uhub_root_driver, uhub_devclass, 0, 0); + +MODULE_DEPEND(uacpi, acpi, 1, 1, 1); +MODULE_DEPEND(uacpi, usb, 1, 1, 1); + +MODULE_VERSION(uacpi, 1); diff --git a/sys/modules/usb/Makefile b/sys/modules/usb/Makefile index ecae0febc09f..a64fb772cf3c 100644 --- a/sys/modules/usb/Makefile +++ b/sys/modules/usb/Makefile @@ -55,6 +55,7 @@ SUBDIR += uether aue axe axge cdce cue ${_kue} mos rue smsc udav uhso ipheth SUBDIR += muge SUBDIR += ure urndis SUBDIR += usfs umass urio +SUBDIR += ${_uacpi} SUBDIR += quirk template SUBDIR += ${_g_audio} ${_g_keyboard} ${_g_modem} ${_g_mouse} @@ -102,4 +103,9 @@ _avr32dci= avr32dci _saf1761otg= saf1761otg .endif +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +_uacpi= uacpi +.endif + .include diff --git a/sys/modules/usb/uacpi/Makefile b/sys/modules/usb/uacpi/Makefile new file mode 100644 index 000000000000..b4f89cde488f --- /dev/null +++ b/sys/modules/usb/uacpi/Makefile @@ -0,0 +1,36 @@ +# +# $FreeBSD$ +# +# Copyright (c) 2019 Hans Petter Selasky. 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. +# + +.PATH: ${SRCTOP}/sys/dev/usb + +KMOD= uacpi +SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ + opt_usb.h opt_bus.h opt_ddb.h \ + opt_acpi.h acpi_if.h \ + usb_hub_acpi.c + +.include diff --git a/sys/modules/usb/usb/Makefile b/sys/modules/usb/usb/Makefile index d32f07a6d0b4..f42f3d61147e 100644 --- a/sys/modules/usb/usb/Makefile +++ b/sys/modules/usb/usb/Makefile @@ -25,9 +25,7 @@ # SUCH DAMAGE. # -S= ${SRCTOP}/sys - -.PATH: $S/dev/usb $S/dev/usb/controller +.PATH: ${SRCTOP}/sys/dev/usb ${SRCTOP}/sys/dev/usb/controller KMOD= usb SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ @@ -39,11 +37,6 @@ SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ usb_msctest.c usb_parse.c usb_pf.c usb_process.c usb_request.c \ usb_transfer.c usb_util.c -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "i386" -SRCS += opt_acpi.h usb_hub_acpi.c acpi_if.h -.endif - .if !empty(OPT_FDT) SRCS+= usb_fdt_support.c ofw_bus_if.h .endif