platform_drv: separate acpi and system feature

This commit is contained in:
Alexander Boettcher 2017-11-17 14:45:50 +01:00 committed by Christian Helmuth
parent 0b09cc8cf6
commit 0a5dcc86ed
3 changed files with 32 additions and 23 deletions

View File

@ -40,7 +40,7 @@ proc platform_drv_add_routing {} {
# override default config to react on 'system' ROM changes for reset
proc platform_drv_config_config {} {
return {
<config acpi="yes" system="yes">}
<config acpi="yes" system="yes" acpi_ready="yes">}
}
append_platform_drv_build_components

View File

@ -119,24 +119,32 @@ configured to not wait for the acpi report:
Synchronize ACPI startup and platform driver
--------------------------------------------
If the config attribute 'system' is set to 'yes', the platform driver monitors
a ROM in XML format named 'system'.
If the config attribute 'acpi_ready' is set to 'yes', the platform driver
monitors a ROM in XML format named 'acpi_ready'.
!<start name="platform_drv">
! <config acpi="yes" system="yes">
! <config acpi="yes" acpi_ready="yes">
The platform driver will announce its service not as 'Platform', but instead
as 'Acpi' first.
Additionally, the platform driver will announce the service as 'Acpi' first.
An ACPI application like acpica can connect to the platform driver and may
reconfigure hardware devices according to the ACPI table findings. If the
system state changes to "acpi_ready in the XML ROM 'acpi_ready':
!<system state="acpi_ready"/>
the platform driver will announce the platform session, so that drivers may
start to operate with the platform driver.
the platform driver will announce the platform session as 'Platform', so
that drivers may start to operate with the platform driver.
Hardware reset
--------------
If the config attribute 'system' is set to 'yes', the platform driver monitors
a ROM in XML format named 'system'.
!<start name="platform_drv">
! <config acpi="yes" system="yes">
If the attribute 'state' in the system XML ROM turns to 'reset'
!<system state="reset"/>

View File

@ -47,7 +47,7 @@ struct Platform::Main
Genode::Capability<Genode::Typed_root<Platform::Session_component> > root_cap;
bool _system_rom = false;
bool _acpi_ready = false;
void acpi_update()
{
@ -62,7 +62,7 @@ struct Platform::Main
root_cap = _env.ep().manage(*root);
if (_system_rom) {
if (_acpi_ready) {
Genode::Parent::Service_name announce_for_acpi("Acpi");
_env.parent().announce(announce_for_acpi, root_cap);
} else
@ -71,17 +71,16 @@ struct Platform::Main
void system_update()
{
if (!_system_rom || !system_state.is_constructed() ||
!acpi_ready.is_constructed())
return;
if (system_state.is_constructed())
system_state->update();
system_state->update();
acpi_ready->update();
if (acpi_ready.is_constructed())
acpi_ready->update();
if (!root.is_constructed())
return;
if (system_state->is_valid()) {
if (system_state.is_constructed() && system_state->is_valid()) {
Genode::Xml_node system(system_state->local_addr<char>(),
system_state->size());
@ -91,7 +90,8 @@ struct Platform::Main
if (state == "reset")
root->system_reset();
}
if (acpi_ready->is_valid()) {
if (acpi_ready.is_constructed() && acpi_ready->is_valid()) {
Genode::Xml_node system(acpi_ready->local_addr<char>(),
acpi_ready->size());
@ -112,21 +112,22 @@ struct Platform::Main
_system_report(_env.ep(), *this, &Main::system_update)
{
const Genode::Xml_node config = _config.xml();
bool const system_rom = config.attribute_value("system", false);
bool const wait_for_acpi = config.attribute_value("acpi", true);
_acpi_ready = config.attribute_value("acpi_ready", false);
_system_rom = config.attribute_value("system", false);
typedef Genode::String<8> Value;
Value const wait_for_acpi = config.attribute_value("acpi", Value("yes"));
if (_system_rom) {
if (system_rom) {
/* wait for system state changes, e.g. reset and acpi_ready */
system_state.construct(env, "system");
system_state->sigh(_system_report);
}
if (_acpi_ready) {
acpi_ready.construct(env, "acpi_ready");
acpi_ready->sigh(_system_report);
}
if (wait_for_acpi == "yes") {
if (wait_for_acpi) {
/* for ACPI support, wait for the first valid acpi report */
acpi_rom.construct(env, "acpi");
acpi_rom->sigh(_acpi_report);