1 | /* |
---|
2 | * SPDX-License-Identifier: BSD-2-Clause |
---|
3 | * |
---|
4 | * Copyright (C) 2013 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 | |
---|
35 | BSP_START_DATA_SECTION static const arm_cp15_start_section_config |
---|
36 | zynq_mmu_config_table[] = { |
---|
37 | ARMV7_CP15_START_DEFAULT_SECTIONS, |
---|
38 | #if defined(RTEMS_SMP) |
---|
39 | { |
---|
40 | .begin = 0xffff0000U, |
---|
41 | .end = 0xffffffffU, |
---|
42 | .flags = ARMV7_MMU_DEVICE |
---|
43 | }, |
---|
44 | #endif |
---|
45 | { |
---|
46 | .begin = 0xe0000000U, |
---|
47 | .end = 0xe0200000U, |
---|
48 | .flags = ARMV7_MMU_DEVICE |
---|
49 | }, { |
---|
50 | .begin = 0xf8000000U, |
---|
51 | .end = 0xf9000000U, |
---|
52 | .flags = ARMV7_MMU_DEVICE |
---|
53 | } |
---|
54 | }; |
---|
55 | |
---|
56 | /* |
---|
57 | * Make weak and let the user override. |
---|
58 | */ |
---|
59 | BSP_START_TEXT_SECTION void zynq_setup_mmu_and_cache(void) __attribute__ ((weak)); |
---|
60 | |
---|
61 | BSP_START_TEXT_SECTION void zynq_setup_mmu_and_cache(void) |
---|
62 | { |
---|
63 | uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache( |
---|
64 | ARM_CP15_CTRL_A, |
---|
65 | ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z |
---|
66 | ); |
---|
67 | |
---|
68 | arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache( |
---|
69 | ctrl, |
---|
70 | (uint32_t *) bsp_translation_table_base, |
---|
71 | ARM_MMU_DEFAULT_CLIENT_DOMAIN, |
---|
72 | &zynq_mmu_config_table[0], |
---|
73 | RTEMS_ARRAY_SIZE(zynq_mmu_config_table) |
---|
74 | ); |
---|
75 | } |
---|