]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/build/am64x/r5_mpu.xs
processor-pdk-build: add to PDK
[processor-sdk/pdk.git] / packages / ti / build / am64x / r5_mpu.xs
1 /*
2  * Copyright (c) 2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*
33  *  ======== event_MPU.xs ========
34  *  MPU Settings for am64x device's Cortex-R5F
35  */
37 /*
38  *  -------------------------------------------------------------------------------------------------------------
39  * | Id | Base Address | Size | En | Cacheable                                 | XN | AccPerm             | Mask |
40  * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
41  * | 0  | 0x00000000   | 4GB  | T  | uncacheable, Shareable                    | F  | RW at PL 1 & PL 2   | 0x0  |
42  * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
43  * | 1  | 0 (local TCM)| 32K  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
44  * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
45  * | 2  | 0x41000000   | 32K  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
46  * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
47  * | 3  | 0x41010000   | 32K  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
48  * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
49  * | 4  | 0x41C00000   | 1MB  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
50  *  -------------------------------------------------------------------------------------------------------------
51  * | 5  | 0x70000000   | 8MB  | T  | MSMC Ram - Cachable                       | F  | RW at PL 1          | 0x0  |
52  *  -------------------------------------------------------------------------------------------------------------
53  * | 6  | 0x80000000   | 2GB  | T  | DDR - Strongly Ordered, Shareable         | F  | RW at PL 1 & PL 3   | 0x0  |
54  *  -------------------------------------------------------------------------------------------------------------
55  * | 7  | 0xAA000000   | 32MB | T  | DDR (VRing Buffer) - Uncacheble           | F  | RW at PL 1 & PL 3   | 0x0  |
56  * |-------------------------------------------------------------------------------------------------------------|
57  */
59 /*
60  * Note: Marking a region as shareable will cause the region to behave as outer shareable with write through
61  *       no write-allocate caching policy irrespective of the actual cache policy set. Therefore, only select
62  *       regions that are actually shared outside the R5 CPUSS must be marked as shared.
63  */
65 var MPU = xdc.useModule('ti.sysbios.family.arm.MPU');
66 MPU.enableMPU = true;
67 MPU.enableBackgroundRegion = true;
69 var attrs = new MPU.RegionAttrs();
70 MPU.initRegionAttrsMeta(attrs);
72 /* This entry covers the whole 32 bit memory range
73    Address: 0x00000000-0xffffffff */
74 attrs.enable = true;
75 attrs.bufferable = false;
76 attrs.cacheable = false;
77 attrs.shareable = true;
78 attrs.noExecute = true;
79 attrs.accPerm = 1;          /* RW at PL1 */
80 attrs.tex = 0;
81 attrs.subregionDisableMask = 0;
82 MPU.setRegionMeta(0, 0x00000000, MPU.RegionSize_4G, attrs);
84 /* This entry covers the ATCM mapped to 0 */
85 attrs.enable = true;
86 attrs.bufferable = true;
87 attrs.cacheable = true;
88 attrs.shareable = true;
89 attrs.noExecute = false;
90 attrs.accPerm = 1;          /* RW at PL1 */
91 attrs.tex = 1;
92 attrs.subregionDisableMask = 0;
93 MPU.setRegionMeta(1, 0x00000000, MPU.RegionSize_32K, attrs);
95 /* This entry covers ATCM if mapped to 0x41000000 */
96 attrs.enable = true;
97 attrs.bufferable = true;
98 attrs.cacheable = true;
99 attrs.shareable = false;
100 attrs.noExecute = false;
101 attrs.accPerm = 1;          /* RW at PL1 */
102 attrs.tex = 1;
103 attrs.subregionDisableMask = 0;
104 MPU.setRegionMeta(2, 0x41000000, MPU.RegionSize_32K, attrs);
106 /* This entry covers BTCM if mapped to 0x41010000 */
107 attrs.enable = true;
108 attrs.bufferable = true;
109 attrs.cacheable = true;
110 attrs.shareable = false;
111 attrs.noExecute = false;
112 attrs.accPerm = 1;          /* RW at PL1 */
113 attrs.tex = 1;
114 attrs.subregionDisableMask = 0x0;
115 MPU.setRegionMeta(3, 0x41010000, MPU.RegionSize_32K, attrs);
117 /* This entry covers RAM0 */
118 attrs.enable = true;
119 attrs.bufferable = true;
120 attrs.cacheable = true;
121 attrs.shareable = false;
122 attrs.noExecute = false;
123 attrs.accPerm = 1;          /* RW at PL1 */
124 attrs.tex = 1;
125 attrs.subregionDisableMask = 0;
126 MPU.setRegionMeta(4, 0x41C00000, MPU.RegionSize_1M, attrs);
128 /* This entry covers MSMC SRAM */
129 attrs.enable = true;
130 attrs.bufferable = true;
131 attrs.cacheable = true;
132 attrs.shareable = false;
133 attrs.noExecute = false;
134 attrs.accPerm = 1;          /* RW at PL1 */
135 attrs.tex = 1;
136 attrs.subregionDisableMask = 0;
137 MPU.setRegionMeta(5, 0x70000000, MPU.RegionSize_8M, attrs);
139 /* This entry covers DDR memory */
140 attrs.enable = true;
141 attrs.bufferable = true;
142 attrs.cacheable = true;
143 attrs.shareable = false;
144 attrs.noExecute = false;
145 attrs.accPerm = 0x3;          /* RW at PL1 & PL2 */
146 attrs.tex = 1;
147 attrs.subregionDisableMask = 0;
148 MPU.setRegionMeta(6, 0x80000000, MPU.RegionSize_2G, attrs);
150 /* Ring Buffer uncached.... */
151 attrs.enable = true;
152 attrs.bufferable = false;
153 attrs.cacheable = false;
154 attrs.shareable = true;
155 attrs.noExecute = true;
156 attrs.accPerm = 3;          /* RW at PL1 */
157 attrs.tex = 0;
158 attrs.subregionDisableMask = 0;
159 MPU.setRegionMeta(7, 0xAA000000, MPU.RegionSize_32M, attrs);