diff --git a/repos/libports/run/acpi_suspend.run b/repos/libports/run/acpi_suspend.run index d680dcd745..76ecabb8fc 100644 --- a/repos/libports/run/acpi_suspend.run +++ b/repos/libports/run/acpi_suspend.run @@ -82,13 +82,57 @@ proc display_config { } { - + + + + + + } } +proc restartable_drivers { } { + set return_drivers "" + + append return_drivers { + + + + + + + + + + + + + + + + + + + + + + } [display_config] { + } [input_config] { + + + + + + + } + + return $return_drivers +} + + proc gui_config { } { set return_gui "" @@ -474,7 +518,6 @@ build { app/acpica app/pci_decode app/block_tester - test/suspend } create_boot_directory @@ -532,7 +575,7 @@ append config { - + @@ -556,7 +599,7 @@ append config { - + @@ -581,6 +624,7 @@ append config { + @@ -635,40 +679,15 @@ append config { - - - - - - - - - - - - - - - - - - - - - - - - } [display_config] { - } [input_config] { - - - - - - - + + } [restartable_drivers] { - + + } [restartable_drivers] { + + + + @@ -698,16 +717,14 @@ append config { - + - + - + @@ -741,31 +758,11 @@ append config { - - - - - - + - - - - - - - - - - - - - - - } diff --git a/repos/libports/src/test/suspend/component.cc b/repos/libports/src/test/suspend/component.cc deleted file mode 100644 index e8056b3bfb..0000000000 --- a/repos/libports/src/test/suspend/component.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - * \brief Test to trigger ACPI S3 suspend via Pd::managing_system() - * \author Alexander Boettcher - * \date 2022-08-01 - * - */ - -/* - * Copyright (C) 2022 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU Affero General Public License version 3. - */ - -#include -#include -#include - - -using namespace Genode; - - -class Suspend -{ - private: - - Env &_env; - Attached_rom_dataspace _system_rom { _env, "system" }; - Attached_rom_dataspace _sleep_support { _env, "sleep_states" }; - Signal_handler _handler { _env.ep(), *this, - &Suspend::system_update }; - - uint8_t s3_sleep_typea { }; - uint8_t s3_sleep_typeb { }; - bool s3_sleep_valid { }; - - Capability _control_cap { _env.pd().system_control_cap(Affinity::Location()) }; - - struct Client: Genode::Rpc_client - { - explicit Client(Genode::Capability cap) - : Rpc_client(cap) { } - - Pd_session::Managing_system_state system_control(Pd_session::Managing_system_state const &state) override { - return call(state); } - } _system_control { _control_cap }; - - void suspend() - { - /* - * S0: normal power on - * S1: low wake latency sleeping - cpu caches off - no reset vector used on resume in kernel ! - * S2: low wake latency sleep - start from reset vector - * S3: low wake latency sleep - some parts powered off -> "suspend to RAM" - * S4: long wake latency sleep - "suspend to disk" - * S5: soft off state - */ - - if (!s3_sleep_valid) { - warning("suspend ... denied"); - return; - } - - log("suspend S3 (", s3_sleep_typea, ",", s3_sleep_typeb, ") ..."); - - Pd_session::Managing_system_state in, out; - - in.trapno = Pd_session::Managing_system_state::ACPI_SUSPEND_REQUEST; - in.ip = s3_sleep_typea; - in.sp = s3_sleep_typeb; - - out = _system_control.system_control (in); - - if (!out.trapno) - log("suspend failed"); - else - log("resumed from S3"); - } - - void system_update() - { - _system_rom.update(); - _sleep_support.update(); - - if (_system_rom.valid()) { - auto state = _system_rom.xml().attribute_value("state", - String<16>("")); - - log("system update requested to '", state, "'"); - - if (state == "suspend") - suspend(); - } - - if (_sleep_support.valid()) { - _sleep_support.xml().with_optional_sub_node("S3", [&] (auto const &node) { - auto const typea = "SLP_TYPa"; - auto const typeb = "SLP_TYPb"; - - s3_sleep_valid = node.attribute_value("supported", false) && - node.has_attribute(typea) && - node.has_attribute(typeb); - - if (s3_sleep_valid) { - unsigned tmpa = node.attribute_value(typea, 0u); - unsigned tmpb = node.attribute_value(typeb, 0u); - if (tmpa < 256) - s3_sleep_typea = uint8_t(node.attribute_value(typea, 0u)); - else - s3_sleep_valid = false; - - if (tmpb < 256) - s3_sleep_typeb = uint8_t(node.attribute_value(typeb, 0u)); - else - s3_sleep_valid = false; - } - }); - } - } - - public: - - Suspend(Env &env) : _env(env) - { - _system_rom.sigh(_handler); - _sleep_support.sigh(_handler); - - system_update(); - } -}; - -void Component::construct(Genode::Env &env) -{ - static Suspend suspend(env); -} diff --git a/repos/libports/src/test/suspend/target.mk b/repos/libports/src/test/suspend/target.mk deleted file mode 100644 index b8548910ae..0000000000 --- a/repos/libports/src/test/suspend/target.mk +++ /dev/null @@ -1,5 +0,0 @@ -TARGET = test-suspend -SRC_CC = component.cc -LIBS = base - -REQUIRES := x86