2014-06-04 15:35:54 +02:00
|
|
|
/*
|
|
|
|
* \brief Board driver for core on pandaboard
|
|
|
|
* \author Stefan Kalkowski
|
2015-09-02 13:59:31 +02:00
|
|
|
* \author Martin Stein
|
2014-06-04 15:35:54 +02:00
|
|
|
* \date 2014-06-02
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2015-09-02 13:59:31 +02:00
|
|
|
* Copyright (C) 2014-2015 Genode Labs GmbH
|
2014-06-04 15:35:54 +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.
|
|
|
|
*/
|
|
|
|
|
2014-07-09 12:03:17 +02:00
|
|
|
#ifndef _BOARD_H_
|
|
|
|
#define _BOARD_H_
|
2014-06-04 15:35:54 +02:00
|
|
|
|
|
|
|
/* core includes */
|
2015-02-09 11:36:38 +01:00
|
|
|
#include <spec/cortex_a9/board_support.h>
|
2015-09-02 13:59:31 +02:00
|
|
|
#include <spec/arm/pl310.h>
|
2014-06-04 15:35:54 +02:00
|
|
|
|
|
|
|
namespace Genode
|
|
|
|
{
|
2015-09-02 13:59:31 +02:00
|
|
|
class Pl310;
|
|
|
|
class Board;
|
|
|
|
}
|
2014-06-04 15:35:54 +02:00
|
|
|
|
2015-09-02 13:59:31 +02:00
|
|
|
/**
|
|
|
|
* L2 outer cache controller
|
|
|
|
*/
|
|
|
|
class Genode::Pl310 : public Arm::Pl310
|
|
|
|
{
|
|
|
|
private:
|
2014-06-04 15:35:54 +02:00
|
|
|
|
2015-09-02 13:59:31 +02:00
|
|
|
enum Secure_monitor_syscalls
|
|
|
|
{
|
|
|
|
L2_CACHE_SET_DEBUG_REG = 0x100,
|
|
|
|
L2_CACHE_ENABLE_REG = 0x102,
|
|
|
|
L2_CACHE_AUX_REG = 0x109,
|
2014-06-04 15:35:54 +02:00
|
|
|
};
|
|
|
|
|
2015-09-02 13:59:31 +02:00
|
|
|
static inline void _secure_monitor_call(addr_t func, addr_t val)
|
|
|
|
{
|
|
|
|
register addr_t _func asm("r12") = func;
|
|
|
|
register addr_t _val asm("r0") = val;
|
|
|
|
asm volatile(
|
|
|
|
"dsb; smc #0" ::
|
|
|
|
"r" (_func), "r" (_val) :
|
|
|
|
"memory", "cc", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
|
|
"r8", "r9", "r10", "r11");
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
void flush()
|
|
|
|
{
|
|
|
|
_secure_monitor_call(L2_CACHE_SET_DEBUG_REG, 0x3);
|
|
|
|
Arm::Pl310::flush();
|
|
|
|
_secure_monitor_call(L2_CACHE_SET_DEBUG_REG, 0x0);
|
|
|
|
}
|
|
|
|
|
|
|
|
Pl310(addr_t const base) : Arm::Pl310(base)
|
|
|
|
{
|
|
|
|
_secure_monitor_call(L2_CACHE_AUX_REG, Aux::init_value());
|
|
|
|
_secure_monitor_call(L2_CACHE_ENABLE_REG, 1);
|
|
|
|
_init();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Board driver for core
|
|
|
|
*/
|
|
|
|
class Genode::Board : public Cortex_a9::Board
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-06-04 15:35:54 +02:00
|
|
|
static void outer_cache_invalidate();
|
|
|
|
static void outer_cache_flush();
|
|
|
|
static void prepare_kernel();
|
2014-10-10 16:13:52 +02:00
|
|
|
static void secondary_cpus_ip(void * const ip) { }
|
2014-08-27 11:57:16 +02:00
|
|
|
static bool is_smp() { return true; }
|
2015-09-02 13:59:31 +02:00
|
|
|
};
|
2014-06-04 15:35:54 +02:00
|
|
|
|
2014-07-09 12:03:17 +02:00
|
|
|
#endif /* _BOARD_H_ */
|