2012-10-02 14:27:32 +02:00
|
|
|
/*
|
|
|
|
* \brief Platform implementations specific for base-hw and VEA9X4
|
|
|
|
* \author Martin Stein
|
|
|
|
* \date 2012-04-27
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
2012-10-02 14:27:32 +02:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
2012-12-10 13:55:19 +01:00
|
|
|
/* core includes */
|
|
|
|
#include <board.h>
|
2013-11-05 11:08:05 +01:00
|
|
|
#include <cpu.h>
|
2012-10-02 14:27:32 +02:00
|
|
|
#include <platform.h>
|
2012-12-03 17:21:35 +01:00
|
|
|
#include <pic/vea9x4_trustzone.h>
|
2013-10-30 13:56:57 +01:00
|
|
|
#include <kernel/irq.h>
|
2012-10-02 14:27:32 +02:00
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
2013-10-30 13:56:57 +01:00
|
|
|
namespace Kernel { void init_platform(); }
|
2012-10-02 14:27:32 +02:00
|
|
|
|
2013-10-30 13:56:57 +01:00
|
|
|
/**
|
|
|
|
* Interrupts that core shall provide to users
|
|
|
|
*
|
|
|
|
* Interrupts that are used by the non-secure world are also
|
|
|
|
* not provided to the secure-world Genode to prevent contention.
|
|
|
|
*/
|
|
|
|
static unsigned irq_ids[] =
|
2012-10-02 14:27:32 +02:00
|
|
|
{
|
2013-10-30 13:56:57 +01:00
|
|
|
Board::PL180_0_IRQ,
|
|
|
|
Board::PL180_1_IRQ,
|
|
|
|
Board::PL011_1_IRQ,
|
|
|
|
Board::PL011_2_IRQ,
|
|
|
|
Board::PL011_3_IRQ
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) };
|
|
|
|
|
|
|
|
|
|
|
|
void Kernel::init_platform()
|
|
|
|
{
|
|
|
|
/* make user IRQs become known by cores IRQ session backend and kernel */
|
|
|
|
static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)];
|
|
|
|
for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) {
|
|
|
|
new (_irqs[i]) Irq(irq_ids[i]);
|
|
|
|
}
|
2012-10-02 14:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-30 13:56:57 +01:00
|
|
|
unsigned * Platform::_irq(unsigned const i)
|
2012-10-02 14:27:32 +02:00
|
|
|
{
|
2013-10-30 13:56:57 +01:00
|
|
|
return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0;
|
2012-10-02 14:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-30 13:56:57 +01:00
|
|
|
Native_region * Platform::_ram_regions(unsigned const i)
|
2012-10-02 14:27:32 +02:00
|
|
|
{
|
|
|
|
static Native_region _regions[] =
|
|
|
|
{
|
2013-10-30 13:56:57 +01:00
|
|
|
{ Board::RAM_3_BASE, Board::RAM_3_SIZE }
|
2012-10-02 14:27:32 +02:00
|
|
|
};
|
|
|
|
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Native_region * Platform::_mmio_regions(unsigned const i)
|
|
|
|
{
|
|
|
|
static Native_region _regions[] =
|
|
|
|
{
|
2012-12-10 13:55:19 +01:00
|
|
|
{ Board::MMIO_0_BASE, Board::MMIO_0_SIZE },
|
|
|
|
{ Board::MMIO_1_BASE, Board::MMIO_1_SIZE },
|
2012-11-07 15:12:56 +01:00
|
|
|
{ 0x60000000, 0x40000000 },
|
2012-12-10 13:55:19 +01:00
|
|
|
{ Board::TZASC_MMIO_BASE, Board::TZASC_MMIO_SIZE },
|
|
|
|
{ Board::TZPC_MMIO_BASE, Board::TZPC_MMIO_SIZE },
|
2012-10-02 14:27:32 +02:00
|
|
|
};
|
|
|
|
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Native_region * Platform::_core_only_mmio_regions(unsigned const i)
|
|
|
|
{
|
|
|
|
static Native_region _regions[] =
|
|
|
|
{
|
|
|
|
/* Core timer and PIC */
|
2012-12-10 13:55:19 +01:00
|
|
|
{ Board::CORTEX_A9_PRIVATE_MEM_BASE,
|
|
|
|
Board::CORTEX_A9_PRIVATE_MEM_SIZE },
|
2012-10-02 14:27:32 +02:00
|
|
|
|
|
|
|
/* Core UART */
|
2012-12-10 13:55:19 +01:00
|
|
|
{ Board::PL011_0_MMIO_BASE, Board::PL011_0_MMIO_SIZE }
|
2012-10-02 14:27:32 +02:00
|
|
|
};
|
|
|
|
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
|
|
|
}
|
2013-11-05 11:08:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
Cpu::User_context::User_context() { cpsr = Psr::init_user_with_trustzone(); }
|