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