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