mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 06:33:31 +00:00
acpica: provide verbose config
If "verbose" is set to true in the config, AcpiOsPrintf etc. are enabled to log to a dedicated LOG session using the Format:Console utility. Issue #5083
This commit is contained in:
parent
a6b30d58df
commit
30e37d90dd
@ -162,9 +162,10 @@ set config {
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="acpica" caps="200">
|
||||
<start name="acpica" caps="400">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<config ld_verbose="yes" reset="yes" poweroff="yes" report="yes" report_period_ms="0">
|
||||
<config ld_verbose="yes" reset="yes" poweroff="yes" report="yes"
|
||||
report_period_ms="0" verbose="yes">
|
||||
</config>
|
||||
<route>
|
||||
<service name="ROM" label="system"> <child name="dynamic_rom"/> </service>
|
||||
|
@ -41,13 +41,16 @@ Furthermore the ACPICA library may trigger, dependent on the ACPI ASL code,
|
||||
various I/O port and I/O mem accesses to hardware. Accesses to PCI devices are
|
||||
ignored and dropped by this component.
|
||||
|
||||
Log verbosity can be increased by the "verbose" config attribute.
|
||||
|
||||
Excerpt of important parts of the acpica configuration
|
||||
------------------------------------------------------
|
||||
|
||||
!<start name="acpica">
|
||||
! <!-- <binary name="debug-acpica"/> -->
|
||||
! ...
|
||||
! <config reset="no" sleep="no" poweroff="no" report="yes" report_period_ms="2000" use_gpe="true"/>
|
||||
! <config reset="no" sleep="no" poweroff="no" report="yes" report_period_ms="2000"
|
||||
use_gpe="true" verbose="no"/>
|
||||
! <route>
|
||||
! <service name="ROM" label="system"> <child name="..."/> </service>
|
||||
! <service name="Report"> <child name="..."/> </service>
|
||||
|
@ -200,11 +200,15 @@ struct Acpica::Main
|
||||
bool const enable_reset = config.xml().attribute_value("reset", false);
|
||||
bool const enable_poweroff = config.xml().attribute_value("poweroff", false);
|
||||
bool const enable_report = config.xml().attribute_value("report", false);
|
||||
bool const verbose = config.xml().attribute_value("verbose", false);
|
||||
auto const periodic_ms = config.xml().attribute_value("report_period_ms", 0ULL);
|
||||
|
||||
if (enable_report)
|
||||
report = new (heap) Acpica::Reportstate(env);
|
||||
|
||||
if (verbose)
|
||||
init_printf(env);
|
||||
|
||||
init_acpica(config.xml().attribute_value("use_gpe", true));
|
||||
|
||||
if (enable_report)
|
||||
|
@ -6,12 +6,67 @@
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <log_session/connection.h>
|
||||
#include <format/console.h>
|
||||
|
||||
extern "C"
|
||||
void AcpiOsPrintf (const char *fmt, ...)
|
||||
{ }
|
||||
#include "util.h"
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
struct Formatted_log : Format::Console
|
||||
{
|
||||
Log_connection con;
|
||||
|
||||
char str[Log_session::MAX_STRING_LEN] { };
|
||||
|
||||
size_t pos { };
|
||||
|
||||
Formatted_log(Env &env) : con(env, "debug") { }
|
||||
|
||||
void _out_char(char c) override
|
||||
{
|
||||
if (c != '\n')
|
||||
str[pos++] = c;
|
||||
|
||||
if (c == '\n' || pos == sizeof(str)) {
|
||||
str[pos] = 0;
|
||||
con.write(str);
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static Formatted_log *formatted_log;
|
||||
|
||||
|
||||
void Acpica::init_printf(Env &env)
|
||||
{
|
||||
static Formatted_log instance(env);
|
||||
|
||||
formatted_log = &instance;
|
||||
};
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acpiosxf.h"
|
||||
|
||||
extern "C"
|
||||
void AcpiOsVprintf (const char *fmt, va_list va)
|
||||
{ }
|
||||
{
|
||||
if (formatted_log)
|
||||
formatted_log->vprintf(fmt, va);
|
||||
}
|
||||
|
||||
|
||||
void AcpiOsPrintf (const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
AcpiOsVprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
TARGET := acpica
|
||||
SRC_CC := os.cc printf.cc report.cc
|
||||
REQUIRES := x86
|
||||
LIBS += base acpica
|
||||
LIBS += base acpica format
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
|
@ -13,12 +13,18 @@
|
||||
#ifndef _ACPICA__UTIL_H_
|
||||
#define _ACPICA__UTIL_H_
|
||||
|
||||
#include <base/env.h>
|
||||
#include <os/reporter.h>
|
||||
|
||||
extern "C" {
|
||||
#include "acpi.h"
|
||||
}
|
||||
|
||||
|
||||
namespace Acpica {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
template<typename> class Buffer;
|
||||
template<typename> class Callback;
|
||||
|
||||
@ -26,6 +32,8 @@ namespace Acpica {
|
||||
void for_each_element(H const head, S *, F const &fn, FSIZE const &fn_size);
|
||||
|
||||
void generate_suspend_report(Genode::Reporter::Xml_generator &);
|
||||
|
||||
void init_printf(Env &);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user