diff --git a/repos/base-hw/lib/mk/platform_imx6/core.mk b/repos/base-hw/lib/mk/platform_imx6/core.mk new file mode 100644 index 0000000000..21e856dca0 --- /dev/null +++ b/repos/base-hw/lib/mk/platform_imx6/core.mk @@ -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 diff --git a/repos/base-hw/mk/spec-hw_wand_quad.mk b/repos/base-hw/mk/spec-hw_wand_quad.mk new file mode 100644 index 0000000000..94ecfad6ab --- /dev/null +++ b/repos/base-hw/mk/spec-hw_wand_quad.mk @@ -0,0 +1,20 @@ +# +# \brief Build configurations for 'base-hw' on WandBoard Quad +# \author Nikolay Golikov +# \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) diff --git a/repos/base-hw/src/core/include/spec/imx/board_support.h b/repos/base-hw/src/core/include/spec/imx/board_support.h new file mode 100644 index 0000000000..b21b250bcb --- /dev/null +++ b/repos/base-hw/src/core/include/spec/imx/board_support.h @@ -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 +#include + +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(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED); + write(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); + write(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_ */ diff --git a/repos/base-hw/src/core/include/spec/imx53/board.h b/repos/base-hw/src/core/include/spec/imx53/board.h index 49296dbeb9..ae2760b472 100644 --- a/repos/base-hw/src/core/include/spec/imx53/board.h +++ b/repos/base-hw/src/core/include/spec/imx53/board.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 -#include +/* core includes */ +#include -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(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED); - write(Mpr::ALL_UNBUFFERED_AND_FULLY_TRUSTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(Pacr::ALL_UNBUFFERED_AND_FULLY_UNPROTECTED); - write(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_ */ diff --git a/repos/base-hw/src/core/include/spec/imx/timer.h b/repos/base-hw/src/core/include/spec/imx53/timer.h similarity index 100% rename from repos/base-hw/src/core/include/spec/imx/timer.h rename to repos/base-hw/src/core/include/spec/imx53/timer.h diff --git a/repos/base-hw/src/core/include/spec/imx6/board.h b/repos/base-hw/src/core/include/spec/imx6/board.h new file mode 100644 index 0000000000..48f22a3fb7 --- /dev/null +++ b/repos/base-hw/src/core/include/spec/imx6/board.h @@ -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 +#include + +namespace Genode +{ + /** + * Board driver + */ + class Board : public Imx::Board, public Cortex_a9::Board { }; +} + +#endif /* _BOARD_H_ */ diff --git a/repos/base-hw/src/core/spec/imx53/platform_support.cc b/repos/base-hw/src/core/spec/imx53/platform_support.cc index a1e7449f09..fc58b47f0d 100644 --- a/repos/base-hw/src/core/spec/imx53/platform_support.cc +++ b/repos/base-hw/src/core/spec/imx53/platform_support.cc @@ -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(); } diff --git a/repos/base-hw/src/core/spec/imx53/trustzone/platform_support.cc b/repos/base-hw/src/core/spec/imx53/trustzone/platform_support.cc index b56bd52773..9a0c639279 100644 --- a/repos/base-hw/src/core/spec/imx53/trustzone/platform_support.cc +++ b/repos/base-hw/src/core/spec/imx53/trustzone/platform_support.cc @@ -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(); } diff --git a/repos/base-hw/src/core/spec/imx6/platform_support.cc b/repos/base-hw/src/core/spec/imx6/platform_support.cc new file mode 100644 index 0000000000..b8cdf7b3b9 --- /dev/null +++ b/repos/base-hw/src/core/spec/imx6/platform_support.cc @@ -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 +#include + +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(); } diff --git a/repos/base/include/platform/imx6/drivers/board_base.h b/repos/base/include/platform/imx6/drivers/board_base.h new file mode 100644 index 0000000000..2e0cf23038 --- /dev/null +++ b/repos/base/include/platform/imx6/drivers/board_base.h @@ -0,0 +1,67 @@ +/* + * \brief Board definitions for the Freescale i.MX6 + * \author Nikolay Golikov + * \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_ */ diff --git a/repos/base/mk/spec-platform_imx6.mk b/repos/base/mk/spec-platform_imx6.mk new file mode 100644 index 0000000000..f2bd221a4b --- /dev/null +++ b/repos/base/mk/spec-platform_imx6.mk @@ -0,0 +1,17 @@ +# +# \brief Build-system configurations for Freescale i.MX6 +# \author Nikolay Golikov +# \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) + diff --git a/tool/builddir/etc/build.conf.hw_wand_quad b/tool/builddir/etc/build.conf.hw_wand_quad new file mode 100644 index 0000000000..38fdf9d898 --- /dev/null +++ b/tool/builddir/etc/build.conf.hw_wand_quad @@ -0,0 +1,7 @@ +REPOSITORIES += $(GENODE_DIR)/repos/base-hw + +## +## Kernel-specific run tool configuration +## + +RUN_OPT = --include boot_dir/hw diff --git a/tool/create_builddir b/tool/create_builddir index 5254218039..de9b538d16 100755 --- a/tool/create_builddir +++ b/tool/create_builddir @@ -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