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/).
This commit is contained in:
Norman Feske 2017-01-20 16:08:01 +01:00
parent 582e4aec02
commit 47a129c6af
8 changed files with 66 additions and 48 deletions

View File

@ -10,6 +10,26 @@ proc have_platform_drv {} {
|| [have_spec x86]] || [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 {} { proc append_platform_drv_build_components {} {
global 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 lappend_if [have_spec nova] build_components drivers/platform/spec/x86/device_pd
} }
proc append_platform_drv_boot_modules {} { proc append_platform_drv_boot_modules {} {
global boot_modules global boot_modules
@ -29,6 +50,7 @@ proc append_platform_drv_boot_modules {} {
lappend_if [have_spec muen] boot_modules acpi lappend_if [have_spec muen] boot_modules acpi
} }
proc platform_drv_policy {} { proc platform_drv_policy {} {
if ([have_spec x86]) { if ([have_spec x86]) {
@ -50,6 +72,7 @@ proc platform_drv_policy {} {
} }
} }
proc platform_drv_priority {} { return "" } proc platform_drv_priority {} { return "" }
proc platform_drv_add_routing {} { proc platform_drv_add_routing {} {
if {[have_spec acpi]} { if {[have_spec acpi]} {
@ -60,6 +83,7 @@ proc platform_drv_add_routing {} {
return "" return ""
} }
proc platform_drv_config_config {} { proc platform_drv_config_config {} {
if {[have_spec acpi] || [have_spec arm] || [have_spec muen]} { if {[have_spec acpi] || [have_spec arm] || [have_spec muen]} {
return { return {
@ -70,6 +94,7 @@ proc platform_drv_config_config {} {
<config acpi="no">} <config acpi="no">}
} }
proc append_platform_drv_config {} { proc append_platform_drv_config {} {
global config global config

View File

@ -18,10 +18,11 @@ set build_components {
app/pointer 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 lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components append_platform_drv_build_components
build $build_components build $build_components
@ -88,7 +89,7 @@ append_if [have_spec ps2] config {
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
</start>} </start>}
append_if [expr ![have_spec ps2] && [have_spec usb]] config { append_if [need_usb_hid] config {
<start name="usb_drv"> <start name="usb_drv">
<resource name="RAM" quantum="12M"/> <resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
@ -225,7 +226,7 @@ append_platform_drv_boot_modules
lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_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 gpio] boot_modules gpio_drv
lappend_if [have_spec imx53] boot_modules input_drv lappend_if [have_spec imx53] boot_modules input_drv

View File

@ -4,11 +4,6 @@ if { ![have_spec foc] && ![have_spec nova] &&
exit 0 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 { set build_components {
core init drivers/timer noux/minimal lib/libc_noux core init drivers/timer noux/minimal lib/libc_noux
drivers/framebuffer drivers/input drivers/framebuffer drivers/input
@ -20,7 +15,9 @@ set build_components {
test/cpu_sampler 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 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} { foreach pkg {bash coreutils vim diffutils} {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } 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 append_platform_drv_build_components
build $build_components build $build_components
@ -97,7 +93,7 @@ append_if [have_spec gpio] config {
<config/> <config/>
</start>} </start>}
append_if [use_usb_input] config { append_if [need_usb_hid] config {
<start name="usb_drv"> <start name="usb_drv">
<resource name="RAM" quantum="12M"/> <resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
@ -240,7 +236,7 @@ set boot_modules {
# platform-specific modules # platform-specific modules
lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_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 lappend_if [have_spec gpio] boot_modules gpio_drv
append_platform_drv_boot_modules append_platform_drv_boot_modules

View File

@ -19,7 +19,7 @@ set build_components {
source ${genode_dir}/repos/base/run/platform_drv.inc source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components append_platform_drv_build_components
lappend_if [have_spec usb] build_components drivers/usb lappend_if [need_usb_hid] build_components drivers/usb
lappend_if [have_spec gpio] build_components drivers/gpio lappend_if [have_spec gpio] build_components drivers/gpio
build $build_components build $build_components
@ -84,7 +84,7 @@ append_if [have_spec ps2] config {
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
</start>} </start>}
append_if [expr ![have_spec ps2] && [have_spec usb]] config { append_if [need_usb_hid] config {
<start name="usb_drv"> <start name="usb_drv">
<resource name="RAM" quantum="12M"/> <resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
@ -163,7 +163,7 @@ append_platform_drv_boot_modules
lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_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 gpio] boot_modules gpio_drv
lappend_if [have_spec imx53] boot_modules input_drv lappend_if [have_spec imx53] boot_modules input_drv

View File

@ -17,10 +17,11 @@ set build_components {
server/nit_fb server/nit_fb
} }
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 lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components append_platform_drv_build_components
build $build_components build $build_components
@ -85,7 +86,7 @@ append_if [have_spec ps2] config {
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
</start>} </start>}
append_if [expr ![have_spec ps2] && [have_spec usb]] config { append_if [need_usb_hid] config {
<start name="usb_drv"> <start name="usb_drv">
<resource name="RAM" quantum="12M"/> <resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
@ -267,7 +268,7 @@ append_platform_drv_boot_modules
lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_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 gpio] boot_modules gpio_drv
lappend_if [have_spec imx53] boot_modules input_drv lappend_if [have_spec imx53] boot_modules input_drv

View File

@ -59,9 +59,7 @@ proc use_timer { feature_arg } {
proc use_usb_input { feature_arg } { proc use_usb_input { feature_arg } {
upvar $feature_arg feature upvar $feature_arg feature
return [expr {[info exists feature(Input)] && return [expr {[info exists feature(Input)] && [need_usb_hid]}]
([have_spec usb] ||
([have_spec x86] && ![have_spec linux]))}]
} }
proc use_usb_nic { feature_arg } { proc use_usb_nic { feature_arg } {

View File

@ -17,10 +17,11 @@ set build_components {
server/report_rom server/rom_filter 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 lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components append_platform_drv_build_components
build $build_components build $build_components
@ -85,7 +86,7 @@ append_if [have_spec ps2] config {
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
</start>} </start>}
append_if [expr ![have_spec ps2] && [have_spec usb]] config { append_if [need_usb_hid] config {
<start name="usb_drv"> <start name="usb_drv">
<resource name="RAM" quantum="12M"/> <resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
@ -253,7 +254,7 @@ set boot_modules {
lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_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 gpio] boot_modules gpio_drv
lappend_if [have_spec imx53] boot_modules input_drv lappend_if [have_spec imx53] boot_modules input_drv

View File

@ -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, # 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/'. # the package may get recompiled, yet it does not get reinstalled into 'bin/'.
@ -16,8 +11,10 @@ set build_components {
test/libports/ncurses test/libports/ncurses
} }
source ${genode_dir}/repos/base/run/platform_drv.inc
lappend_if [have_spec x86] build_components drivers/rtc 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 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} { foreach pkg {bash coreutils vim diffutils less} {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } 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 append_platform_drv_build_components
build $build_components build $build_components
@ -110,7 +106,7 @@ append_if [have_spec gpio] config {
<config/> <config/>
</start>} </start>}
append_if [use_usb_input] config { append_if [need_usb_hid] config {
<start name="usb_drv"> <start name="usb_drv">
<resource name="RAM" quantum="12M"/> <resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides> <provides><service name="Input"/></provides>
@ -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 ps2] boot_modules ps2_drv
lappend_if [have_spec x86] boot_modules rtc_drv lappend_if [have_spec x86] boot_modules rtc_drv
lappend_if [have_spec framebuffer] boot_modules fb_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 lappend_if [have_spec gpio] boot_modules gpio_drv
append_platform_drv_boot_modules append_platform_drv_boot_modules