sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@publishedPartner
|
sl@0
|
19 |
@prototype
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef __MMBOOT_H__
|
sl@0
|
23 |
#define __MMBOOT_H__
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <nk_cpu.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
// Linear address map
|
sl@0
|
28 |
// 00000000-003FFFFF Unmapped
|
sl@0
|
29 |
// 00400000-7EFFFFFF Local data
|
sl@0
|
30 |
// 7F000000-7FFFFFFF IPC Alias region
|
sl@0
|
31 |
// 80000000- ROM
|
sl@0
|
32 |
// -8FFFFFFF Global user area
|
sl@0
|
33 |
// 90000000-EFFFFFFF Kernel memory
|
sl@0
|
34 |
// F0000000-FFF00000 Fixed kernel mappings
|
sl@0
|
35 |
// FFF00000-FFFFFFFF Exception vectors
|
sl@0
|
36 |
//
|
sl@0
|
37 |
|
sl@0
|
38 |
// Linear addresses
|
sl@0
|
39 |
|
sl@0
|
40 |
const TLinAddr KUserLocalDataBase =0x00400000u;
|
sl@0
|
41 |
|
sl@0
|
42 |
const TLinAddr KUserLocalDataEnd =0x7f000000u;
|
sl@0
|
43 |
|
sl@0
|
44 |
const TLinAddr KIPCAlias =0x7f000000u;
|
sl@0
|
45 |
const TLinAddr KIPCAliasAreaSize =0x01000000u;
|
sl@0
|
46 |
|
sl@0
|
47 |
/** Everything above here is global (visible to all processes).*/
|
sl@0
|
48 |
const TLinAddr KGlobalMemoryBase =0x80000000u;
|
sl@0
|
49 |
|
sl@0
|
50 |
const TLinAddr KRomLinearBase =0x80000000u;
|
sl@0
|
51 |
|
sl@0
|
52 |
/** Everything below here has user access permissions, everything above is supervisor only. */
|
sl@0
|
53 |
const TLinAddr KUserMemoryLimit =0x90000000u;
|
sl@0
|
54 |
|
sl@0
|
55 |
const TLinAddr KKernelSectionBase =0x90000000u;
|
sl@0
|
56 |
|
sl@0
|
57 |
const TLinAddr KPrimaryIOBase =0xC6000000u; // XXX This magic constant is hard coded into baseports!
|
sl@0
|
58 |
const TLinAddr KPrimaryIOEnd =0xC8000000u;
|
sl@0
|
59 |
|
sl@0
|
60 |
const TLinAddr KKernelDataBase =0xC8000000u;
|
sl@0
|
61 |
|
sl@0
|
62 |
const TLinAddr KKernelSectionEnd =0xF0000000u;
|
sl@0
|
63 |
|
sl@0
|
64 |
const TLinAddr KSuperPageLinAddr =0xF0000000u;
|
sl@0
|
65 |
const TLinAddr KMachineConfigLinAddr =0xF0000800u;
|
sl@0
|
66 |
#ifdef __SMP__
|
sl@0
|
67 |
const TLinAddr KAPBootPageDirLin =0xF0004000u;
|
sl@0
|
68 |
const TLinAddr KAPBootPageTableLin =0xF0008000u;
|
sl@0
|
69 |
const TLinAddr KAPBootPageLin =0xF0009000u;
|
sl@0
|
70 |
#endif
|
sl@0
|
71 |
const TLinAddr KDummyUncachedAddr =0xF000F000u;
|
sl@0
|
72 |
const TLinAddr KPageInfoMap =0xF0010000u;
|
sl@0
|
73 |
const TLinAddr KExcptStacksLinearBase =0xF0040000u;
|
sl@0
|
74 |
const TLinAddr KExcptStacksLinearEnd =0xF0080000u;
|
sl@0
|
75 |
const TLinAddr KTempAddr =0xF0080000u;
|
sl@0
|
76 |
const TLinAddr KTempAddrEnd =0xF0100000u;
|
sl@0
|
77 |
|
sl@0
|
78 |
const TLinAddr KPageTableInfoBase =0xF0C00000u;
|
sl@0
|
79 |
const TLinAddr KPageTableInfoEnd =0xF1000000u;
|
sl@0
|
80 |
|
sl@0
|
81 |
const TLinAddr KPageArraySegmentBase =0xF1000000u;
|
sl@0
|
82 |
const TLinAddr KPageArraySegmentEnd =0xF2000000u;
|
sl@0
|
83 |
|
sl@0
|
84 |
const TLinAddr KPageInfoLinearBase =0xF2000000u;
|
sl@0
|
85 |
const TLinAddr KPageInfoLinearEnd =0xF4000000u;
|
sl@0
|
86 |
|
sl@0
|
87 |
const TLinAddr KPageDirectoryBase =0xF4000000u;
|
sl@0
|
88 |
const TLinAddr KPageDirectoryEnd =0xF8000000u;
|
sl@0
|
89 |
|
sl@0
|
90 |
const TLinAddr KPageTableBase =0xF8000000u;
|
sl@0
|
91 |
const TLinAddr KPageTableEnd =0xFFF00000u;
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
// Domain usage
|
sl@0
|
95 |
//
|
sl@0
|
96 |
// 0 All, except...
|
sl@0
|
97 |
// 2 IPC Alias chunk
|
sl@0
|
98 |
// 15 User memory when __USER_MEMORY_GUARDS_ENABLED__ defined
|
sl@0
|
99 |
const TInt KIPCAliasDomain = 2;
|
sl@0
|
100 |
const TInt KNumArmDomains = 16; /**< @internalTechnology */
|
sl@0
|
101 |
|
sl@0
|
102 |
// default domain access is client of domain 0, no access to rest
|
sl@0
|
103 |
const TUint32 KDefaultDomainAccess = 0x00000001u; /**< @internalTechnology */
|
sl@0
|
104 |
const TUint32 KSupervisorInitialDomainAccess = 0x00000001u; /**< @internalTechnology */
|
sl@0
|
105 |
|
sl@0
|
106 |
#define PDE_IN_DOMAIN(aPde, aDomain) (((aPde) & ~(15 << 5)) | ((aDomain) << 5))
|
sl@0
|
107 |
|
sl@0
|
108 |
// Constants for ARM V6 MMU
|
sl@0
|
109 |
const TInt KPageShift=12;
|
sl@0
|
110 |
const TInt KPageSize=1<<KPageShift;
|
sl@0
|
111 |
const TInt KPageMask=KPageSize-1;
|
sl@0
|
112 |
const TInt KChunkShift=20;
|
sl@0
|
113 |
const TInt KChunkSize=1<<KChunkShift;
|
sl@0
|
114 |
const TInt KChunkMask=KChunkSize-1;
|
sl@0
|
115 |
const TInt KPageTableShift=KChunkShift-KPageShift+2; // PTE is 4 bytes
|
sl@0
|
116 |
const TInt KPageTableSize=1<<KPageTableShift;
|
sl@0
|
117 |
const TInt KPageTableMask=KPageTableSize-1;
|
sl@0
|
118 |
const TInt KPtClusterShift=KPageShift-KPageTableShift;
|
sl@0
|
119 |
const TInt KPtClusterSize=1<<KPtClusterShift;
|
sl@0
|
120 |
const TInt KPtClusterMask=KPtClusterSize-1;
|
sl@0
|
121 |
const TInt KPtBlockShift=KPageShift-4; /**< @internalTechnology */ // sizeof(SPageTableInfo)=16
|
sl@0
|
122 |
const TInt KPtBlockSize=1<<KPtBlockShift; /**< @internalTechnology */
|
sl@0
|
123 |
const TInt KPtBlockMask=KPtBlockSize-1; /**< @internalTechnology */
|
sl@0
|
124 |
const TInt KPagesInPDEShift=KChunkShift-KPageShift;
|
sl@0
|
125 |
const TInt KPagesInPDE=1<<KPagesInPDEShift;
|
sl@0
|
126 |
const TInt KPagesInPDEMask=KPagesInPDE-1;
|
sl@0
|
127 |
const TInt KLargePageShift=16;
|
sl@0
|
128 |
const TInt KLargePageSize=1<<KLargePageShift;
|
sl@0
|
129 |
const TInt KLargePageMask=KLargePageSize-1;
|
sl@0
|
130 |
|
sl@0
|
131 |
const TInt KPageDirectoryShift=32-KChunkShift+2; // PDE is 4 bytes
|
sl@0
|
132 |
const TInt KPageDirectorySize=1<<KPageDirectoryShift;
|
sl@0
|
133 |
const TInt KPageDirectoryMask=KPageDirectorySize-1;
|
sl@0
|
134 |
|
sl@0
|
135 |
const TInt KMmuAsidCount=256;
|
sl@0
|
136 |
const TInt KMmuAsidMask=KMmuAsidCount-1;
|
sl@0
|
137 |
|
sl@0
|
138 |
const TUint KNumOsAsids=KMmuAsidCount;
|
sl@0
|
139 |
const TUint KKernelOsAsid=0;
|
sl@0
|
140 |
|
sl@0
|
141 |
// Permissions - 3 bit field, APX most significant. When __CPU_MEMORY_TYPE_REMAPPING defined, LSB must be 1
|
sl@0
|
142 |
#if defined(__CPU_MEMORY_TYPE_REMAPPING)
|
sl@0
|
143 |
const TInt KArmV6PermRORO=7; /**< @internalTechnology */ // sup RO user RO
|
sl@0
|
144 |
#else
|
sl@0
|
145 |
const TInt KArmV6PermRORO=6; /**< @internalTechnology */ // sup RO user RO
|
sl@0
|
146 |
#endif
|
sl@0
|
147 |
const TInt KArmV6PermRWNO=1; /**< @internalTechnology */ // sup RW user no access
|
sl@0
|
148 |
const TInt KArmV6PermRWRW=3; /**< @internalTechnology */ // sup RW user RW
|
sl@0
|
149 |
const TInt KArmV6PermRONO=5; /**< @internalTechnology */ // sup RO user no access
|
sl@0
|
150 |
|
sl@0
|
151 |
#if defined(__CPU_MEMORY_TYPE_REMAPPING)
|
sl@0
|
152 |
// ARM1176, ARM11MPCORE, ARMv7
|
sl@0
|
153 |
// TMemoryType is used to describe cache attributes
|
sl@0
|
154 |
// 3 bits are reserved in page table: TEX[0]:C:B
|
sl@0
|
155 |
#else
|
sl@0
|
156 |
// Attributes - 5 bit field, TEX in 2-4, CB in 1,0
|
sl@0
|
157 |
const TInt KArmV6MemAttSO =0x00; /**< @internalTechnology */ // strongly ordered
|
sl@0
|
158 |
const TInt KArmV6MemAttSD =0x01; /**< @internalTechnology */ // shared device
|
sl@0
|
159 |
const TInt KArmV6MemAttNSD =0x08; /**< @internalTechnology */ // non-shared device
|
sl@0
|
160 |
const TInt KArmV6MemAttNCNC =0x04; /**< @internalTechnology */ // normal, outer uncached, inner uncached
|
sl@0
|
161 |
const TInt KArmV6MemAttWTRAWTRA =0x02; /**< @internalTechnology */ // normal, outer WTRA cached, inner WTRA cached
|
sl@0
|
162 |
const TInt KArmV6MemAttWBRAWBRA =0x03; /**< @internalTechnology */ // normal, outer WBRA cached, inner WBRA cached
|
sl@0
|
163 |
const TInt KArmV6MemAttWBWAWBWA =0x15; /**< @internalTechnology */ // normal, outer WBWA cached, inner WBWA cached
|
sl@0
|
164 |
const TInt KArmV6MemAttNCWTRA =0x12; /**< @internalTechnology */ // normal, outer uncached, inner WTRA cached
|
sl@0
|
165 |
const TInt KArmV6MemAttNCWBRA =0x13; /**< @internalTechnology */ // normal, outer uncached, inner WBRA cached
|
sl@0
|
166 |
const TInt KArmV6MemAttNCWBWA =0x11; /**< @internalTechnology */ // normal, outer uncached, inner WBWA cached
|
sl@0
|
167 |
const TInt KArmV6MemAttWTRANC =0x18; /**< @internalTechnology */ // normal, outer WTRA cached, inner uncached
|
sl@0
|
168 |
const TInt KArmV6MemAttWTRAWBRA =0x1B; /**< @internalTechnology */ // normal, outer WTRA cached, inner WBRA cached
|
sl@0
|
169 |
const TInt KArmV6MemAttWTRAWBWA =0x19; /**< @internalTechnology */ // normal, outer WTRA cached, inner WBWA cached
|
sl@0
|
170 |
const TInt KArmV6MemAttWBRANC =0x1C; /**< @internalTechnology */ // normal, outer WBRA cached, inner uncached
|
sl@0
|
171 |
const TInt KArmV6MemAttWBRAWTRA =0x1E; /**< @internalTechnology */ // normal, outer WBRA cached, inner WTRA cached
|
sl@0
|
172 |
const TInt KArmV6MemAttWBRAWBWA =0x1D; /**< @internalTechnology */ // normal, outer WBRA cached, inner WBWA cached
|
sl@0
|
173 |
const TInt KArmV6MemAttWBWANC =0x14; /**< @internalTechnology */ // normal, outer WBWA cached, inner uncached
|
sl@0
|
174 |
const TInt KArmV6MemAttWBWAWTRA =0x16; /**< @internalTechnology */ // normal, outer WBWA cached, inner WTRA cached
|
sl@0
|
175 |
const TInt KArmV6MemAttWBWAWBRA =0x17; /**< @internalTechnology */ // normal, outer WBWA cached, inner WBRA cached
|
sl@0
|
176 |
#endif
|
sl@0
|
177 |
|
sl@0
|
178 |
const TUint32 KArmV6PdePageTable =0x00000001;/**< @internalTechnology */ // L1 descriptor is page table
|
sl@0
|
179 |
const TUint32 KArmV6PdeSection =0x00000002;/**< @internalTechnology */ // L1 descriptor is section
|
sl@0
|
180 |
const TUint32 KArmV6PdeTypeMask =0x00000003;/**< @internalTechnology */
|
sl@0
|
181 |
const TUint32 KArmV6PdeECCEnable =0x00000200;/**< @internalTechnology */ // ECC enable (all L1 descriptors)
|
sl@0
|
182 |
const TUint32 KArmV6PdeSectionXN =0x00000010;/**< @internalTechnology */ // Section not executable
|
sl@0
|
183 |
const TUint32 KArmV6PdeSectionS =0x00010000;/**< @internalTechnology */ // Section shared
|
sl@0
|
184 |
const TUint32 KArmV6PdeSectionNG =0x00020000;/**< @internalTechnology */ // Section not global
|
sl@0
|
185 |
const TUint32 KArmV6PdePermMask =0x00008c00;/**< @internalTechnology */ // Section permission bits
|
sl@0
|
186 |
const TUint32 KArmV6PdeAttMask =0x0000700c;/**< @internalTechnology */ // Section memory attribute bits
|
sl@0
|
187 |
const TUint32 KArmV6PteLargePage =0x00000001;/**< @internalTechnology */ // L2 descriptor is large page
|
sl@0
|
188 |
const TUint32 KArmV6PteSmallPage =0x00000002;/**< @internalTechnology */ // L2 descriptor is small page
|
sl@0
|
189 |
const TUint32 KArmV6PteTypeMask =0x00000003;/**< @internalTechnology */
|
sl@0
|
190 |
const TUint32 KArmV6PteLargeXN =0x00008000;/**< @internalTechnology */ // Large page not executable
|
sl@0
|
191 |
const TUint32 KArmV6PteSmallXN =0x00000001;/**< @internalTechnology */ // Small page not executable
|
sl@0
|
192 |
const TUint32 KArmV6PteS =0x00000400;/**< @internalTechnology */ // Large or small page shared
|
sl@0
|
193 |
const TUint32 KArmV6PteNG =0x00000800;/**< @internalTechnology */ // Large or small page not global
|
sl@0
|
194 |
const TUint32 KArmV6PtePermMask =0x00000230;/**< @internalTechnology */ // Large or small page permission bits
|
sl@0
|
195 |
const TUint32 KArmV6PteLargeAttMask =0x0000700c;/**< @internalTechnology */ // Large page memory attribute bits
|
sl@0
|
196 |
const TUint32 KArmV6PteSmallAttMask =0x000001cc;/**< @internalTechnology */ // Small page memory attribute bits
|
sl@0
|
197 |
// Remapped Access Permission coding:
|
sl@0
|
198 |
const TUint32 KArmV6PteAP2 =0x00000200;/**< @internalTechnology */ // RO / !RW
|
sl@0
|
199 |
const TUint32 KArmV6PteSmallTEX2 =0x00000100;/**< @internalTechnology */
|
sl@0
|
200 |
const TUint32 KArmV6PteSmallTEX1 =0x00000080;/**< @internalTechnology */
|
sl@0
|
201 |
const TUint32 KArmV6PteSmallTEX0 =0x00000040;/**< @internalTechnology */
|
sl@0
|
202 |
const TUint32 KArmV6PteAP1 =0x00000020;/**< @internalTechnology */ // AllAccess / !KernelOnly
|
sl@0
|
203 |
const TUint32 KArmV6PteAP0 =0x00000010;/**< @internalTechnology */ // Must be set
|
sl@0
|
204 |
|
sl@0
|
205 |
const TUint32 KPdePresentMask=KArmV6PdeTypeMask; /**< @internalTechnology */
|
sl@0
|
206 |
const TUint32 KPdeTypeMask=KArmV6PdeTypeMask; /**< @internalTechnology */
|
sl@0
|
207 |
const TUint32 KPdeSectionAddrMask=0xfff00000; /**< @internalTechnology */
|
sl@0
|
208 |
const TUint32 KPdePageTableAddrMask=0xfffffc00; /**< @internalTechnology */
|
sl@0
|
209 |
const TUint32 KPteLargePageAddrMask=0xffff0000; /**< @internalTechnology */
|
sl@0
|
210 |
const TUint32 KPteSmallPageAddrMask=0xfffff000; /**< @internalTechnology */
|
sl@0
|
211 |
const TInt KLargeSmallPageRatio=KLargePageSize/KPageSize; /**< @internalTechnology */
|
sl@0
|
212 |
const TUint32 KPdeUnallocatedEntry=0; /**< @internalTechnology */
|
sl@0
|
213 |
const TUint32 KPteUnallocatedEntry=0; /**< @internalTechnology */
|
sl@0
|
214 |
const TUint32 KPdeMatchMask=0; /**< @internalTechnology */
|
sl@0
|
215 |
const TUint32 KPteMatchMask=0; /**< @internalTechnology */
|
sl@0
|
216 |
const TUint32 KPtePresentMask=KArmV6PteTypeMask; /**< @internalTechnology */
|
sl@0
|
217 |
const TUint32 KPteTypeMask=KArmV6PteTypeMask; /**< @internalTechnology */
|
sl@0
|
218 |
|
sl@0
|
219 |
const TUint32 KTTBRExtraBitsMask =0x0000007f; /**< @internalTechnology */ // Extra bits in TTBR in addition to physical address
|
sl@0
|
220 |
|
sl@0
|
221 |
const TInt KPageInfoShift = 5;
|
sl@0
|
222 |
|
sl@0
|
223 |
#ifdef __CPU_CACHE_HAS_COLOUR
|
sl@0
|
224 |
const TInt KPageColourShift=2;
|
sl@0
|
225 |
#else
|
sl@0
|
226 |
const TInt KPageColourShift=0;
|
sl@0
|
227 |
#endif
|
sl@0
|
228 |
const TInt KPageColourCount=(1<<KPageColourShift);
|
sl@0
|
229 |
const TInt KPageColourMask=KPageColourCount-1;
|
sl@0
|
230 |
|
sl@0
|
231 |
const TInt KAbtStackSize=KPageSize; /**< @internalComponent */
|
sl@0
|
232 |
const TInt KUndStackSize=KPageSize; /**< @internalComponent */
|
sl@0
|
233 |
const TInt KIrqStackSize=KPageSize; /**< @internalComponent */
|
sl@0
|
234 |
const TInt KFiqStackSize=KPageSize; /**< @internalComponent */
|
sl@0
|
235 |
const TInt KExcStackAddressSpace = KIrqStackSize + KFiqStackSize + KUndStackSize + KAbtStackSize + 4*KPageSize; /**< @internalComponent */
|
sl@0
|
236 |
|
sl@0
|
237 |
const TInt KMaxCPUs = 8;
|
sl@0
|
238 |
__ASSERT_COMPILE(KExcptStacksLinearEnd-KExcptStacksLinearBase >= (TLinAddr)KExcStackAddressSpace * (TUint)KMaxCPUs);
|
sl@0
|
239 |
|
sl@0
|
240 |
#endif // __MMBOOT_H__
|