source: rtems/bsps/arm/xilinx-zynqmp/start/bspstarthooks.c @ 677d5167

5
Last change on this file since 677d5167 was 677d5167, checked in by Jeff Kubascik <jeff.kubascik@…>, on 04/10/19 at 23:38:54

bsp/xilinx-zynqmp: Stub out Xilinx MPSoC BSP

Source files were copied from xilinx-zynq.

Update #3682.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (C) 2013, 2014 embedded brains GmbH
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION
29
30#include <bsp.h>
31#include <bsp/start.h>
32#include <bsp/arm-cp15-start.h>
33#include <bsp/arm-a9mpcore-start.h>
34
35BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
36{
37  uint32_t sctlr_val;
38
39  sctlr_val = arm_cp15_get_control();
40
41  /*
42   * Current U-boot loader seems to start kernel image
43   * with I and D caches on and MMU enabled.
44   * If RTEMS application image finds that cache is on
45   * during startup then disable caches.
46   */
47  if ( sctlr_val & (ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M ) ) {
48    if ( sctlr_val & (ARM_CP15_CTRL_C | ARM_CP15_CTRL_M ) ) {
49      /*
50       * If the data cache is on then ensure that it is clean
51       * before switching off to be extra carefull.
52       */
53      arm_cp15_data_cache_clean_all_levels();
54    }
55    arm_cp15_flush_prefetch_buffer();
56    sctlr_val &= ~ ( ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M | ARM_CP15_CTRL_A );
57    arm_cp15_set_control( sctlr_val );
58  }
59  arm_cp15_instruction_cache_invalidate();
60  /*
61   * The care should be taken there that no shared levels
62   * are invalidated by secondary CPUs in SMP case.
63   * It is not problem on Zynq because level of coherency
64   * is L1 only and higher level is not maintained and seen
65   * by CP15. So no special care to limit levels on the secondary
66   * are required there.
67   */
68  arm_cp15_data_cache_invalidate_all_levels();
69  arm_cp15_branch_predictor_invalidate_all();
70  arm_cp15_tlb_invalidate();
71  arm_cp15_flush_prefetch_buffer();
72  arm_a9mpcore_start_hook_0();
73}
74
75BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
76{
77  arm_a9mpcore_start_hook_1();
78  bsp_start_copy_sections();
79  zynq_setup_mmu_and_cache();
80
81#if !defined(RTEMS_SMP) \
82  && (defined(BSP_DATA_CACHE_ENABLED) \
83    || defined(BSP_INSTRUCTION_CACHE_ENABLED))
84  /* Enable unified L2 cache */
85  rtems_cache_enable_data();
86#endif
87
88  bsp_start_clear_bss();
89}
Note: See TracBrowser for help on using the repository browser.