platform/arm: remove usage of deprecated env()

Issue #2280.
This commit is contained in:
Josef Söntgen 2017-02-13 20:03:28 +01:00 committed by Christian Helmuth
parent 0b9272bd9c
commit e6e1d8c144
13 changed files with 60 additions and 46 deletions

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
* Copyright (C) 2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
@ -433,9 +433,9 @@ class Cmu : public Regulator::Driver,
/**
* Constructor
*/
Cmu()
: Genode::Attached_mmio(Genode::Board_base::CMU_MMIO_BASE,
Genode::Board_base::CMU_MMIO_SIZE),
Cmu(Genode::Env &env)
: Genode::Attached_mmio(env, Genode::Board_base::CMU_MMIO_BASE,
Genode::Board_base::CMU_MMIO_SIZE),
_cpu_freq(CPU_FREQ_1600)
{
/**

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
* Copyright (C) 2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
@ -26,6 +26,8 @@ struct Driver_factory : Regulator::Driver_factory
Cmu _cmu;
Pmu _pmu;
Driver_factory(Genode::Env &env) : _cmu(env), _pmu(env) { }
Regulator::Driver &create(Regulator::Regulator_id id) {
switch (id) {
case Regulator::CLK_CPU:
@ -53,7 +55,7 @@ struct Main
{
Genode::Env & env;
Genode::Heap heap { env.ram(), env.rm() };
::Driver_factory factory;
::Driver_factory factory { env };
Regulator::Root root { env, heap, factory };
Main(Genode::Env & env) : env(env) {

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
* Copyright (C) 2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
@ -159,8 +159,9 @@ class Pmu : public Regulator::Driver,
/**
* Constructor
*/
Pmu() : Genode::Attached_mmio(Genode::Board_base::PMU_MMIO_BASE,
Genode::Board_base::PMU_MMIO_SIZE)
Pmu(Genode::Env &env)
: Genode::Attached_mmio(env, Genode::Board_base::PMU_MMIO_BASE,
Genode::Board_base::PMU_MMIO_SIZE)
{
write<Hdmi_phy_control ::Enable>(0);
write<Usbdrd_phy_control ::Enable>(0);

View File

@ -65,9 +65,9 @@ class Ccm : public Genode::Attached_io_mem_dataspace,
public:
Ccm()
: Genode::Attached_io_mem_dataspace(Genode::Board_base::CCM_BASE,
Genode::Board_base::CCM_SIZE),
Ccm(Genode::Env &env)
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::CCM_BASE,
Genode::Board_base::CCM_SIZE),
Genode::Mmio((Genode::addr_t)local_addr<void>()) { }
void i2c_1_enable(void) { write<Ccgr1::I2c_1>(3); }

View File

@ -28,9 +28,9 @@ class Iim : public Genode::Attached_io_mem_dataspace,
public:
Iim()
: Genode::Attached_io_mem_dataspace(Genode::Board_base::IIM_BASE,
Genode::Board_base::IIM_SIZE),
Iim(Genode::Env &env)
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::IIM_BASE,
Genode::Board_base::IIM_SIZE),
Genode::Mmio((Genode::addr_t)local_addr<void>()) {}
unsigned long revision() { return read<Fuse_bank0_gp6>() & 0xf; }

View File

