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.
14 // e32\include\memmodel\epoc\multiple\arm\mmboot.h
16 // WARNING: This file contains some APIs which are internal and are subject
17 // to change without notice. Such APIs should therefore not be used
18 // outside the Kernel and Hardware Services package.
31 #include <kernel/cache.h>
34 // Linear address map (1Gb configuration) :
35 // 00000000-001FFFFF Unmapped
36 // 00200000-002FFFFF IPC Alias region
37 // 00300000-003FFFFF Unmapped
38 // 00400000-1FFFFFFF Local data
39 // 20000000-3BFFFFFF Shared data
40 // 3C000000-3DFFFFFF RAM loaded code (=phys ram size up to 256M)
41 // 3E000000-3FFFFFFF DLL static data (=phys ram size/2 up to 128M)
42 // 40000000-7FFFFFFF Unused
43 // 80000000-8FFFFFFF ROM
44 // 90000000-9FFFFFFF User Global Area
45 // A0000000-BFFFFFFF RAM drive
46 // C0000000-C0001FFF Super page/CPU page
47 // C0030000-C0030FFF KPageInfoMap
48 // C0038000-C003FFFF IRQ, FIQ, UND, ABT stacks (4*4K for stacks + 4*4K for guard pages)
49 // C0040000-C00403FF ASID info (256 ASIDs)
50 // C0080000-C00FFFFF Page table info
51 // C1000000-C13FFFFF Page directories (up to 256 * 16KB)
52 // C2000000-C5FFFFFF Page tables
53 // C6000000-C6FFFFFF Primary I/O mappings
55 // C8000000-C8FFFFFF Kernel .data/.bss, initial stack, kernel heap
56 // C9000000-C91FFFFF Kernel stacks
57 // C9200000-FBFFFFFF Extra kernel mappings (I/O, RAM loaded device drivers)
58 // FC000000-FDFFFFFF Page Info array
59 // FFF00000-FFFFFFFF Exception vectors
62 // Linear address map (2Gb configuration) :
63 // 00000000-001FFFFF Unmapped
64 // 00200000-002FFFFF IPC Alias region
65 // 00300000-003FFFFF Unmapped
66 // 00400000-37FFFFFF Local data
67 // 38000000-3FFFFFFF DLL static data (=phys ram size/2 up to 128M)
68 // 40000000-6FFFFFFF Shared data
69 // 70000000-7FFFFFFF RAM loaded code (=phys ram size up to 256M)
70 // 80000000-8FFFFFFF ROM
71 // 90000000-9FFFFFFF User Global Area
72 // A0000000-BFFFFFFF RAM drive
73 // C0000000-C0001FFF Super page/CPU page
74 // C0030000-C0030FFF KPageInfoMap
75 // C0038000-C003FFFF IRQ, FIQ, UND, ABT stacks (4*4K for stacks + 4*4K for guard pages)
76 // C0040000-C00403FF ASID info (256 ASIDs)
77 // C0080000-C00FFFFF Page table info
78 // C1000000-C13FFFFF Page directories (up to 256 * 16KB)
79 // C2000000-C5FFFFFF Page tables
80 // C6000000-C6FFFFFF Primary I/O mappings
82 // C8000000-C8FFFFFF Kernel .data/.bss, initial stack, kernel heap
83 // C9000000-C91FFFFF Kernel stacks
84 // C9200000-FBFFFFFF Extra kernel mappings (I/O, RAM loaded device drivers)
85 // FC000000-FDFFFFFF Page Info array
86 // FFF00000-FFFFFFFF Exception vectors
90 const TLinAddr KIPCAlias =0x00200000u;
91 const TLinAddr KUserLocalDataBase =0x00400000u;
92 const TLinAddr KUserSharedDataBase1GB =0x20000000u;
93 const TLinAddr KUserSharedDataEnd1GB =0x40000000u;
94 const TLinAddr KUserSharedDataBase2GB =0x40000000u;
95 const TLinAddr KUserSharedDataEnd2GB =0x80000000u;
97 const TLinAddr KRomLinearBase =0x80000000u;
98 const TLinAddr KRomLinearEnd =0x90000000u;
99 const TLinAddr KUserGlobalDataBase =0x90000000u;
100 const TLinAddr KUserGlobalDataEnd =0xA0000000u;
101 const TLinAddr KRamDriveStartAddress =0xA0000000u;
102 const TInt KRamDriveMaxSize=0x20000000;
103 const TLinAddr KRamDriveEndAddress =0xC0000000u;
104 const TLinAddr KSuperPageLinAddr =0xC0000000u;
105 const TLinAddr KExcptStacksLinearBase =0xC0038000u;
106 const TLinAddr KAsidInfoBase =0xC0040000u;
107 const TLinAddr KPageTableInfoBase =0xC0080000u;
108 const TLinAddr KPageDirectoryBase =0xC1000000u;
109 const TLinAddr KPageTableBase =0xC2000000u;
110 const TLinAddr KPrimaryIOBase =0xC6000000u;
111 const TLinAddr KKernelDataBase =0xC8000000u;
112 const TLinAddr KKernelDataEnd =0xC9200000u;
113 const TLinAddr KKernelSectionEnd =0xFC000000u;
115 const TLinAddr KPageInfoLinearBase =0xFC000000u;
117 const TLinAddr KMachineConfigLinAddr =0xC0000800u;
118 const TLinAddr KDummyUncachedAddr =0xC000F000u;
119 const TLinAddr KTempAddr =0xC0010000u;
120 const TLinAddr KSecondTempAddr =0xC0014000u;
121 const TLinAddr KDefragAltStackAddr =0xC001F000u;
122 const TLinAddr KDemandPagingTempAddr =0xC0020000u; // used by demand paging (size of region is 0x10000)
123 const TLinAddr KPageInfoMap =0xC0030000u;
131 // 15 User memory when __USER_MEMORY_GUARDS_ENABLED__ defined
132 const TInt KIPCAliasDomain = 2;
133 const TInt KNumArmDomains = 16; /**< @internalTechnology */
135 // default domain access is client of domain 0, no access to rest
136 const TUint32 KDefaultDomainAccess = 0x00000001u; /**< @internalTechnology */
137 const TUint32 KSupervisorInitialDomainAccess = 0x00000001u; /**< @internalTechnology */
139 #define PDE_IN_DOMAIN(aPde, aDomain) (((aPde) & ~(15 << 5)) | ((aDomain) << 5))
141 // Constants for ARM V6 MMU
142 const TInt KPageShift=12;
143 const TInt KPageSize=1<<KPageShift;
144 const TInt KPageMask=KPageSize-1;
145 const TInt KChunkShift=20;
146 const TInt KChunkSize=1<<KChunkShift;
147 const TInt KChunkMask=KChunkSize-1;
148 const TInt KPageTableShift=KChunkShift-KPageShift+2; // PTE is 4 bytes
149 const TInt KPageTableSize=1<<KPageTableShift;
150 const TInt KPageTableMask=KPageTableSize-1;
151 const TInt KPtClusterShift=KPageShift-KPageTableShift;
152 const TInt KPtClusterSize=1<<KPtClusterShift;
153 const TInt KPtClusterMask=KPtClusterSize-1;
154 const TInt KPtBlockShift=KPageShift-3; /**< @internalTechnology */ // sizeof(SPageTableInfo)=8
155 const TInt KPtBlockSize=1<<KPtBlockShift; /**< @internalTechnology */
156 const TInt KPtBlockMask=KPtBlockSize-1; /**< @internalTechnology */
157 const TInt KPagesInPDEShift=KChunkShift-KPageShift;
158 const TInt KPagesInPDE=1<<KPagesInPDEShift;
159 const TInt KPagesInPDEMask=KPagesInPDE-1;
160 const TInt KLargePageShift=16;
161 const TInt KLargePageSize=1<<KLargePageShift;
162 const TInt KLargePageMask=KLargePageSize-1;
164 const TInt KPageDirectoryShift=32-KChunkShift+2; // PDE is 4 bytes
165 const TInt KPageDirectorySize=1<<KPageDirectoryShift;
166 const TInt KPageDirectoryMask=KPageDirectorySize-1;
168 const TInt KArmV6NumAsids=256;
170 // Permissions - 3 bit field, APX most significant. When __CPU_MEMORY_TYPE_REMAPPING defined, LSB must be 1
171 #if defined(__CPU_MEMORY_TYPE_REMAPPING)
172 const TInt KArmV6PermRORO=7; /**< @internalTechnology */ // sup RO user RO
174 const TInt KArmV6PermNONO=0; /**< @internalTechnology */ // no access for anyone
175 const TInt KArmV6PermRWRO=2; /**< @internalTechnology */ // sup RW user RO
176 const TInt KArmV6PermRORO=6; /**< @internalTechnology */ // sup RO user RO
178 const TInt KArmV6PermRWNO=1; /**< @internalTechnology */ // sup RW user no access
179 const TInt KArmV6PermRWRW=3; /**< @internalTechnology */ // sup RW user RW
180 const TInt KArmV6PermRONO=5; /**< @internalTechnology */ // sup RO user no access
182 #if defined(__CPU_MEMORY_TYPE_REMAPPING)
183 // ARM1176, ARM11MPCORE, ARMv7
184 // TMemoryType is used to describe cache attributes
185 // 3 bits are reserved in page table: TEX[0]:C:B
187 // Attributes - 5 bit field, TEX in 2-4, CB in 1,0
188 const TInt KArmV6MemAttSO =0x00; /**< @internalTechnology */ // strongly ordered
189 const TInt KArmV6MemAttSD =0x01; /**< @internalTechnology */ // shared device
190 const TInt KArmV6MemAttNSD =0x08; /**< @internalTechnology */ // non-shared device
191 const TInt KArmV6MemAttNCNC =0x04; /**< @internalTechnology */ // normal, outer uncached, inner uncached
192 const TInt KArmV6MemAttWTRAWTRA =0x02; /**< @internalTechnology */ // normal, outer WTRA cached, inner WTRA cached
193 const TInt KArmV6MemAttWBRAWBRA =0x03; /**< @internalTechnology */ // normal, outer WBRA cached, inner WBRA cached
194 const TInt KArmV6MemAttWBWAWBWA =0x15; /**< @internalTechnology */ // normal, outer WBWA cached, inner WBWA cached
195 const TInt KArmV6MemAttNCWTRA =0x12; /**< @internalTechnology */ // normal, outer uncached, inner WTRA cached
196 const TInt KArmV6MemAttNCWBRA =0x13; /**< @internalTechnology */ // normal, outer uncached, inner WBRA cached
197 const TInt KArmV6MemAttNCWBWA =0x11; /**< @internalTechnology */ // normal, outer uncached, inner WBWA cached
198 const TInt KArmV6MemAttWTRANC =0x18; /**< @internalTechnology */ // normal, outer WTRA cached, inner uncached
199 const TInt KArmV6MemAttWTRAWBRA =0x1B; /**< @internalTechnology */ // normal, outer WTRA cached, inner WBRA cached
200 const TInt KArmV6MemAttWTRAWBWA =0x19; /**< @internalTechnology */ // normal, outer WTRA cached, inner WBWA cached
201 const TInt KArmV6MemAttWBRANC =0x1C; /**< @internalTechnology */ // normal, outer WBRA cached, inner uncached
202 const TInt KArmV6MemAttWBRAWTRA =0x1E; /**< @internalTechnology */ // normal, outer WBRA cached, inner WTRA cached
203 const TInt KArmV6MemAttWBRAWBWA =0x1D; /**< @internalTechnology */ // normal, outer WBRA cached, inner WBWA cached
204 const TInt KArmV6MemAttWBWANC =0x14; /**< @internalTechnology */ // normal, outer WBWA cached, inner uncached
205 const TInt KArmV6MemAttWBWAWTRA =0x16; /**< @internalTechnology */ // normal, outer WBWA cached, inner WTRA cached
206 const TInt KArmV6MemAttWBWAWBRA =0x17; /**< @internalTechnology */ // normal, outer WBWA cached, inner WBRA cached
209 const TUint32 KArmV6PdePageTable =0x00000001;/**< @internalTechnology */ // L1 descriptor is page table
210 const TUint32 KArmV6PdeSection =0x00000002;/**< @internalTechnology */ // L1 descriptor is section
211 const TUint32 KArmV6PdeTypeMask =0x00000003;/**< @internalTechnology */
212 const TUint32 KArmV6PdeECCEnable =0x00000200;/**< @internalTechnology */ // ECC enable (all L1 descriptors)
213 const TUint32 KArmV6PdeSectionXN =0x00000010;/**< @internalTechnology */ // Section not executable
214 const TUint32 KArmV6PdeSectionS =0x00010000;/**< @internalTechnology */ // Section shared
215 const TUint32 KArmV6PdeSectionNG =0x00020000;/**< @internalTechnology */ // Section not global
216 const TUint32 KArmV6PdePermMask =0x00008c00;/**< @internalTechnology */ // Section permission bits
217 const TUint32 KArmV6PdeAttMask =0x0000700c;/**< @internalTechnology */ // Section memory attribute bits
218 const TUint32 KArmV6PteLargePage =0x00000001;/**< @internalTechnology */ // L2 descriptor is large page
219 const TUint32 KArmV6PteSmallPage =0x00000002;/**< @internalTechnology */ // L2 descriptor is small page
220 const TUint32 KArmV6PteTypeMask =0x00000003;/**< @internalTechnology */
221 const TUint32 KArmV6PteLargeXN =0x00008000;/**< @internalTechnology */ // Large page not executable
222 const TUint32 KArmV6PteSmallXN =0x00000001;/**< @internalTechnology */ // Small page not executable
223 const TUint32 KArmV6PteS =0x00000400;/**< @internalTechnology */ // Large or small page shared
224 const TUint32 KArmV6PteNG =0x00000800;/**< @internalTechnology */ // Large or small page not global
225 const TUint32 KArmV6PtePermMask =0x00000230;/**< @internalTechnology */ // Large or small page permission bits
226 const TUint32 KArmV6PteLargeAttMask =0x0000700c;/**< @internalTechnology */ // Large page memory attribute bits
227 const TUint32 KArmV6PteSmallAttMask =0x000001cc;/**< @internalTechnology */ // Small page memory attribute bits
228 // Remapped Access Permission coding:
229 const TUint32 KArmV6PteAPX =0x00000200;/**< @internalTechnology */ // RO / !RW
230 const TUint32 KArmV6PteAP1 =0x00000020;/**< @internalTechnology */ // AllAccess / !KernelOnly
231 const TUint32 KArmV6PteAP0 =0x00000010;/**< @internalTechnology */ // Must be set
233 const TPde KPdePresentMask=KArmV6PdeTypeMask; /**< @internalTechnology */
234 const TPde KPdeTypeMask=KArmV6PdeTypeMask; /**< @internalTechnology */
235 const TPde KPdeSectionAddrMask=0xfff00000; /**< @internalTechnology */
236 const TPde KPdePageTableAddrMask=0xfffffc00; /**< @internalTechnology */
237 const TPte KPteLargePageAddrMask=0xffff0000; /**< @internalTechnology */
238 const TPte KPteSmallPageAddrMask=0xfffff000; /**< @internalTechnology */
239 const TInt KLargeSmallPageRatio=KLargePageSize/KPageSize; /**< @internalTechnology */
240 const TPde KPdeNotPresentEntry=0; /**< @internalTechnology */
241 const TPte KPteNotPresentEntry=0; /**< @internalTechnology */
242 const TPte KPtePresentMask=KArmV6PteTypeMask; /**< @internalTechnology */
243 const TPte KPteTypeMask=KArmV6PteTypeMask; /**< @internalTechnology */
245 const TUint32 KTTBRExtraBitsMask =0x0000007f; /**< @internalTechnology */ // Extra bits in TTBR in addition to physical address
247 const TInt KPageInfoShift = 5;
249 const TInt KAbtStackSize=KPageSize; /**< @internalComponent */
250 const TInt KUndStackSize=KPageSize; /**< @internalComponent */
251 const TInt KIrqStackSize=KPageSize; /**< @internalComponent */
252 const TInt KFiqStackSize=KPageSize; /**< @internalComponent */
254 #endif // __MMBOOT_H__