mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
hw: support Wandboard Quad (i.MX6)
The port uses the Cortex-A9 private timer for the kernel and an EPIT as user timer. It was successfully tested on the Wandboard Quad and the CuBox-i with the signal test. It lacks L2-cache and Trustzone support by now. Thanks to Praveen Srinivas (IIT Madras, India) and Nikolay Golikov (Ksys Labs LLC, Russia). This work is partially based on their contributions. Fix #1467
This commit is contained in:
parent
4f887448c3
commit
60e392f0c0
18
repos/base-hw/lib/mk/platform_imx6/core.mk
Normal file
18
repos/base-hw/lib/mk/platform_imx6/core.mk
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# \brief Build config for Genodes core process
|
||||
# \author Stefan Kalkowski
|
||||
# \author Josef Söntgen
|
||||
# \author Martin Stein
|
||||
# \date 2014-02-25
|
||||
#
|
||||
|
||||
# add include paths
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/imx6
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/imx
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += platform_services.cc
|
||||
SRC_CC += spec/imx6/platform_support.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(REP_DIR)/lib/mk/cortex_a9/core.inc
|
20
repos/base-hw/mk/spec-hw_wand_quad.mk
Normal file
20
repos/base-hw/mk/spec-hw_wand_quad.mk
Normal file
@ -0,0 +1,20 @@
|
||||
#
|
||||
# \brief Build configurations for 'base-hw' on WandBoard Quad
|
||||
# \author Nikolay Golikov <nik@ksyslabs.org>
|
||||
# \author Josef Soentgen
|
||||
# \author Martin Stein
|
||||
# \date 2014-02-25
|
||||
#
|
||||
|
||||
# denote wich specs are also fullfilled by this spec
|
||||
SPECS += hw platform_imx6
|
||||
|
||||
# configure multiprocessor mode
|
||||
NR_OF_CPUS = 1
|
||||
|
||||
# set address where to link the text segment at
|
||||
LD_TEXT_ADDR ?= 0x10001000
|
||||
|
||||
# include implied specs
|
||||
include $(call select_from_repositories,mk/spec-hw.mk)
|
||||
include $(call select_from_repositories,mk/spec-platform_imx6.mk)
|
138
repos/base-hw/src/core/include/spec/imx/board_support.h
Normal file
138
repos/base-hw/src/core/include/spec/imx/board_support.h
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* \brief Board driver
|
||||
* \author Stefan Kalkowski
|
||||
* \author Martin Stein
|
||||
* \date 2012-10-24
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2015 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.
|
||||
*/
|
||||
|
||||
#ifndef _SPEC__IMX__BOARD_SUPPORT_H_
|
||||
#define _SPEC__IMX__BOARD_SUPPORT_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <drivers/board_base.h>
|
||||
#include <util/mmio.h>
|
||||
|
||||
namespace Imx
|
||||
{
|
||||
/**
|
||||
* AHB to IP Bridge
|
||||
*
|
||||
* Interface between the system bus and lower bandwidth IP Slave (IPS)
|
||||
* bus peripherals.
|
||||
*/
|
||||
class Aipstz;
|
||||
|
||||
/**
|
||||
* Board driver
|
||||
*/
|
||||
class Board;
|
||||
}
|
||||
|
||||
class Imx::Aipstz : public Genode::Mmio
|
||||
{
|
||||
/*
|
||||
* Configuration of the masters
|
||||
*/
|
||||
|
||||
struct Mpr { enum { ALL_UNBUFFERED_AND_FULLY_TRUSTED = 0x77777777 }; };
|
||||
struct Mpr1 : Register<0x0, 32>, Mpr { };
|
||||
struct Mpr2 : Register<0x4, 32>, Mpr { };
|
||||
|
||||
/*
|
||||
* Configuration of the platform peripherals
|
||||
*/
|
||||
|
||||
struct Pacr { enum { ALL_UNBUFFERED_AND_FULLY_UNPROTECTED = 0 }; };
|
||||
struct Pacr1 : Register<0x20, 32>, Pacr { };
|
||||
struct Pacr2 : Register<0x24, 32>, Pacr { };
|
||||
struct Pacr3 : Register<0x28, 32>, Pacr { };
|
||||
struct Pacr4 : Register<0x2c, 32>, Pacr { };
|
||||
|
||||
/*
|
||||
* Configuration of the off-platform peripherals
|
||||
*/
|
||||
|
||||
struct Opacr1 : Register<0x40, 32>, Pacr { };
|
||||
struct Opacr2 : Register<0x44, 32>, Pacr { };
|
||||
struct Opacr3 : Register<0x48, 32>, Pacr { };
|
||||
struct Opacr4 : Register<0x4c, 32>, Pacr { };
|
||||
struct Opacr5 : Register<0x50, 32>, Pacr { };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Aipstz(Genode::addr_t const base) : Genode::Mmio(base) { }
|
||||
|
||||
/**
|
||||
* Configure this module appropriately for the first kernel run
|
||||
*/
|
||||
void prepare_kernel()
|
||||
{
|
||||
/* avoid AIPS intervention at any memory access */
|
||||
write<Mpr1>(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED);
|
||||
write<Mpr2>(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED);
|
||||
write<Pacr1>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Pacr2>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Pacr3>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Pacr4>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr1>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr2>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr3>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr4>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr5>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
}
|
||||
};
|
||||
|
||||
class Imx::Board : public Genode::Board_base
|
||||
{
|
||||
/*
|
||||
* static AIPSTZ instances
|
||||
*/
|
||||
|
||||
static Aipstz * _aipstz_1()
|
||||
{
|
||||
static Aipstz a(AIPS_1_MMIO_BASE);
|
||||
return &a;
|
||||
}
|
||||
|
||||
static Aipstz * _aipstz_2()
|
||||
{
|
||||
static Aipstz a(AIPS_2_MMIO_BASE);
|
||||
return &a;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Configure this module appropriately for the first kernel run
|
||||
*/
|
||||
static void prepare_kernel()
|
||||
{
|
||||
_aipstz_1()->prepare_kernel();
|
||||
_aipstz_2()->prepare_kernel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return wether the board has SMP extensions
|
||||
*/
|
||||
static bool is_smp();
|
||||
|
||||
/*
|
||||
* Dummies
|
||||
*/
|
||||
|
||||
static void outer_cache_invalidate() { }
|
||||
static void outer_cache_flush() { }
|
||||
static void secondary_cpus_ip(void *) { }
|
||||
};
|
||||
|
||||
#endif /* _SPEC__IMX__BOARD_SUPPORT_H_ */
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
* \brief Board definitions for core
|
||||
* \brief Board driver
|
||||
* \author Stefan Kalkowski
|
||||
* \author Martin Stein
|
||||
* \date 2012-10-24
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2012-2015 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.
|
||||
@ -14,94 +15,15 @@
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <drivers/board_base.h>
|
||||
#include <util/mmio.h>
|
||||
/* core includes */
|
||||
#include <spec/imx/board_support.h>
|
||||
|
||||
namespace Imx53
|
||||
namespace Genode
|
||||
{
|
||||
class Aipstz : public Genode::Mmio
|
||||
{
|
||||
/**
|
||||
* Configuration of the masters
|
||||
*/
|
||||
struct Mpr { enum { ALL_UNBUFFERED_AND_FULLY_TRUSTED = 0x77777777 }; };
|
||||
struct Mpr1 : Register<0x0, 32>, Mpr { };
|
||||
struct Mpr2 : Register<0x4, 32>, Mpr { };
|
||||
|
||||
/**
|
||||
* Configuration of the platform peripherals
|
||||
*/
|
||||
struct Pacr { enum { ALL_UNBUFFERED_AND_FULLY_UNPROTECTED = 0 }; };
|
||||
struct Pacr1 : Register<0x20, 32>, Pacr { };
|
||||
struct Pacr2 : Register<0x24, 32>, Pacr { };
|
||||
struct Pacr3 : Register<0x28, 32>, Pacr { };
|
||||
struct Pacr4 : Register<0x2c, 32>, Pacr { };
|
||||
|
||||
/**
|
||||
* Configuration of the off-platform peripherals
|
||||
*/
|
||||
struct Opacr1 : Register<0x40, 32>, Pacr { };
|
||||
struct Opacr2 : Register<0x44, 32>, Pacr { };
|
||||
struct Opacr3 : Register<0x48, 32>, Pacr { };
|
||||
struct Opacr4 : Register<0x4c, 32>, Pacr { };
|
||||
struct Opacr5 : Register<0x50, 32>, Pacr { };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Aipstz(Genode::addr_t const base) : Genode::Mmio(base) { }
|
||||
|
||||
/**
|
||||
* Configure this module appropriately for the first kernel run
|
||||
*/
|
||||
void prepare_kernel()
|
||||
{
|
||||
/* avoid AIPS intervention at any memory access */
|
||||
write<Mpr1>(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED);
|
||||
write<Mpr2>(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED);
|
||||
write<Pacr1>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Pacr2>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Pacr3>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Pacr4>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr1>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr2>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr3>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr4>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
write<Opacr5>(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED);
|
||||
}
|
||||
};
|
||||
|
||||
struct Board : Genode::Board_base
|
||||
{
|
||||
/**
|
||||
* static AIPS 1 instance
|
||||
*/
|
||||
static Aipstz * aips_1() { static Aipstz a(AIPS_1_MMIO_BASE); return &a; }
|
||||
|
||||
/**
|
||||
* Static AIPS 2 instance
|
||||
*/
|
||||
static Aipstz * aips_2() { static Aipstz a(AIPS_2_MMIO_BASE); return &a; }
|
||||
|
||||
/**
|
||||
* Configure this module appropriately for the first kernel run
|
||||
*/
|
||||
static void prepare_kernel()
|
||||
{
|
||||
aips_1()->prepare_kernel();
|
||||
aips_2()->prepare_kernel();
|
||||
}
|
||||
|
||||
static bool is_smp() { return false; }
|
||||
static void outer_cache_invalidate() { }
|
||||
static void outer_cache_flush() { }
|
||||
static void secondary_cpus_ip(void *) { }
|
||||
};
|
||||
/**
|
||||
* Board driver
|
||||
*/
|
||||
class Board : public Imx::Board { };
|
||||
}
|
||||
|
||||
namespace Genode { class Board : public Imx53::Board { }; }
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
|
30
repos/base-hw/src/core/include/spec/imx6/board.h
Normal file
30
repos/base-hw/src/core/include/spec/imx6/board.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* \brief Board driver
|
||||
* \author Stefan Kalkowski
|
||||
* \author Martin Stein
|
||||
* \date 2014-02-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2015 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.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/* core includes */
|
||||
#include <spec/imx/board_support.h>
|
||||
#include <spec/cortex_a9/board_support.h>
|
||||
|
||||
namespace Genode
|
||||
{
|
||||
/**
|
||||
* Board driver
|
||||
*/
|
||||
class Board : public Imx::Board, public Cortex_a9::Board { };
|
||||
}
|
||||
|
||||
#endif /* _BOARD_H_ */
|
@ -59,4 +59,6 @@ Native_region * Platform::_core_only_mmio_regions(unsigned const i)
|
||||
}
|
||||
|
||||
|
||||
bool Imx::Board::is_smp() { return false; }
|
||||
|
||||
Cpu::User_context::User_context() { cpsr = Psr::init_user(); }
|
||||
|
@ -104,4 +104,6 @@ Native_region * Platform::_core_only_mmio_regions(unsigned const i)
|
||||
}
|
||||
|
||||
|
||||
bool Imx::Board::is_smp() { return false; }
|
||||
|
||||
Cpu::User_context::User_context() { cpsr = Psr::init_user_with_trustzone(); }
|
||||
|
59
repos/base-hw/src/core/spec/imx6/platform_support.cc
Normal file
59
repos/base-hw/src/core/spec/imx6/platform_support.cc
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* \brief Specific core implementations
|
||||
* \author Stefan Kalkowski
|
||||
* \author Josef Soentgen
|
||||
* \author Martin Stein
|
||||
* \date 2014-02-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2015 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.
|
||||
*/
|
||||
|
||||
/* core includes */
|
||||
#include <platform.h>
|
||||
#include <cpu.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
Native_region * Platform::_ram_regions(unsigned const i)
|
||||
{
|
||||
static Native_region _regions[] =
|
||||
{
|
||||
{ Board::RAM0_BASE, Board::RAM0_SIZE }
|
||||
};
|
||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||
}
|
||||
|
||||
|
||||
Native_region * Platform::_mmio_regions(unsigned const i)
|
||||
{
|
||||
static Native_region _regions[] =
|
||||
{
|
||||
{ Board::MMIO_BASE, Board::MMIO_SIZE }
|
||||
};
|
||||
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 UART */
|
||||
{ Board::UART_1_MMIO_BASE, Board::UART_1_MMIO_SIZE },
|
||||
|
||||
/* CPU-local core MMIO like interrupt controller and timer */
|
||||
{ Board::CORTEX_A9_PRIVATE_MEM_BASE, Board::CORTEX_A9_PRIVATE_MEM_SIZE },
|
||||
|
||||
};
|
||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||
}
|
||||
|
||||
|
||||
bool Imx::Board::is_smp() { return true; }
|
||||
|
||||
Cpu::User_context::User_context() { cpsr = Psr::init_user(); }
|
67
repos/base/include/platform/imx6/drivers/board_base.h
Normal file
67
repos/base/include/platform/imx6/drivers/board_base.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* \brief Board definitions for the Freescale i.MX6
|
||||
* \author Nikolay Golikov <nik@ksyslabs.org>
|
||||
* \author Josef Soentgen
|
||||
* \author Martin Stein
|
||||
* \date 2014-02-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014-2015 Ksys Labs LLC
|
||||
* Copyright (C) 2014-2015 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.
|
||||
*/
|
||||
|
||||
#ifndef _DRIVERS__BOARD_BASE_H_
|
||||
#define _DRIVERS__BOARD_BASE_H_
|
||||
|
||||
namespace Genode
|
||||
{
|
||||
/**
|
||||
* i.MX6 motherboard
|
||||
*/
|
||||
struct Board_base;
|
||||
}
|
||||
|
||||
struct Genode::Board_base
|
||||
{
|
||||
enum {
|
||||
/* normal RAM */
|
||||
RAM0_BASE = 0x10000000,
|
||||
RAM0_SIZE = 0x80000000,
|
||||
|
||||
/* device IO memory */
|
||||
MMIO_BASE = 0x00000000,
|
||||
MMIO_SIZE = 0x10000000,
|
||||
|
||||
UART_1_IRQ = 58,
|
||||
UART_1_MMIO_BASE = 0x02020000,
|
||||
UART_1_MMIO_SIZE = 0x00004000,
|
||||
|
||||
/* timer */
|
||||
EPIT_2_IRQ = 89,
|
||||
EPIT_2_MMIO_BASE = 0x020d4000,
|
||||
EPIT_2_MMIO_SIZE = 0x00004000,
|
||||
|
||||
/* ARM IP Bus control */
|
||||
AIPS_1_MMIO_BASE = 0x0207c000,
|
||||
AIPS_1_MMIO_SIZE = 0x00004000,
|
||||
AIPS_2_MMIO_BASE = 0x0217c000,
|
||||
AIPS_2_MMIO_SIZE = 0x00004000,
|
||||
|
||||
/* CPU */
|
||||
CORTEX_A9_PRIVATE_MEM_BASE = 0x00a00000,
|
||||
CORTEX_A9_PRIVATE_MEM_SIZE = 0x00002000,
|
||||
CORTEX_A9_PRIVATE_TIMER_CLK = 395037500,
|
||||
|
||||
/* CPU cache */
|
||||
CACHE_LINE_SIZE_LOG2 = 5,
|
||||
|
||||
/* wether board provides ARM security extension */
|
||||
SECURITY_EXTENSION = 1,
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* _DRIVERS__BOARD_BASE_H_ */
|
17
repos/base/mk/spec-platform_imx6.mk
Normal file
17
repos/base/mk/spec-platform_imx6.mk
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# \brief Build-system configurations for Freescale i.MX6
|
||||
# \author Nikolay Golikov <nik@ksyslabs.org>
|
||||
# \author Josef Soentgen
|
||||
# \author Martin Stein
|
||||
# \date 2014-02-25
|
||||
#
|
||||
|
||||
# denote wich specs are also fullfilled by this spec
|
||||
SPECS += cortex_a9 imx6 imx epit
|
||||
|
||||
# add repository relative include paths
|
||||
REP_INC_DIR += include/platform/imx6
|
||||
|
||||
# include implied specs
|
||||
include $(call select_from_repositories,mk/spec-cortex_a9.mk)
|
||||
|
7
tool/builddir/etc/build.conf.hw_wand_quad
Normal file
7
tool/builddir/etc/build.conf.hw_wand_quad
Normal file
@ -0,0 +1,7 @@
|
||||
REPOSITORIES += $(GENODE_DIR)/repos/base-hw
|
||||
|
||||
##
|
||||
## Kernel-specific run tool configuration
|
||||
##
|
||||
|
||||
RUN_OPT = --include boot_dir/hw
|
@ -33,6 +33,7 @@ usage:
|
||||
@echo " 'hw_imx53_qsb'"
|
||||
@echo " 'hw_imx53_qsb_tz'"
|
||||
@echo " 'hw_usb_armory'"
|
||||
@echo " 'hw_wand_quad'"
|
||||
@echo " 'hw_arndale'"
|
||||
@echo " 'hw_odroid_xu'"
|
||||
@echo " 'hw_rpi'"
|
||||
@ -237,6 +238,10 @@ hw_usb_armory::
|
||||
@echo "SPECS = genode hw_usb_armory" > $(BUILD_DIR)/etc/specs.conf
|
||||
@echo "SPECS += perf_counter" >> $(BUILD_DIR)/etc/specs.conf
|
||||
|
||||
hw_wand_quad::
|
||||
@echo "SPECS = genode hw_wand_quad" > $(BUILD_DIR)/etc/specs.conf
|
||||
@echo "SPECS += perf_counter" >> $(BUILD_DIR)/etc/specs.conf
|
||||
|
||||
hw_arndale::
|
||||
@echo "SPECS = genode hw_arndale" > $(BUILD_DIR)/etc/specs.conf
|
||||
@echo "SPECS += perf_counter" >> $(BUILD_DIR)/etc/specs.conf
|
||||
|
Loading…
x
Reference in New Issue
Block a user