@ -58,11 +58,11 @@ class Iomux : public Genode::Attached_io_mem_dataspace,
public:
Iomux()
: Genode::Attached_io_mem_dataspace(Genode::Board_base::IOMUXC_BASE,
Genode::Board_base::IOMUXC_SIZE),
Genode::Mmio((Genode::addr_t)local_addr<void>()) {
}
Iomux(Genode::Env &env)
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::IOMUXC_BASE,
Genode::Board_base::IOMUXC_SIZE),
Genode::Mmio((Genode::addr_t)local_addr<void>())
{ }
void i2c_2_enable()
{

View File

@ -112,10 +112,12 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
{
private:
Iim _iim;
Iomux _iomux;
Ccm _ccm;
Src _src;
Genode::Env &_env;
Iim _iim { _env };
Iomux _iomux { _env };
Ccm _ccm { _env };
Src _src { _env };
protected:
@ -124,9 +126,10 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
public:
Root(Genode::Entrypoint & session_ep,
Genode::Allocator & md_alloc)
: Genode::Root_component<Session_component>(session_ep, md_alloc) { }
Root(Genode::Env &env,
Genode::Allocator &md_alloc)
: Genode::Root_component<Session_component>(env.ep(), md_alloc), _env(env)
{ }
};
@ -134,7 +137,7 @@ struct Main
{
Genode::Env & env;
Genode::Heap heap { env.ram(), env.rm() };
Platform::Root root { env.ep(), heap };
Platform::Root root { env, heap };
Main(Genode::Env & env) : env(env) {
env.parent().announce(env.ep().manage(root)); }

View File

@ -32,9 +32,9 @@ class Src : public Genode::Attached_io_mem_dataspace,
public:
Src()
: Genode::Attached_io_mem_dataspace(Genode::Board_base::SRC_BASE,
Genode::Board_base::SRC_SIZE),
Src(Genode::Env &env)
: Genode::Attached_io_mem_dataspace(env, Genode::Board_base::SRC_BASE,
Genode::Board_base::SRC_SIZE),
Genode::Mmio((Genode::addr_t)local_addr<void>()) {}
void reset_ipu() { write<Ctrl_reg::Ipu_rst>(1); }

View File

@ -311,9 +311,9 @@ class Cmu : public Regulator::Driver,
/**
* Constructor
*/
Cmu()
: Genode::Attached_mmio(Genode::Board_base::CMU_MMIO_BASE,
Genode::Board_base::CMU_MMIO_SIZE),
Cmu(Genode::Env &env)
: Genode::Attached_mmio(env, Genode::Board_base::CMU_MMIO_BASE,
Genode::Board_base::CMU_MMIO_SIZE),
_cpu_freq(CPU_FREQ_1400)
{
/**

View File

@ -28,6 +28,8 @@ struct Driver_factory : Regulator::Driver_factory
Cmu _cmu;
Pmu _pmu;
Driver_factory(Genode::Env &env) : _cmu(env), _pmu(env) { }
Regulator::Driver &create(Regulator::Regulator_id id)
{
switch (id) {
@ -46,8 +48,7 @@ struct Driver_factory : Regulator::Driver_factory
};
}
void destroy(Regulator::Driver &driver) {
}
void destroy(Regulator::Driver &driver) { }
};
@ -55,7 +56,7 @@ struct Main
{
Genode::Env & env;
Genode::Heap heap { env.ram(), env.rm() };
::Driver_factory factory;
::Driver_factory factory { env };
Regulator::Root root { env, heap, factory };
Main(Genode::Env & env) : env(env) {

View File

@ -112,8 +112,9 @@ class Pmu : public Regulator::Driver,
/**
* Constructor
*/
Pmu() : Genode::Attached_mmio(Genode::Board_base::PMU_MMIO_BASE,
Genode::Board_base::PMU_MMIO_SIZE)
Pmu(Genode::Env &env)
: Genode::Attached_mmio(env, Genode::Board_base::PMU_MMIO_BASE,
Genode::Board_base::PMU_MMIO_SIZE)
{
write<Usbdrd_phy_control::Enable>(0);
write<Usbhost_phy1_control::Enable>(0);

View File

@ -93,8 +93,9 @@ class Platform::Root : public Genode::Root_component<Platform::Session_component
public:
Root(Entrypoint & session_ep, Allocator & md_alloc)
: Root_component<Session_component>(session_ep, md_alloc) { }
Root(Env& env, Allocator & md_alloc)
: Root_component<Session_component>(env.ep(), md_alloc), _mbox(env)
{ }
};
@ -102,7 +103,7 @@ struct Main
{
Genode::Env & env;
Genode::Heap heap { env.ram(), env.rm() };
Platform::Root root { env.ep(), heap };
Platform::Root root { env, heap };
Main(Genode::Env & env) : env(env) {
env.parent().announce(env.ep().manage(root)); }

View File

@ -27,6 +27,8 @@ class Mbox : Genode::Attached_mmio
{
private:
Genode::Env &_env;
enum { verbose = false };
typedef Genode::addr_t addr_t;
@ -52,8 +54,8 @@ class Mbox : Genode::Attached_mmio
};
enum { MSG_BUFFER_SIZE = 0x1000 };
Genode::Attached_ram_dataspace _msg_buffer = { Genode::env()->ram_session(),
MSG_BUFFER_SIZE };
Genode::Attached_ram_dataspace _msg_buffer { _env.ram(), _env.rm(),
MSG_BUFFER_SIZE };
addr_t const _msg_phys = { Dataspace_client(_msg_buffer.cap()).phys_addr() };
@ -61,7 +63,9 @@ class Mbox : Genode::Attached_mmio
{
Timer::Connection timer;
void usleep(unsigned us) { timer.usleep(us); }
} _delayer;;
Delayer(Genode::Env &env) : timer(env) { }
} _delayer { _env };
template <typename MESSAGE>
MESSAGE &_message()
@ -71,7 +75,8 @@ class Mbox : Genode::Attached_mmio
public:
Mbox() : Genode::Attached_mmio(BASE, SIZE) { }
Mbox(Genode::Env &env)
: Genode::Attached_mmio(env, BASE, SIZE), _env(env) { }
/**
* Return reference to typed message buffer