source: rtems/bsps/arm/realview-pbx-a9/start/bspstarthooks.c @ 1b57b75

5
Last change on this file since 1b57b75 was 1b57b75, checked in by Sebastian Huber <sebastian.huber@…>, on 07/18/18 at 05:14:41

bsp/realview-pbx-a9: Support unassigned processors

  • Property mode set to 100644
File size: 2.1 KB
Line 
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
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION
16
17#include <bsp.h>
18#include <bsp/start.h>
19#include <bsp/arm-cp15-start.h>
20#include <bsp/arm-a9mpcore-start.h>
21
22#ifdef RTEMS_SMP
23#include <rtems/score/smpimpl.h>
24#endif
25
26BSP_START_DATA_SECTION static const arm_cp15_start_section_config
27rvpbxa9_mmu_config_table[] = {
28  ARMV7_CP15_START_DEFAULT_SECTIONS,
29  {
30    .begin = 0x10000000U,
31    .end = 0x10020000U,
32    .flags = ARMV7_MMU_DEVICE
33  }, {
34    .begin = 0x1f000000U,
35    .end = 0x20000000U,
36    .flags = ARMV7_MMU_DEVICE
37  }, {
38    .begin = 0x4e000000U,
39    .end = 0x4f000000U,
40    .flags = ARMV7_MMU_DEVICE
41  }
42};
43
44BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
45{
46  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
47    ARM_CP15_CTRL_A,
48    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
49  );
50
51  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
52    ctrl,
53    (uint32_t *) bsp_translation_table_base,
54    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
55    &rvpbxa9_mmu_config_table[0],
56    RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table)
57  );
58}
59
60BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
61{
62#ifdef RTEMS_SMP
63  uint32_t cpu_index_self = _SMP_Get_current_processor();
64
65  /*
66   * QEMU jumps to the entry point of the ELF file on all processors.  Prevent
67   * the fatal errors SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR and
68   * SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR this way.
69   */
70  if (
71    cpu_index_self >= rtems_configuration_get_maximum_processors()
72      || !_SMP_Should_start_processor(cpu_index_self)
73  ) {
74    while (true) {
75      _ARM_Wait_for_event();
76    }
77  }
78#endif
79
80  arm_a9mpcore_start_hook_0();
81}
82
83BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
84{
85  arm_a9mpcore_start_hook_1();
86  bsp_start_copy_sections();
87  setup_mmu_and_cache();
88  bsp_start_clear_bss();
89}
Note: See TracBrowser for help on using the repository browser.