diff --git a/repos/libports/src/app/acpica/os.cc b/repos/libports/src/app/acpica/os.cc index 0bdf31ab23..29fc72f74a 100644 --- a/repos/libports/src/app/acpica/os.cc +++ b/repos/libports/src/app/acpica/os.cc @@ -109,7 +109,10 @@ struct Acpica::Main Genode::Signal_handler sci_irq; Genode::Constructible sci_conn; - Acpica::Reportstate * report = nullptr; + Acpica::Reportstate * report { nullptr }; + + unsigned unchanged_state_count { 0 }; + unsigned unchanged_state_max; static struct Irq_handler { UINT32 irq; @@ -122,7 +125,8 @@ struct Acpica::Main Main(Genode::Env &env) : env(env), - sci_irq(env.ep(), *this, &Main::acpi_irq) + sci_irq(env.ep(), *this, &Main::acpi_irq), + unchanged_state_max(config.xml().attribute_value("update_unchanged", 20U)) { bool const enable_reset = config.xml().attribute_value("reset", false); bool const enable_poweroff = config.xml().attribute_value("poweroff", false); @@ -177,8 +181,24 @@ struct Acpica::Main AcpiOsWaitEventsComplete(); - if (report) - report->generate_report(); + if (report) { + bool const changed = report->generate_report(); + + if (unchanged_state_max) { + if (changed) + unchanged_state_count = 0; + else + unchanged_state_count ++; + + if (unchanged_state_count >= unchanged_state_max) { + Genode::log("generate report because of ", + unchanged_state_count, " irqs without state " + "changes"); + report->generate_report(true); + unchanged_state_count = 0; + } + } + } if (res == ACPI_INTERRUPT_HANDLED) return; diff --git a/repos/libports/src/app/acpica/reporter.h b/repos/libports/src/app/acpica/reporter.h index ac5e886c25..3506ef4136 100644 --- a/repos/libports/src/app/acpica/reporter.h +++ b/repos/libports/src/app/acpica/reporter.h @@ -71,9 +71,12 @@ class Acpica::Reportstate { void lid_event() { _changed_lid = true; } void ac_event() { _changed_ac = true; battery_event(); } - void generate_report() + bool generate_report(bool force = false) { - if (_changed_lid) { + bool const changed = _changed_sb || _changed_ec || + _changed_fixed || _changed_lid || _changed_ac; + + if (_changed_lid || force) { _changed_lid = false; if (_lid) Genode::Reporter::Xml_generator xml(_reporter_lid, [&] () { @@ -81,7 +84,7 @@ class Acpica::Reportstate { }); } - if (_changed_ac) { + if (_changed_ac || force) { _changed_ac = false; Genode::Reporter::Xml_generator xml(_reporter_ac, [&] () { for (Callback * ac = _list_ac.first(); ac; ac = ac->next()) @@ -89,7 +92,7 @@ class Acpica::Reportstate { }); } - if (_changed_ec) { + if (_changed_ec || force) { _changed_ec = false; Genode::Reporter::Xml_generator xml(_reporter_ec, [&] () { for (Callback * ec = _list_ec.first(); ec; ec = ec->next()) @@ -97,7 +100,7 @@ class Acpica::Reportstate { }); } - if (_changed_sb) { + if (_changed_sb || force) { _changed_sb = false; Genode::Reporter::Xml_generator xml(_reporter_sb, [&] () { for (Callback * sb = _list_sb.first(); sb; sb = sb->next()) @@ -105,12 +108,14 @@ class Acpica::Reportstate { }); } - if (_changed_fixed) { + if (_changed_fixed || force) { _changed_fixed = false; if (_fixed) Genode::Reporter::Xml_generator xml(_reporter_fix, [&] () { _fixed->generate(xml); }); } + + return changed; } };