dde_linux: name usb_drv unambigously

* Make package buildable for ARM too
* Move usb library to src targets for explicitly named targets
* adapt remaining run-scripts to use the correctly named usb drivers

Ref #2190
This commit is contained in:
Stefan Kalkowski
2019-04-29 15:24:37 +02:00
committed by Christian Helmuth
parent d5104aca05
commit bf5a631a14
70 changed files with 256 additions and 470 deletions

View File

@ -11,7 +11,7 @@ SRC_CC += env.cc irq.cc malloc.cc scheduler.cc timer.cc work.cc printf.cc
INC_DIR += $(REP_DIR)/src/include
INC_DIR += $(REP_DIR)/src/include/spec/arm
INC_DIR += $(REP_DIR)/src/include/spec/arm_v7
INC_DIR += $(REP_DIR)/src/lib/usb/include/spec/arm
INC_DIR += $(REP_DIR)/src/drivers/usb/include/spec/arm
# contrib code
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/drivers/nic/fec

View File

@ -13,8 +13,126 @@
#include <base/component.h>
#include <base/attached_rom_dataspace.h>
#include <base/sleep.h>
#include <nic_session/nic_session.h>
extern void start_usb_driver(Genode::Env &env);
/* Local */
#include <signal.h>
#include <lx_emul.h>
#include <lx_kit/env.h>
#include <lx_kit/pci.h>
#include <lx_kit/irq.h>
#include <lx_kit/malloc.h>
#include <lx_kit/scheduler.h>
#include <lx_kit/timer.h>
#include <lx_kit/work.h>
using namespace Genode;
extern "C" int subsys_usb_init();
extern "C" void subsys_input_init();
extern "C" void module_evdev_init();
extern "C" void module_hid_init();
extern "C" void module_hid_init_core();
extern "C" void module_hid_generic_init();
extern "C" void module_usb_storage_driver_init();
extern "C" void module_wacom_driver_init();
extern "C" void module_ch_driver_init();
extern "C" void module_ms_driver_init();
extern "C" void module_mt_driver_init();
extern "C" void module_raw_driver_init();
extern "C" void module_led_init();
extern "C" void start_input_service(void *ep, void *services);
struct workqueue_struct *system_power_efficient_wq;
struct workqueue_struct *system_wq;
struct workqueue_struct *tasklet_wq;
void breakpoint() { Genode::log("BREAK"); }
static void run_linux(void *s)
{
Services *services = (Services *)s;
system_power_efficient_wq = alloc_workqueue("system_power_efficient_wq", 0, 0);
system_wq = alloc_workqueue("system_wq", 0, 0);
tasklet_wq = alloc_workqueue("tasklet_wq", 0, 0);
/*
* The RAW driver is initialized first to make sure that it doesn't miss
* notifications about added devices.
*/
if (services->raw)
/* low level interface */
module_raw_driver_init();
/* USB */
subsys_usb_init();
/* input + HID */
if (services->hid) {
subsys_input_init();
module_evdev_init();
module_led_init();
/* HID */
module_hid_init_core();
module_hid_init();
module_hid_generic_init();
module_ch_driver_init();
module_ms_driver_init();
module_mt_driver_init();
module_wacom_driver_init();
}
/* storage */
if (services->stor)
module_usb_storage_driver_init();
/* host controller */
platform_hcd_init(Lx_kit::env().env(), services);
while (true)
Lx::scheduler().current()->block_and_schedule();
}
void start_usb_driver(Genode::Env &env)
{
/* initialize USB env */
Lx_kit::construct_env(env);
/* sets up backend alloc needed by malloc */
backend_alloc_init(env, env.ram(), Lx_kit::env().heap());
Lx::malloc_init(env, Lx_kit::env().heap());
static Services services(env);
if (services.hid)
start_input_service(&env.ep().rpc_ep(), &services);
Storage::init(env);
Nic::init(env);
if (services.raw)
Raw::init(env, services.raw_report_device_list);
Lx::Scheduler &sched = Lx::scheduler(&env);
Lx::Timer &timer = Lx::timer(&env, &env.ep(), &Lx_kit::env().heap(), &jiffies);
Lx::Irq::irq(&env.ep(), &Lx_kit::env().heap());
Lx::Work::work_queue(&Lx_kit::env().heap());
static Lx::Task linux(run_linux, &services, "linux", Lx::Task::PRIORITY_0,
Lx::scheduler());
Lx::scheduler().schedule();
}
namespace Usb_driver {

View File

@ -0,0 +1,11 @@
include $(REP_DIR)/src/drivers/usb/target.inc
SRC_CC += platform_device.cc platform_generic.cc
INC_DIR += $(LIB_INC_DIR)/spec/arm
INC_DIR += $(REP_DIR)/src/include/spec/arm
vpath platform_device.cc $(LIB_DIR)/spec/arm
vpath platform_generic.cc $(LIB_DIR)/spec/arm
# vi:set ft=make :

View File

@ -0,0 +1,3 @@
include $(REP_DIR)/src/drivers/usb/spec/arm/target.inc
INC_DIR += $(LIB_INC_DIR)/spec/arm_v6

View File

@ -0,0 +1,3 @@
include $(REP_DIR)/src/drivers/usb/spec/arm/target.inc
INC_DIR += $(LIB_INC_DIR)/spec/arm_v7

View File

@ -15,7 +15,6 @@
#include <drivers/defs/arndale.h>
#include <base/attached_io_mem_dataspace.h>
#include <io_mem_session/connection.h>
#include <regulator/consts.h>
#include <regulator_session/connection.h>
#include <timer_session/connection.h>
#include <util/mmio.h>

View File

@ -0,0 +1 @@
#include <spec/exynos5/regulator/consts.h>

View File

@ -0,0 +1,22 @@
TARGET = arndale_usb_drv
REQUIRES = arm_v7
SRC_C += $(addprefix net/usb/, usbnet.c asix_devices.c asix_common.c ax88172a.c \
ax88179_178a.c)
SRC_C += usb/host/ehci-exynos.c
include $(REP_DIR)/src/drivers/usb/xhci.inc
include $(REP_DIR)/src/drivers/usb/spec/arm_v7/target.inc
CC_OPT += -DCONFIG_USB_EHCI_TT_NEWSCHED -DCONFIG_USB_DWC3_HOST=1 \
-DCONFIG_USB_DWC3_GADGET=0 -DCONFIG_USB_OTG_UTILS -DCONFIG_USB_XHCI_PLATFORM -DDWC3_QUIRK
INC_DIR += $(LX_CONTRIB_DIR)/arch/arm/plat-samsung/include
SRC_CC += platform.cc
#DWC3
SRC_C += $(addprefix usb/dwc3/, dwc3-exynos.c host.c core.c)
#XHCI
SRC_C += usb/host/xhci-plat.c
vpath platform.cc $(LIB_DIR)/spec/arndale

View File

@ -18,7 +18,6 @@
#include <drivers/defs/odroid_x2.h>
#include <base/attached_io_mem_dataspace.h>
#include <io_mem_session/connection.h>
#include <regulator/consts.h>
#include <regulator_session/connection.h>
#include <timer_session/connection.h>
#include <util/mmio.h>

View File

@ -0,0 +1 @@
#include <spec/exynos4/regulator/consts.h>

View File

@ -0,0 +1,17 @@
TARGET = odroid_x2_usb_drv
REQUIRES = arm_v7
SRC_C += $(addprefix net/usb/, usbnet.c smsc95xx.c)
SRC_C += usb/host/ehci-exynos.c
include $(REP_DIR)/src/drivers/usb/spec/arm_v7/target.inc
CC_OPT += -DCONFIG_USB_EHCI_TT_NEWSCHED \
-DCONFIG_USB_OTG_UTILS
SRC_CC += platform.cc
INC_DIR += $(LIB_INC_DIR)/spec/odroid_x2
vpath platform.cc $(LIB_DIR)/spec/odroid_x2

View File

@ -0,0 +1,14 @@
TARGET = panda_usb_drv
REQUIRES = arm_v7
SRC_C += $(addprefix net/usb/, usbnet.c smsc95xx.c)
SRC_C += usb/host/ehci-omap.c
include $(REP_DIR)/src/drivers/usb/spec/arm_v7/target.inc
CC_OPT += -DCONFIG_USB_EHCI_HCD_OMAP -DCONFIG_USB_EHCI_TT_NEWSCHED -DVERBOSE_DEBUG
SRC_CC += platform.cc
vpath platform.cc $(LIB_DIR)/spec/panda
CC_CXX_WARN_STRICT =

View File

@ -0,0 +1 @@
#include <spec/rpi/platform_session/client.h>

View File

@ -0,0 +1 @@
#include <spec/rpi/platform_session/platform_session.h>

View File

@ -0,0 +1,50 @@
TARGET = rpi_usb_drv
REQUIRES = arm_v6
SRC_C += \
usb/host/dwc_otg/dwc_otg/dwc_otg_adp.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_attr.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_cfi.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_cil.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_cil_intr.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_driver.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_hcd.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_ddma.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_intr.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_linux.c \
usb/host/dwc_otg/dwc_otg/dwc_otg_hcd_queue.c \
usb/host/dwc_otg/dwc_common_port/dwc_cc.c \
usb/host/dwc_otg/dwc_common_port/dwc_common_linux.c \
usb/host/dwc_otg/dwc_common_port/dwc_crypto.c \
usb/host/dwc_otg/dwc_common_port/dwc_dh.c \
usb/host/dwc_otg/dwc_common_port/dwc_mem.c \
usb/host/dwc_otg/dwc_common_port/dwc_modpow.c \
usb/host/dwc_otg/dwc_common_port/dwc_notifier.c
SRC_C += net/usb/usbnet.c net/usb/smsc95xx.c
include $(REP_DIR)/src/drivers/usb/spec/arm_v6/target.inc
CC_OPT += -DDWC_LINUX -DPLATFORM_INTERFACE
# needed for 'ehci-hcd.c', which we don't use on the rpi, but it is still
# part of the generic usb USB driver
CC_OPT += -DCONFIG_USB_EHCI_PCI=1
# for 'dwc_otg_hcd_linux.c' for enabling the FIQ, which we don't use anyway
CC_OPT += -DINTERRUPT_VC_USB=9
# for 'dwc_otg_driver.c' for preventing calls to set_irq_type
CC_OPT += -DIRQF_TRIGGER_LOW=1
INC_DIR += $(LX_CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_common_port \
$(LX_CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_otg
SRC_CC += platform.cc
vpath platform.cc $(LIB_DIR)/spec/rpi
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb
# enable C++11 support
CC_CXX_OPT += -std=gnu++11
LIBS += rpi_usb

View File

@ -0,0 +1,27 @@
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c ehci-pci.c ohci-hcd.c ohci-pci.c)
SRC_C += usb/core/hcd-pci.c
#
# USB netwpork support
#
SRC_C += $(addprefix net/usb/, usbnet.c ax88179_178a.c cdc_ether.c rndis_host.c)
# XHCI
SRC_C += usb/host/xhci-pci.c
# PCI
SRC_CC += pci_driver.cc platform.cc
# lx_kit
SRC_CC += pci.cc mapped_io_mem_range.cc
include $(REP_DIR)/src/drivers/usb/xhci.inc
include $(REP_DIR)/src/drivers/usb/target.inc
CC_OPT += -DCONFIG_PCI -DCONFIG_USB_EHCI_PCI=1 -DCONFIG_USB_XHCI_HCD=1
vpath platform.cc $(LIB_DIR)/spec/x86
vpath pci_driver.cc $(LIB_DIR)/spec/x86
# vi:set ft=make :

View File

@ -0,0 +1,7 @@
TARGET = usb_drv
REQUIRES = x86_32
INC_DIR += $(LIB_INC_DIR)/spec/x86_32 $(LIB_INC_DIR)/spec/x86
INC_DIR += $(REP_DIR)/src/include/spec/x86_32
include $(REP_DIR)/src/drivers/usb/spec/x86/target.inc

View File

@ -0,0 +1,7 @@
TARGET = usb_drv
REQUIRES = x86_64
INC_DIR += $(LIB_INC_DIR)/spec/x86_64 $(LIB_INC_DIR)/spec/x86
INC_DIR += $(REP_DIR)/src/include/spec/x86_64
include $(REP_DIR)/src/drivers/usb/spec/x86/target.inc

View File

@ -0,0 +1,100 @@
SRC_CC += main.cc
LIBS = base
CC_CXX_WARN_STRICT =
LIB_DIR = $(REP_DIR)/src/drivers/usb
LIB_INC_DIR = $(LIB_DIR)/include
LIBS += usb_include lx_kit_setjmp
SRC_CC += lx_emul.cc storage.cc \
input_component.cc evdev.cc nic.cc raw.cc
SRC_C += dummies.c scsi.c raw_driver.c
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/usb
DRIVERS_DIR := $(LX_CONTRIB_DIR)/drivers
USB_DIR := $(DRIVERS_DIR)/usb
#
# The order of include-search directories is important, we need to look into
# 'contrib' before falling back to our custom 'lx_emul.h' header.
#
INC_DIR += $(PRG_DIR)
INC_DIR += $(LIB_INC_DIR) $(REP_DIR)/src/include
INC_DIR += $(LX_CONTRIB_DIR)/include $(LX_CONTRIB_DIR)/include/uapi $(LX_CONTRIB_DIR)
CC_OPT += -U__linux__ -D__KERNEL__
CC_OPT += -DCONFIG_USB_DEVICEFS -DCONFIG_HOTPLUG -DDEBUG -DCONFIG_USB_PHY=1 \
-DCONFIG_GENERIC_PHY=0 -DCONFIG_USB_OTG_WHITELIST=0 \
-DCONFIG_USB_OTG=0 -DCONFIG_USB_NET_RNDIS_HOST=1
CC_WARN = -Wall -Wno-unused-variable -Wno-uninitialized \
-Wno-unused-function -Wno-overflow
CC_C_OPT += -std=gnu89 -Wno-unused-but-set-variable -Wno-pointer-sign -Wno-unused-label
CC_C_OPT += -include $(LIB_INC_DIR)/lx_emul.h
CC_CXX_OPT = -fpermissive
#
# Suffix of global 'module_init' function
#
MOD_SUFFIX =
CC_OPT += -DMOD_SUFFIX=$(MOD_SUFFIX)
# lx_kit
SRC_CC += printf.cc work.cc timer.cc scheduler.cc irq.cc malloc.cc env.cc
# common lib
SRC_C += lib/ctype.c
SRC_C += lib/int_sqrt.c
# USB core
SRC_C += $(addprefix usb/core/, buffer.c config.c devices.c driver.c endpoint.c file.c \
generic.c hcd.c hub.c message.c notify.c port.c quirks.c\
urb.c usb.c)
# USB host-controller driver
SRC_C += $(addprefix usb/host/, ehci-hcd.c)
# common
SRC_C += usb/common/common.c
# USB hid
SRC_C += $(addprefix hid/usbhid/, hid-core.c hid-quirks.c)
SRC_C += $(addprefix hid/, hid-core.c hid-generic.c hid-input.c \
hid-cherry.c hid-microsoft.c hid-multitouch.c \
wacom_sys.c wacom_wac.c)
SRC_C += $(addprefix input/, evdev.c input.c input-mt.c)
# USB storage
SRC_C += $(addprefix usb/storage/,scsiglue.c protocol.c transport.c usb.c \
initializers.c option_ms.c sierra_ms.c usual-tables.c)
# SCSI
SRC_C += $(addprefix scsi/,scsi.c constants.c)
#SRC_CC = storage.cc
#SRC_C =
#
# Add suffix, since there are two hid-core.c with the same module init function
#
hid/hid-core.o: MOD_SUFFIX="_core"
vpath %.c $(DRIVERS_DIR)
vpath %.c $(LIB_DIR)
vpath %.cc $(LIB_DIR)
vpath %.cc $(LIB_DIR)/signal
vpath %.c $(LIB_DIR)/input
vpath %.cc $(LIB_DIR)/input
vpath %.cc $(LIB_DIR)/storage
vpath %.c $(LIB_DIR)/storage
vpath %.cc $(LIB_DIR)/nic
vpath %.cc $(LIB_DIR)/raw
vpath %.c $(LIB_DIR)/raw
vpath lib/int_sqrt.c $(LX_CONTRIB_DIR)
vpath lib/ctype.c $(LX_CONTRIB_DIR)
vpath %.cc $(REP_DIR)/src/lx_kit
# vi: set ft=make :

View File

@ -1,5 +0,0 @@
TARGET = usb_drv
SRC_CC = main.cc
LIBS = base usb
CC_CXX_WARN_STRICT =

View File

@ -0,0 +1,6 @@
#
# Generic XHCI files
#
SRC_C += $(addprefix usb/host/, xhci-dbg.c xhci-hub.c xhci-mem.c xhci-ring.c xhci.c)
# vi:set ft=make :

View File

@ -1,138 +0,0 @@
/*
* \brief USB driver main program
* \author Norman Feske
* \author Sebastian Sumpf <sebastian.sumpf@genode-labs.com>
* \author Christian Menard <christian.menard@ksyslabs.org>
* \date 2012-01-29
*/
/*
* Copyright (C) 2012-2017 Genode Labs GmbH
* Copyright (C) 2014 Ksys Labs LLC
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
/* Genode */
#include <base/sleep.h>
#include <nic_session/nic_session.h>
/* Local */
#include <signal.h>
#include <lx_emul.h>
#include <lx_kit/env.h>
#include <lx_kit/pci.h>
#include <lx_kit/irq.h>
#include <lx_kit/malloc.h>
#include <lx_kit/scheduler.h>
#include <lx_kit/timer.h>
#include <lx_kit/work.h>
using namespace Genode;
extern "C" int subsys_usb_init();
extern "C" void subsys_input_init();
extern "C" void module_evdev_init();
extern "C" void module_hid_init();
extern "C" void module_hid_init_core();
extern "C" void module_hid_generic_init();
extern "C" void module_usb_storage_driver_init();
extern "C" void module_wacom_driver_init();
extern "C" void module_ch_driver_init();
extern "C" void module_ms_driver_init();
extern "C" void module_mt_driver_init();
extern "C" void module_raw_driver_init();
extern "C" void module_led_init();
extern "C" void start_input_service(void *ep, void *services);
struct workqueue_struct *system_power_efficient_wq;
struct workqueue_struct *system_wq;
struct workqueue_struct *tasklet_wq;
void breakpoint() { Genode::log("BREAK"); }
static void run_linux(void *s)
{
Services *services = (Services *)s;
system_power_efficient_wq = alloc_workqueue("system_power_efficient_wq", 0, 0);
system_wq = alloc_workqueue("system_wq", 0, 0);
tasklet_wq = alloc_workqueue("tasklet_wq", 0, 0);
/*
* The RAW driver is initialized first to make sure that it doesn't miss
* notifications about added devices.
*/
if (services->raw)
/* low level interface */
module_raw_driver_init();
/* USB */
subsys_usb_init();
/* input + HID */
if (services->hid) {
subsys_input_init();
module_evdev_init();
module_led_init();
/* HID */
module_hid_init_core();
module_hid_init();
module_hid_generic_init();
module_ch_driver_init();
module_ms_driver_init();
module_mt_driver_init();
module_wacom_driver_init();
}
/* storage */
if (services->stor)
module_usb_storage_driver_init();
/* host controller */
platform_hcd_init(Lx_kit::env().env(), services);
while (true)
Lx::scheduler().current()->block_and_schedule();
}
void start_usb_driver(Genode::Env &env)
{
/* initialize USB env */
Lx_kit::construct_env(env);
/* sets up backend alloc needed by malloc */
backend_alloc_init(env, env.ram(), Lx_kit::env().heap());
Lx::malloc_init(env, Lx_kit::env().heap());
static Services services(env);
if (services.hid)
start_input_service(&env.ep().rpc_ep(), &services);
Storage::init(env);
Nic::init(env);
if (services.raw)
Raw::init(env, services.raw_report_device_list);
Lx::Scheduler &sched = Lx::scheduler(&env);
Lx::Timer &timer = Lx::timer(&env, &env.ep(), &Lx_kit::env().heap(), &jiffies);
Lx::Irq::irq(&env.ep(), &Lx_kit::env().heap());
Lx::Work::work_queue(&Lx_kit::env().heap());
static Lx::Task linux(run_linux, &services, "linux", Lx::Task::PRIORITY_0,
Lx::scheduler());
Lx::scheduler().schedule();
}