From 47a129c6af10766e7de926511f69a6c3f11fa273 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 20 Jan 2017 16:08:01 +0100 Subject: [PATCH] run/platform_drv.inc: add 'need_usb_hid' function This function returns the information whether the used platform relies on USB HID for interactive scenarios by default as is the case for most ARM platforms. In contrast, for x86 the USB driver can be omitted because we can use the PS/2 driver (that is readily available in repos/os/). --- repos/base/run/platform_drv.inc | 25 +++++++++++++++++++++++++ repos/gems/run/cpu_load_display.run | 9 +++++---- repos/gems/run/cpu_sampler_noux.run | 14 +++++--------- repos/gems/run/decorator_stress.run | 18 +++++++++--------- repos/gems/run/wm.run | 21 +++++++++++---------- repos/libports/run/qt5_drivers.inc | 4 +--- repos/os/run/demo.run | 9 +++++---- repos/ports/run/noux_bash.run | 14 +++++--------- 8 files changed, 66 insertions(+), 48 deletions(-) diff --git a/repos/base/run/platform_drv.inc b/repos/base/run/platform_drv.inc index 7ec1f54b7e..ff8f8d3fc5 100644 --- a/repos/base/run/platform_drv.inc +++ b/repos/base/run/platform_drv.inc @@ -10,6 +10,26 @@ proc have_platform_drv {} { || [have_spec x86]] } + +## +# Return 1 if the scenario depends on the USB driver on the used platform +# +# On most ARM platform, user input is provided by an USB HID device. On other +# platforms, the USB driver may be omitted. +# +proc need_usb_hid { } { + + # covered by fb_sdl + if {[have_spec linux]} { return 0 } + + # covered by ps2_drv + if {[have_spec x86]} { return 0 } + if {[have_spec pbxa9]} { return 0 } + + return [have_spec usb] +} + + proc append_platform_drv_build_components {} { global build_components @@ -19,6 +39,7 @@ proc append_platform_drv_build_components {} { lappend_if [have_spec nova] build_components drivers/platform/spec/x86/device_pd } + proc append_platform_drv_boot_modules {} { global boot_modules @@ -29,6 +50,7 @@ proc append_platform_drv_boot_modules {} { lappend_if [have_spec muen] boot_modules acpi } + proc platform_drv_policy {} { if ([have_spec x86]) { @@ -50,6 +72,7 @@ proc platform_drv_policy {} { } } + proc platform_drv_priority {} { return "" } proc platform_drv_add_routing {} { if {[have_spec acpi]} { @@ -60,6 +83,7 @@ proc platform_drv_add_routing {} { return "" } + proc platform_drv_config_config {} { if {[have_spec acpi] || [have_spec arm] || [have_spec muen]} { return { @@ -70,6 +94,7 @@ proc platform_drv_config_config {} { } } + proc append_platform_drv_config {} { global config diff --git a/repos/gems/run/cpu_load_display.run b/repos/gems/run/cpu_load_display.run index 3edc8fe232..df1a7b02c3 100644 --- a/repos/gems/run/cpu_load_display.run +++ b/repos/gems/run/cpu_load_display.run @@ -18,10 +18,11 @@ set build_components { app/pointer } -lappend_if [have_spec usb] build_components drivers/usb +source ${genode_dir}/repos/base/run/platform_drv.inc + +lappend_if [need_usb_hid] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio -source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components build $build_components @@ -88,7 +89,7 @@ append_if [have_spec ps2] config { } -append_if [expr ![have_spec ps2] && [have_spec usb]] config { +append_if [need_usb_hid] config { @@ -225,7 +226,7 @@ append_platform_drv_boot_modules lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [have_spec usb] boot_modules usb_drv +lappend_if [need_usb_hid] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv lappend_if [have_spec imx53] boot_modules input_drv diff --git a/repos/gems/run/cpu_sampler_noux.run b/repos/gems/run/cpu_sampler_noux.run index 5797755f3c..36ebf0cf95 100644 --- a/repos/gems/run/cpu_sampler_noux.run +++ b/repos/gems/run/cpu_sampler_noux.run @@ -4,11 +4,6 @@ if { ![have_spec foc] && ![have_spec nova] && exit 0 } -# -# On OMAP4 where no PS/2 is available, we rely on USB HID -# -proc use_usb_input { } { return [expr ![have_spec ps2] && [have_spec usb]] } - set build_components { core init drivers/timer noux/minimal lib/libc_noux drivers/framebuffer drivers/input @@ -20,7 +15,9 @@ set build_components { test/cpu_sampler } -lappend_if [use_usb_input] build_components drivers/usb +source ${genode_dir}/repos/base/run/platform_drv.inc + +lappend_if [need_usb_hid] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio # @@ -29,7 +26,6 @@ lappend_if [have_spec gpio] build_components drivers/gpio foreach pkg {bash coreutils vim diffutils} { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } -source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components build $build_components @@ -97,7 +93,7 @@ append_if [have_spec gpio] config { } -append_if [use_usb_input] config { +append_if [need_usb_hid] config { @@ -240,7 +236,7 @@ set boot_modules { # platform-specific modules lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [use_usb_input] boot_modules usb_drv +lappend_if [need_usb_hid] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv append_platform_drv_boot_modules diff --git a/repos/gems/run/decorator_stress.run b/repos/gems/run/decorator_stress.run index f4fffc8e87..4cb64831fd 100644 --- a/repos/gems/run/decorator_stress.run +++ b/repos/gems/run/decorator_stress.run @@ -19,8 +19,8 @@ set build_components { source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components -lappend_if [have_spec usb] build_components drivers/usb -lappend_if [have_spec gpio] build_components drivers/gpio +lappend_if [need_usb_hid] build_components drivers/usb +lappend_if [have_spec gpio] build_components drivers/gpio build $build_components @@ -84,7 +84,7 @@ append_if [have_spec ps2] config { } -append_if [expr ![have_spec ps2] && [have_spec usb]] config { +append_if [need_usb_hid] config { @@ -160,12 +160,12 @@ set boot_modules { # platform-specific modules append_platform_drv_boot_modules -lappend_if [have_spec linux] boot_modules fb_sdl -lappend_if [have_spec ps2] boot_modules ps2_drv -lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [have_spec usb] boot_modules usb_drv -lappend_if [have_spec gpio] boot_modules gpio_drv -lappend_if [have_spec imx53] boot_modules input_drv +lappend_if [have_spec linux] boot_modules fb_sdl +lappend_if [have_spec ps2] boot_modules ps2_drv +lappend_if [have_spec framebuffer] boot_modules fb_drv +lappend_if [need_usb_hid] boot_modules usb_drv +lappend_if [have_spec gpio] boot_modules gpio_drv +lappend_if [have_spec imx53] boot_modules input_drv build_boot_image $boot_modules diff --git a/repos/gems/run/wm.run b/repos/gems/run/wm.run index cd3f9e75cd..96ae6052dd 100644 --- a/repos/gems/run/wm.run +++ b/repos/gems/run/wm.run @@ -17,10 +17,11 @@ set build_components { server/nit_fb } -lappend_if [have_spec usb] build_components drivers/usb -lappend_if [have_spec gpio] build_components drivers/gpio - source ${genode_dir}/repos/base/run/platform_drv.inc + +lappend_if [need_usb_hid] build_components drivers/usb +lappend_if [have_spec gpio] build_components drivers/gpio + append_platform_drv_build_components build $build_components @@ -85,7 +86,7 @@ append_if [have_spec ps2] config { } -append_if [expr ![have_spec ps2] && [have_spec usb]] config { +append_if [need_usb_hid] config { @@ -264,12 +265,12 @@ set boot_modules { # platform-specific modules append_platform_drv_boot_modules -lappend_if [have_spec linux] boot_modules fb_sdl -lappend_if [have_spec ps2] boot_modules ps2_drv -lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [have_spec usb] boot_modules usb_drv -lappend_if [have_spec gpio] boot_modules gpio_drv -lappend_if [have_spec imx53] boot_modules input_drv +lappend_if [have_spec linux] boot_modules fb_sdl +lappend_if [have_spec ps2] boot_modules ps2_drv +lappend_if [have_spec framebuffer] boot_modules fb_drv +lappend_if [need_usb_hid] boot_modules usb_drv +lappend_if [have_spec gpio] boot_modules gpio_drv +lappend_if [have_spec imx53] boot_modules input_drv build_boot_image $boot_modules diff --git a/repos/libports/run/qt5_drivers.inc b/repos/libports/run/qt5_drivers.inc index db1eeca196..7f3366fff1 100644 --- a/repos/libports/run/qt5_drivers.inc +++ b/repos/libports/run/qt5_drivers.inc @@ -59,9 +59,7 @@ proc use_timer { feature_arg } { proc use_usb_input { feature_arg } { upvar $feature_arg feature - return [expr {[info exists feature(Input)] && - ([have_spec usb] || - ([have_spec x86] && ![have_spec linux]))}] + return [expr {[info exists feature(Input)] && [need_usb_hid]}] } proc use_usb_nic { feature_arg } { diff --git a/repos/os/run/demo.run b/repos/os/run/demo.run index 7946696017..b57b189ffe 100644 --- a/repos/os/run/demo.run +++ b/repos/os/run/demo.run @@ -17,10 +17,11 @@ set build_components { server/report_rom server/rom_filter } -lappend_if [have_spec usb] build_components drivers/usb +source ${genode_dir}/repos/base/run/platform_drv.inc + +lappend_if [need_usb_hid] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio -source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components build $build_components @@ -85,7 +86,7 @@ append_if [have_spec ps2] config { } -append_if [expr ![have_spec ps2] && [have_spec usb]] config { +append_if [need_usb_hid] config { @@ -253,7 +254,7 @@ set boot_modules { lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [have_spec usb] boot_modules usb_drv +lappend_if [need_usb_hid] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv lappend_if [have_spec imx53] boot_modules input_drv diff --git a/repos/ports/run/noux_bash.run b/repos/ports/run/noux_bash.run index c575d67223..d64e5c21a6 100644 --- a/repos/ports/run/noux_bash.run +++ b/repos/ports/run/noux_bash.run @@ -1,8 +1,3 @@ -# -# On OMAP4 where no PS/2 is available, we rely on USB HID -# -proc use_usb_input { } { return [expr ![have_spec ps2] && [have_spec usb]] } - # # Uncomment the following line when working on the VIM source code. Otherwise, # the package may get recompiled, yet it does not get reinstalled into 'bin/'. @@ -16,8 +11,10 @@ set build_components { test/libports/ncurses } +source ${genode_dir}/repos/base/run/platform_drv.inc + lappend_if [have_spec x86] build_components drivers/rtc -lappend_if [use_usb_input] build_components drivers/usb +lappend_if [need_usb_hid] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio # @@ -26,7 +23,6 @@ lappend_if [have_spec gpio] build_components drivers/gpio foreach pkg {bash coreutils vim diffutils less} { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } -source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components build $build_components @@ -110,7 +106,7 @@ append_if [have_spec gpio] config { } -append_if [use_usb_input] config { +append_if [need_usb_hid] config { @@ -211,7 +207,7 @@ lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec x86] boot_modules rtc_drv lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [use_usb_input] boot_modules usb_drv +lappend_if [need_usb_hid] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv append_platform_drv_boot_modules