From e6e1d8c1449fddcc4be2cbbda7ad22f49a297410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 13 Feb 2017 20:03:28 +0100 Subject: [PATCH] platform/arm: remove usage of deprecated env() Issue #2280. --- .../src/drivers/platform/spec/arndale/cmu.h | 8 ++++---- .../src/drivers/platform/spec/arndale/main.cc | 6 ++++-- .../src/drivers/platform/spec/arndale/pmu.h | 7 ++++--- .../os/src/drivers/platform/spec/imx53/ccm.h | 6 +++--- .../os/src/drivers/platform/spec/imx53/iim.h | 6 +++--- .../src/drivers/platform/spec/imx53/iomux.h | 10 +++++----- .../src/drivers/platform/spec/imx53/main.cc | 19 +++++++++++-------- .../os/src/drivers/platform/spec/imx53/src.h | 6 +++--- .../src/drivers/platform/spec/odroid_x2/cmu.h | 6 +++--- .../drivers/platform/spec/odroid_x2/main.cc | 7 ++++--- .../src/drivers/platform/spec/odroid_x2/pmu.h | 5 +++-- .../os/src/drivers/platform/spec/rpi/main.cc | 7 ++++--- repos/os/src/drivers/platform/spec/rpi/mbox.h | 13 +++++++++---- 13 files changed, 60 insertions(+), 46 deletions(-) diff --git a/repos/os/src/drivers/platform/spec/arndale/cmu.h b/repos/os/src/drivers/platform/spec/arndale/cmu.h index 29d76f8234..d22f24c1cf 100644 --- a/repos/os/src/drivers/platform/spec/arndale/cmu.h +++ b/repos/os/src/drivers/platform/spec/arndale/cmu.h @@ -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) { /** diff --git a/repos/os/src/drivers/platform/spec/arndale/main.cc b/repos/os/src/drivers/platform/spec/arndale/main.cc index c2ac8e6cf2..861bed0e25 100644 --- a/repos/os/src/drivers/platform/spec/arndale/main.cc +++ b/repos/os/src/drivers/platform/spec/arndale/main.cc @@ -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) { diff --git a/repos/os/src/drivers/platform/spec/arndale/pmu.h b/repos/os/src/drivers/platform/spec/arndale/pmu.h index d61f6f2f98..ea57718b32 100644 --- a/repos/os/src/drivers/platform/spec/arndale/pmu.h +++ b/repos/os/src/drivers/platform/spec/arndale/pmu.h @@ -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(0); write(0); diff --git a/repos/os/src/drivers/platform/spec/imx53/ccm.h b/repos/os/src/drivers/platform/spec/imx53/ccm.h index 3fbaa6754c..49165439d7 100644 --- a/repos/os/src/drivers/platform/spec/imx53/ccm.h +++ b/repos/os/src/drivers/platform/spec/imx53/ccm.h @@ -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 i2c_1_enable(void) { write(3); } diff --git a/repos/os/src/drivers/platform/spec/imx53/iim.h b/repos/os/src/drivers/platform/spec/imx53/iim.h index b4add3a550..7266d179f0 100644 --- a/repos/os/src/drivers/platform/spec/imx53/iim.h +++ b/repos/os/src/drivers/platform/spec/imx53/iim.h @@ -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()) {} unsigned long revision() { return read() & 0xf; } diff --git a/repos/os/src/drivers/platform/spec/imx53/iomux.h b/repos/os/src/drivers/platform/spec/imx53/iomux.h index f2b74a8942..c2298cb127 100644 --- a/repos/os/src/drivers/platform/spec/imx53/iomux.h +++ b/repos/os/src/drivers/platform/spec/imx53/iomux.h @@ -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()) { - } + 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 i2c_2_enable() { diff --git a/repos/os/src/drivers/platform/spec/imx53/main.cc b/repos/os/src/drivers/platform/spec/imx53/main.cc index 525e395394..bd94b6a943 100644 --- a/repos/os/src/drivers/platform/spec/imx53/main.cc +++ b/repos/os/src/drivers/platform/spec/imx53/main.cc @@ -112,10 +112,12 @@ class Platform::Root : public Genode::Root_component(session_ep, md_alloc) { } + Root(Genode::Env &env, + Genode::Allocator &md_alloc) + : Genode::Root_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)); } diff --git a/repos/os/src/drivers/platform/spec/imx53/src.h b/repos/os/src/drivers/platform/spec/imx53/src.h index 75683e3ae5..eef1f3fac7 100644 --- a/repos/os/src/drivers/platform/spec/imx53/src.h +++ b/repos/os/src/drivers/platform/spec/imx53/src.h @@ -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 reset_ipu() { write(1); } diff --git a/repos/os/src/drivers/platform/spec/odroid_x2/cmu.h b/repos/os/src/drivers/platform/spec/odroid_x2/cmu.h index 604d5ff4bd..4a1c8eb993 100644 --- a/repos/os/src/drivers/platform/spec/odroid_x2/cmu.h +++ b/repos/os/src/drivers/platform/spec/odroid_x2/cmu.h @@ -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) { /** diff --git a/repos/os/src/drivers/platform/spec/odroid_x2/main.cc b/repos/os/src/drivers/platform/spec/odroid_x2/main.cc index a513c183fc..2471f5e476 100644 --- a/repos/os/src/drivers/platform/spec/odroid_x2/main.cc +++ b/repos/os/src/drivers/platform/spec/odroid_x2/main.cc @@ -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) { diff --git a/repos/os/src/drivers/platform/spec/odroid_x2/pmu.h b/repos/os/src/drivers/platform/spec/odroid_x2/pmu.h index 44d1bb869d..a26575b2e6 100644 --- a/repos/os/src/drivers/platform/spec/odroid_x2/pmu.h +++ b/repos/os/src/drivers/platform/spec/odroid_x2/pmu.h @@ -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(0); write(0); diff --git a/repos/os/src/drivers/platform/spec/rpi/main.cc b/repos/os/src/drivers/platform/spec/rpi/main.cc index 9fb81552e3..9129be1dd3 100644 --- a/repos/os/src/drivers/platform/spec/rpi/main.cc +++ b/repos/os/src/drivers/platform/spec/rpi/main.cc @@ -93,8 +93,9 @@ class Platform::Root : public Genode::Root_component(session_ep, md_alloc) { } + Root(Env& env, Allocator & md_alloc) + : Root_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)); } diff --git a/repos/os/src/drivers/platform/spec/rpi/mbox.h b/repos/os/src/drivers/platform/spec/rpi/mbox.h index 505decd453..7245026fcc 100644 --- a/repos/os/src/drivers/platform/spec/rpi/mbox.h +++ b/repos/os/src/drivers/platform/spec/rpi/mbox.h @@ -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 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