mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
parent
fd2a216909
commit
58ff53ec52
@ -129,6 +129,8 @@ struct Acpica::Main
|
||||
void *context;
|
||||
} irq_handler;
|
||||
|
||||
Expanding_reporter report_sleep_states { env, "sleep_states", "sleep_states" };
|
||||
|
||||
void init_acpica();
|
||||
|
||||
Main(Env &env)
|
||||
@ -415,6 +417,11 @@ void Acpica::Main::init_acpica()
|
||||
error("AcpiGetDevices (FUJ02E3) failed, status=", status);
|
||||
return;
|
||||
}
|
||||
|
||||
/* report S0-S5 support and the SLP_TYPa/b values to be used by kernel(s) */
|
||||
report_sleep_states.generate([&] (auto &xml) {
|
||||
Acpica::generate_suspend_report(xml);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
41
repos/libports/src/app/acpica/report.cc
Normal file
41
repos/libports/src/app/acpica/report.cc
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* \brief Generate XML report
|
||||
* \author Alexander Boettcher
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018-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/env.h>
|
||||
#include <os/reporter.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
using namespace Acpica;
|
||||
|
||||
using Genode::Reporter;
|
||||
|
||||
void Acpica::generate_suspend_report(Reporter::Xml_generator &xml)
|
||||
{
|
||||
for (unsigned sleep_state = 1; sleep_state < ACPI_S_STATE_COUNT; sleep_state ++) {
|
||||
UINT8 slp_typa {};
|
||||
UINT8 slp_typb {};
|
||||
|
||||
ACPI_STATUS const result = AcpiGetSleepTypeData (sleep_state,
|
||||
&slp_typa,
|
||||
&slp_typb);
|
||||
|
||||
Genode::String<4> const state_name("S", sleep_state);
|
||||
xml.node(state_name.string(), [&] () {
|
||||
xml.attribute("supported", result == AE_OK);
|
||||
if (result == AE_OK) {
|
||||
xml.attribute("SLP_TYPa", slp_typa);
|
||||
xml.attribute("SLP_TYPb", slp_typb);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
TARGET := acpica
|
||||
SRC_CC := os.cc printf.cc
|
||||
SRC_CC := os.cc printf.cc report.cc
|
||||
REQUIRES := x86
|
||||
LIBS += base acpica
|
||||
|
||||
|
@ -17,15 +17,15 @@ extern "C" {
|
||||
#include "acpi.h"
|
||||
}
|
||||
|
||||
class Bridge;
|
||||
|
||||
namespace Acpica {
|
||||
template<typename> class Buffer;
|
||||
template<typename> class Callback;
|
||||
void generate_report(Genode::Env &, Bridge *);
|
||||
|
||||
template <typename H, typename S, typename F, typename FSIZE>
|
||||
void for_each_element(H const head, S *, F const &fn, FSIZE const &fn_size);
|
||||
|
||||
void generate_suspend_report(Genode::Reporter::Xml_generator &);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user