2015-02-06 17:29:30 +01:00
|
|
|
/*
|
2015-03-18 10:33:00 +01:00
|
|
|
* \brief Platform implementations specific for x86
|
2015-02-06 17:29:30 +01:00
|
|
|
* \author Norman Feske
|
2015-03-18 10:33:00 +01:00
|
|
|
* \author Reto Buerki
|
2015-02-06 17:29:30 +01:00
|
|
|
* \date 2013-04-05
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2015-03-18 10:33:00 +01:00
|
|
|
* Copyright (C) 2013-2015 Genode Labs GmbH
|
2015-02-06 17:29:30 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* core includes */
|
|
|
|
#include <platform.h>
|
2015-03-18 10:33:00 +01:00
|
|
|
#include <board.h>
|
2015-02-06 17:29:30 +01:00
|
|
|
#include <cpu.h>
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
2015-03-18 23:40:58 +01:00
|
|
|
void Platform::_init_io_port_alloc()
|
|
|
|
{
|
|
|
|
_io_port_alloc.add_range(0, 0x10000);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-28 14:56:00 +02:00
|
|
|
/**
|
|
|
|
* Remove given exclude memory regions from specified allocator.
|
|
|
|
*/
|
|
|
|
static void alloc_exclude_regions(Range_allocator * const alloc,
|
|
|
|
Region_pool excl_regions)
|
|
|
|
{
|
|
|
|
Native_region * r = excl_regions(0);
|
|
|
|
for (unsigned i = 0; r; r = excl_regions(++i))
|
|
|
|
alloc->remove_range(r->base, r->size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Platform::_init_io_mem_alloc()
|
|
|
|
{
|
|
|
|
/* add entire adress space minus the RAM memory regions */
|
|
|
|
_io_mem_alloc.add_range(0, ~0x0UL);
|
|
|
|
alloc_exclude_regions(&_io_mem_alloc, _ram_regions);
|
|
|
|
alloc_exclude_regions(&_io_mem_alloc, _core_only_ram_regions);
|
2015-10-27 14:26:40 +01:00
|
|
|
alloc_exclude_regions(&_io_mem_alloc, _core_only_mmio_regions);
|
|
|
|
|
|
|
|
/* exclude all mmio regions from virt allocator of core */
|
|
|
|
alloc_exclude_regions(_core_mem_alloc.virt_alloc(), _core_only_mmio_regions);
|
2015-04-28 14:56:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-19 16:55:21 +01:00
|
|
|
long Platform::irq(long const user_irq)
|
|
|
|
{
|
|
|
|
/* remap IRQ requests to fit I/O APIC configuration */
|
|
|
|
if (user_irq) return user_irq + Board::VECTOR_REMAP_BASE;
|
|
|
|
return Board::TIMER_VECTOR_USER;
|
|
|
|
}
|