source: rtems/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c @ 78c9fe8

5
Last change on this file since 78c9fe8 was 970aa80, checked in by Sebastian Huber <sebastian.huber@…>, on 06/12/14 at 09:18:48

bsp/realview-pbx-a9: Fix SMP startup

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[a91dc98b]1/*
2 * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <info@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
[c499856]12 * http://www.rtems.org/license/LICENSE.
[a91dc98b]13 */
14
[2d3caccf]15#define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION
16
[a91dc98b]17#include <bsp.h>
18#include <bsp/start.h>
19#include <bsp/arm-cp15-start.h>
[db42c079]20#include <bsp/arm-a9mpcore-start.h>
[a91dc98b]21
22BSP_START_DATA_SECTION static const arm_cp15_start_section_config
23rvpbxa9_mmu_config_table[] = {
[fbed79b]24  ARMV7_CP15_START_DEFAULT_SECTIONS,
[a91dc98b]25  {
26    .begin = 0x10000000U,
27    .end = 0x10020000U,
[1dcf5fe]28    .flags = ARMV7_MMU_DEVICE
[a91dc98b]29  }, {
30    .begin = 0x1f000000U,
31    .end = 0x20000000U,
[1dcf5fe]32    .flags = ARMV7_MMU_DEVICE
[2c93c5a]33  }, {
34    .begin = 0x4e000000U,
35    .end = 0x4f000000U,
36    .flags = ARMV7_MMU_DEVICE
[a91dc98b]37  }
38};
39
40BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
41{
42  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
[06adfae]43    ARM_CP15_CTRL_A,
[a91dc98b]44    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
45  );
46
[1df348b]47  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
[a91dc98b]48    ctrl,
49    (uint32_t *) bsp_translation_table_base,
[1dcf5fe]50    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
[a91dc98b]51    &rvpbxa9_mmu_config_table[0],
52    RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table)
53  );
54}
55
[db42c079]56BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
57{
[970aa80]58#ifdef RTEMS_SMP
59  uint32_t cpu_id = arm_cortex_a9_get_multiprocessor_cpu_id();
60
61  /*
62   * QEMU jumps to the entry point of the ELF file on all processors.  Prevent
63   * a SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR this way.
64   */
65  if ( cpu_id >= rtems_configuration_get_maximum_processors() ) {
66    while (true) {
67      _ARM_Wait_for_event();
68    }
69  }
70#endif
71
[db42c079]72  arm_a9mpcore_start_hook_0();
73}
74
[a91dc98b]75BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
76{
[9a037da9]77  arm_a9mpcore_start_hook_1();
[a91dc98b]78  bsp_start_copy_sections();
79  setup_mmu_and_cache();
80  bsp_start_clear_bss();
81}
Note: See TracBrowser for help on using the repository browser.