From 1c0541e7cb849cba804f41dcb3b5be9adfb28db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Fri, 1 Feb 2019 11:50:08 +0100 Subject: [PATCH] run: add power cycle procedure The 'run_genode_until' procedure only called 'run_power_on' to reset the target machine. That works will with the softreset module, which is used by all x86-based test system but falls short regarding ARM boards. The way those boards are connected requires turning the power off and on for a complete cycle. --- repos/gems/run/depot_autopilot.run | 4 ++-- tool/run/run | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/repos/gems/run/depot_autopilot.run b/repos/gems/run/depot_autopilot.run index 96289ebe83..22bed701d1 100644 --- a/repos/gems/run/depot_autopilot.run +++ b/repos/gems/run/depot_autopilot.run @@ -100,8 +100,8 @@ proc autopilot_run_genode_until {{wait_for_re forever} {timeout_value 0} {runnin set retry 3 while { $retry != 0 } { - if {[expr [run_power_on] == false]} { - puts "Power on step failed, retry." + if {![run_power_cycle]} { + puts "Power cycle step failed, retry." sleep 3 incr retry -1; continue diff --git a/tool/run/run b/tool/run/run index dd8f84f38b..1e3d6fda5c 100755 --- a/tool/run/run +++ b/tool/run/run @@ -291,8 +291,12 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id set retry 3 while { $retry != 0 } { - if {[expr [run_power_on] == false]} { - puts "Power on step failed, retry." + # + # Depending an the used run module, a reset can include + # shutting the power off and turning it on again. + # + if (![run_power_cycle]) { + puts "Power cycle step failed, retry." sleep 3 incr retry -1; continue @@ -738,6 +742,23 @@ proc run_power_on { } { return true; } proc run_power_off { } { return true; } +## +# Default power cycle fallback procedure +# +proc run_power_cycle { } { + # + # On targets that are directly connected to a socket, + # turn the socket off and on again. On targets that + # use a module were that is not required, e.g. softreset, + # power_off is a NOP. Note, we give the target some time + # to effectively drain energy before switching it on again. + # + run_power_off + sleep 1 + return [run_power_on] +} + + ## # Default core linker options #