mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-23 04:25:21 +00:00
parent
53230d39f4
commit
766060ece6
@ -82,13 +82,57 @@ proc display_config { } {
|
||||
<start name="intel_fb_drv" caps="1000">
|
||||
<binary name="pc_intel_fb_drv"/>
|
||||
<resource name="RAM" quantum="60M"/>
|
||||
<config ld_verbose="yes" width="1024" height="768">
|
||||
<config ld_verbose="yes" width="1024" height="768" system="yes">
|
||||
<report connectors="yes"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="ROM" label="system">
|
||||
<parent label="system"/> </service>
|
||||
<any-service> <any-child/> <parent/> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
}
|
||||
|
||||
|
||||
proc restartable_drivers { } {
|
||||
set return_drivers ""
|
||||
|
||||
append return_drivers {
|
||||
<inline>
|
||||
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="Platform"/>
|
||||
<service name="Report"/>
|
||||
<service name="Timer"/>
|
||||
<service name="Capture"/>
|
||||
<service name="Event"/>
|
||||
<service name="Gui"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <any-child/> <parent/> </any-service>
|
||||
</default-route>
|
||||
|
||||
} [display_config] {
|
||||
} [input_config] {
|
||||
|
||||
<start name="nano3d" caps="100">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
</start>
|
||||
|
||||
</inline>
|
||||
}
|
||||
|
||||
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 {
|
||||
<policy label="platform_drv -> acpi" report="acpi_drv -> acpi"/>
|
||||
<policy label="platform_drv -> devices" report="pci_decode -> devices"/>
|
||||
<policy label="pci_decode -> system" report="acpi_drv -> acpi"/>
|
||||
<policy label="test-suspend -> sleep_states" report="acpica -> sleep_states"/>
|
||||
<policy label="platform_drv -> sleep_states" report="acpica -> sleep_states"/>
|
||||
<policy label="intel_fb_drv -> intel_opregion" report="acpi_drv -> intel_opregion"/>
|
||||
</config>
|
||||
</start>
|
||||
@ -556,7 +599,7 @@ append config {
|
||||
</start>
|
||||
|
||||
<start name="platform_drv" caps="300" managing_system="yes" } [priority_base] {>
|
||||
<binary name="platform_drv"/>
|
||||
<binary name="pc_platform_drv"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides>
|
||||
<service name="Platform"/>
|
||||
@ -581,6 +624,7 @@ append config {
|
||||
<service name="ROM" label="system"> <child name="dynamic_rom"/> </service>
|
||||
<service name="ROM" label="acpi"> <child name="drivers_reports"/> </service>
|
||||
<service name="ROM" label="devices"> <child name="drivers_reports"/> </service>
|
||||
<service name="ROM" label="sleep_states"> <child name="drivers_reports"/> </service>
|
||||
<service name="Report"> <child name="drivers_reports"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
@ -635,40 +679,15 @@ append config {
|
||||
</input>
|
||||
|
||||
<output node="config">
|
||||
<if> <has_value input="check_system" value="online"/>
|
||||
<then>
|
||||
<inline>
|
||||
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="Platform"/>
|
||||
<service name="Report"/>
|
||||
<service name="Timer"/>
|
||||
<service name="Capture"/>
|
||||
<service name="Event"/>
|
||||
<service name="Gui"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <any-child/> <parent/> </any-service>
|
||||
</default-route>
|
||||
|
||||
} [display_config] {
|
||||
} [input_config] {
|
||||
|
||||
<start name="nano3d" caps="100">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
</start>
|
||||
|
||||
</inline>
|
||||
</then>
|
||||
<if> <has_value input="check_system" value=""/>
|
||||
<then> } [restartable_drivers] { </then>
|
||||
<else>
|
||||
<inline/>
|
||||
<if> <has_value input="check_system" value="blanking"/>
|
||||
<then> } [restartable_drivers] { </then>
|
||||
<else>
|
||||
<inline/>
|
||||
</else>
|
||||
</if>
|
||||
</else>
|
||||
</if>
|
||||
</output>
|
||||
@ -698,16 +717,14 @@ append config {
|
||||
<rom name="system">
|
||||
|
||||
<inline description="system normal">
|
||||
<system state="online"/>
|
||||
<system state=""/>
|
||||
</inline>
|
||||
<sleep milliseconds="30000"/>
|
||||
<sleep milliseconds="10000"/>
|
||||
|
||||
<!--
|
||||
<inline description="remove all restartable drivers">
|
||||
<system state="driver_remove_restartable"/>
|
||||
<inline description="disable display connectors">
|
||||
<system state="blanking"/>
|
||||
</inline>
|
||||
<sleep milliseconds="4000"/>
|
||||
-->
|
||||
<sleep milliseconds="10000"/>
|
||||
|
||||
<inline description="notify non-restartable drivers">
|
||||
<system state="driver_stop"/>
|
||||
@ -741,31 +758,11 @@ append config {
|
||||
<inline description="resume system">
|
||||
<system state="s3_resume"/>
|
||||
</inline>
|
||||
<sleep milliseconds="4000"/>
|
||||
|
||||
<inline description="resume system">
|
||||
<system state="driver_reinit"/>
|
||||
</inline>
|
||||
<sleep milliseconds="4000"/>
|
||||
<sleep milliseconds="10000"/>
|
||||
|
||||
</rom>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="test-suspend" managing_system="yes" caps="120" } [priority_scenario] {>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config/>
|
||||
<route>
|
||||
<service name="ROM" label="system">
|
||||
<child name="dynamic_rom"/>
|
||||
</service>
|
||||
<service name="ROM" label="sleep_states">
|
||||
<child name="drivers_reports"/>
|
||||
</service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
</config>
|
||||
}
|
||||
|
||||
|
@ -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 <base/attached_rom_dataspace.h>
|
||||
#include <base/component.h>
|
||||
#include <base/log.h>
|
||||
|
||||
|
||||
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<Suspend> _handler { _env.ep(), *this,
|
||||
&Suspend::system_update };
|
||||
|
||||
uint8_t s3_sleep_typea { };
|
||||
uint8_t s3_sleep_typeb { };
|
||||
bool s3_sleep_valid { };
|
||||
|
||||
Capability<Pd_session::System_control> _control_cap { _env.pd().system_control_cap(Affinity::Location()) };
|
||||
|
||||
struct Client: Genode::Rpc_client<Pd_session::System_control>
|
||||
{
|
||||
explicit Client(Genode::Capability<Pd_session::System_control> cap)
|
||||
: Rpc_client<Pd_session::System_control>(cap) { }
|
||||
|
||||
Pd_session::Managing_system_state system_control(Pd_session::Managing_system_state const &state) override {
|
||||
return call<Rpc_system_control>(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);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
TARGET = test-suspend
|
||||
SRC_CC = component.cc
|
||||
LIBS = base
|
||||
|
||||
REQUIRES := x86
|
Loading…
x
Reference in New Issue
Block a user