diff --git a/repos/base-hw/src/bootstrap/platform.cc b/repos/base-hw/src/bootstrap/platform.cc index 1b337f764b..c205ff47f2 100644 --- a/repos/base-hw/src/bootstrap/platform.cc +++ b/repos/base-hw/src/bootstrap/platform.cc @@ -175,7 +175,7 @@ Platform::Platform() using namespace Genode; /* prepare the ram allocator */ - board.early_ram_regions.for_each([this] (Memory_region const & region) { + board.early_ram_regions.for_each([this] (unsigned, Memory_region const & region) { ram_alloc.add(region); }); ram_alloc.remove(bootstrap_region); @@ -207,6 +207,6 @@ Platform::Platform() /* add all left RAM to bootinfo */ ram_alloc.for_each_free_region([&] (Memory_region const & r) { bootinfo.ram_regions.add(r); }); - board.late_ram_regions.for_each([&] (Memory_region const & r) { + board.late_ram_regions.for_each([&] (unsigned, Memory_region const & r) { bootinfo.ram_regions.add(r); }); } diff --git a/repos/base-hw/src/core/platform.cc b/repos/base-hw/src/core/platform.cc index b7fa4ca0f5..e54e35e276 100644 --- a/repos/base-hw/src/core/platform.cc +++ b/repos/base-hw/src/core/platform.cc @@ -67,7 +67,7 @@ void Platform::_init_io_mem_alloc() { /* add entire adress space minus the RAM memory regions */ _io_mem_alloc.add_range(0, ~0x0UL); - _boot_info().ram_regions.for_each([this] (Hw::Memory_region const &r) { + _boot_info().ram_regions.for_each([this] (unsigned, Hw::Memory_region const &r) { _io_mem_alloc.remove_range(r.base, r.size); }); }; @@ -82,7 +82,7 @@ Hw::Memory_region_array const & Platform::_core_virt_regions() addr_t Platform::core_phys_addr(addr_t virt) { addr_t ret = 0; - _boot_info().elf_mappings.for_each([&] (Hw::Mapping const & m) + _boot_info().elf_mappings.for_each([&] (unsigned, Hw::Mapping const & m) { if (virt >= m.virt() && virt < (m.virt() + m.size())) ret = (virt - m.virt()) + m.phys(); @@ -165,11 +165,11 @@ Platform::Platform() _core_mem_alloc.virt_alloc().add_range(Hw::Mm::core_heap().base, Hw::Mm::core_heap().size); - _core_virt_regions().for_each([this] (Hw::Memory_region const & r) { + _core_virt_regions().for_each([this] (unsigned, Hw::Memory_region const & r) { _core_mem_alloc.virt_alloc().remove_range(r.base, r.size); }); - _boot_info().elf_mappings.for_each([this] (Hw::Mapping const & m) { + _boot_info().elf_mappings.for_each([this] (unsigned, Hw::Mapping const & m) { _core_mem_alloc.virt_alloc().remove_range(m.virt(), m.size()); }); - _boot_info().ram_regions.for_each([this] (Hw::Memory_region const & region) { + _boot_info().ram_regions.for_each([this] (unsigned, Hw::Memory_region const & region) { _core_mem_alloc.phys_alloc().add_range(region.base, region.size); }); _init_io_port_alloc(); diff --git a/repos/base-hw/src/include/hw/array.h b/repos/base-hw/src/include/hw/array.h deleted file mode 100644 index e8bc9d1bad..0000000000 --- a/repos/base-hw/src/include/hw/array.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * \brief Array class with static size - * \author Stefan Kalkowski - * \date 2016-09-30 - */ - -/* - * Copyright (C) 2016-2017 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. - */ - -#ifndef _SRC__LIB__HW__ARRAY_H_ -#define _SRC__LIB__HW__ARRAY_H_ - -#include - -namespace Hw { template class Array; } - - -template -class Hw::Array -{ - private: - - unsigned _count = 0; - T _objs[MAX]; - - void _init(unsigned i, T obj) { _objs[i] = obj; } - - template - void _init(unsigned i, T obj, TAIL ... tail) - { - _objs[i] = obj; - _init(i+1, tail...); - } - - public: - - Array() {} - - template - Array(ARGS ... args) : _count(sizeof...(ARGS)) - { - static_assert(sizeof...(ARGS) <= MAX, "Array too small!"); - _init(0, args...); - } - - void add(T const & obj) - { - if (_count == MAX) Genode::error("Array too small!"); - else _objs[_count++] = obj; - } - - template - void for_each(FUNC f) const { - for (unsigned i = 0; i < _count; i++) f(_objs[i]); } - - unsigned count() const { return _count; } -}; - -#endif /* _SRC__LIB__HW__ARRAY_H_ */ diff --git a/repos/base-hw/src/include/hw/boot_info.h b/repos/base-hw/src/include/hw/boot_info.h index 3cfdf08125..d679767f95 100644 --- a/repos/base-hw/src/include/hw/boot_info.h +++ b/repos/base-hw/src/include/hw/boot_info.h @@ -22,7 +22,7 @@ namespace Hw { template struct Boot_info; } template struct Hw::Boot_info { - using Mapping_pool = Array; + using Mapping_pool = Genode::Array; addr_t const table; addr_t const table_allocator; diff --git a/repos/base-hw/src/include/hw/memory_map.h b/repos/base-hw/src/include/hw/memory_map.h index 85965996c4..de4454e0e1 100644 --- a/repos/base-hw/src/include/hw/memory_map.h +++ b/repos/base-hw/src/include/hw/memory_map.h @@ -45,7 +45,7 @@ struct Hw::Mmio_space : Hw::Memory_region_array void for_each_mapping(FUNC f) const { addr_t virt_base = Mm::core_mmio().base; - auto lambda = [&] (Memory_region const & r) { + auto lambda = [&] (unsigned, Memory_region const & r) { f(Mapping { r.base, virt_base, r.size, PAGE_FLAGS_KERN_IO }); virt_base += r.size + get_page_size(); }; diff --git a/repos/base-hw/src/include/hw/memory_region.h b/repos/base-hw/src/include/hw/memory_region.h index 27cd76c350..528f00433f 100644 --- a/repos/base-hw/src/include/hw/memory_region.h +++ b/repos/base-hw/src/include/hw/memory_region.h @@ -15,13 +15,13 @@ #define _SRC__LIB__HW__MEMORY_REGION_H_ #include -#include +#include #include namespace Hw { struct Memory_region; - using Memory_region_array = Array; + using Memory_region_array = Genode::Array; }