2016-11-23 17:07:49 +01:00
|
|
|
/*
|
|
|
|
* \brief Genode environment for ACPICA library
|
|
|
|
* \author Christian Helmuth
|
|
|
|
* \date 2016-11-14
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2016-2017 Genode Labs GmbH
|
2016-11-23 17:07:49 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2016-11-23 17:07:49 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
2016-12-01 17:37:08 +01:00
|
|
|
#include <util/reconstructible.h>
|
2016-11-23 17:07:49 +01:00
|
|
|
#include <acpica/acpica.h>
|
|
|
|
#include <platform_session/client.h>
|
|
|
|
|
|
|
|
#include "env.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Acpica { struct Env; }
|
|
|
|
|
|
|
|
|
|
|
|
struct Acpica::Env
|
|
|
|
{
|
|
|
|
Genode::Env &env;
|
|
|
|
Genode::Allocator &heap;
|
|
|
|
|
2017-11-10 15:21:18 +01:00
|
|
|
Wait_acpi_ready const wait_acpi_ready;
|
|
|
|
|
|
|
|
Genode::Parent::Service_name announce_for_acpica {
|
|
|
|
wait_acpi_ready.enabled ? "Acpi" : Platform::Session::service_name() };
|
2016-11-23 17:07:49 +01:00
|
|
|
|
|
|
|
Genode::Parent::Client parent_client;
|
|
|
|
|
|
|
|
Genode::Id_space<Genode::Parent::Client>::Element id_space_element {
|
|
|
|
parent_client, env.id_space() };
|
|
|
|
|
|
|
|
Genode::Capability<Platform::Session> cap {
|
|
|
|
Genode::reinterpret_cap_cast<Platform::Session>(
|
|
|
|
env.session(announce_for_acpica,
|
|
|
|
id_space_element.id(),
|
2017-03-17 22:11:53 +01:00
|
|
|
"ram_quota=36K", Genode::Affinity())) };
|
2016-11-23 17:07:49 +01:00
|
|
|
|
|
|
|
Platform::Client platform { cap };
|
|
|
|
|
2017-11-10 15:21:18 +01:00
|
|
|
Env(Genode::Env &env, Genode::Allocator &heap, Wait_acpi_ready wait_acpi_ready)
|
|
|
|
: env(env), heap(heap), wait_acpi_ready(wait_acpi_ready) { }
|
2016-11-23 17:07:49 +01:00
|
|
|
};
|
|
|
|
|
2016-12-01 17:37:08 +01:00
|
|
|
static Genode::Constructible<Acpica::Env> instance;
|
2016-11-23 17:07:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
Genode::Allocator & Acpica::heap() { return instance->heap; }
|
|
|
|
Genode::Env & Acpica::env() { return instance->env; }
|
|
|
|
Platform::Client & Acpica::platform() { return instance->platform; }
|
|
|
|
|
|
|
|
|
2017-11-10 15:21:18 +01:00
|
|
|
void Acpica::init(Genode::Env &env, Genode::Allocator &heap,
|
|
|
|
Wait_acpi_ready wait_acpi_ready)
|
2016-11-23 17:07:49 +01:00
|
|
|
{
|
2017-11-10 15:21:18 +01:00
|
|
|
instance.construct(env, heap, wait_acpi_ready);
|
2016-11-23 17:07:49 +01:00
|
|
|
}
|