From 4fa34190de351f6a3b3967556e7659d8e497c48b Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 7 May 2019 14:56:02 +0200 Subject: [PATCH] platform_drv: check acpi ability by platform_info Instead of retieving the information about the underlying platform from the configuration, check the running kernel from the platform_info. This commit removes the undocumented "acpi" config attribute. --- repos/base/run/platform_drv.inc | 8 +------ .../os/src/drivers/platform/spec/x86/main.cc | 24 +++++++++++++++---- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/repos/base/run/platform_drv.inc b/repos/base/run/platform_drv.inc index a904a7973..558f23ccf 100644 --- a/repos/base/run/platform_drv.inc +++ b/repos/base/run/platform_drv.inc @@ -175,13 +175,7 @@ proc platform_drv_config_config {} { } } - if {[have_spec acpi] || [have_spec arm] || [have_spec muen]} { - return { - } - } - - return { - } + return {} } diff --git a/repos/os/src/drivers/platform/spec/x86/main.cc b/repos/os/src/drivers/platform/spec/x86/main.cc index a39e22f69..a5da1ca1f 100644 --- a/repos/os/src/drivers/platform/spec/x86/main.cc +++ b/repos/os/src/drivers/platform/spec/x86/main.cc @@ -47,7 +47,8 @@ struct Platform::Main Genode::Capability > root_cap { }; - bool _acpi_ready = false; + bool const _acpi_platform; + bool _acpi_ready = false; void acpi_update() { @@ -57,9 +58,8 @@ struct Platform::Main return; const char * report_addr = acpi_rom->local_addr(); - bool const acpi_platform = _config.xml().attribute_value("acpi", true); - root.construct(_env, sliced_heap, _config, report_addr, acpi_platform); + root.construct(_env, sliced_heap, _config, report_addr, _acpi_platform); root_cap = _env.ep().manage(*root); @@ -92,11 +92,27 @@ struct Platform::Main } } + static bool acpi_platform(Genode::Env & env) + { + using Name = String<32>; + try { + Genode::Attached_rom_dataspace info { env, "platform_info" }; + Name kernel = + info.xml().sub_node("kernel").attribute_value("name", Name()); + if (kernel == "hw" || + kernel == "nova" || + kernel == "foc" || + kernel == "sel4") { return true; } + } catch (...) {} + return false; + } + Main(Genode::Env &env) : _env(env), _acpi_report(_env.ep(), *this, &Main::acpi_update), - _system_report(_env.ep(), *this, &Main::system_update) + _system_report(_env.ep(), *this, &Main::system_update), + _acpi_platform(acpi_platform(env)) { const Genode::Xml_node config = _config.xml();