summaryrefslogtreecommitdiff
path: root/big-little/secure_world/flat_pagetable.s
blob: 5038f85c23f436ccd2ad8cc6b388cd81d85bdae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
	;
	; Copyright (c) 2012, ARM Limited. All rights reserved.
	;       
	; Redistribution and use in source and binary forms, with
	; or without modification, are permitted provided that the
	; following conditions are met:
	;     
	; Redistributions of source code must retain the above
	; copyright notice, this list of conditions and the 
	; following disclaimer.
	;
	; Redistributions in binary form must reproduce the
	; above copyright notice, this list of conditions and 
	; the following disclaimer in the documentation 
	; and/or other materials provided with the distribution.
	;      
	; Neither the name of ARM nor the names of its
	; contributors may be used to endorse or promote products
	; derived from this software without specific prior written
	; permission.                        
	; 

    PRESERVE8
    AREA PageTable, DATA, READONLY, ALIGN=14
    EXPORT flat_pagetables
    GBLL CONFIG_SMP_CPU3_AMP
CONFIG_SMP_CPU3_AMP SETL {FALSE}
    
; Definitions for section descriptors
NGLOBAL EQU (1<<17)
SHARED  EQU (1<<16)
APX     EQU (1<<15)
TEX1    EQU (1<<12)
TEX2    EQU (1<<13)
TEX3    EQU (1<<14)
AP0     EQU (1<<10)
AP1     EQU (1<<11)
PARITY  EQU (1<<9)
XN      EQU (1<<4)
CACHE   EQU (1<<3)
BUFFER  EQU (1<<2)
SECTION EQU 2
SECURITY      EQU 0

; Select WBWA for both Inner and Outer cache
MEMORY             EQU (TEX1 :OR: CACHE :OR: BUFFER :OR: SECTION :OR: AP0 :OR: AP1 :OR: SECURITY)
S_RO_MEMORY        EQU (TEX1 :OR: CACHE :OR: BUFFER :OR: SECTION :OR: AP0 :OR: AP1 :OR: APX)
S_RW_MEMORY        EQU (TEX1 :OR: CACHE :OR: BUFFER :OR: SECTION :OR: AP0 :OR: AP1)		
; Select WBWA Inner cache, WBnWA Outer cache
;MEMORY           EQU (TEX3 | TEX2 | TEX1 | BUFFER | SECTION | AP0 | AP1 | SECURITY)

NC_MEMORY        EQU (TEX1 :OR: SECTION :OR: AP0 :OR: AP1 :OR: SECURITY)
SO_MEMORY        EQU (SHARED :OR: SECTION :OR: AP0 :OR: AP1 :OR: SECURITY)

; *Don't* mark device accesses as nonsecure, or things like secure-side GIC config won't work...
DEVICE           EQU (BUFFER :OR: SHARED :OR: SECTION :OR: AP0 :OR: AP1 :OR: XN )

NO_MEMORY          EQU (SECTION)
SHARED_MEMORY      EQU (MEMORY :OR: SHARED)
SHARED_S_RO_MEMORY EQU (S_RO_MEMORY :OR: SHARED)
SHARED_S_RW_MEMORY EQU (S_RW_MEMORY :OR: SHARED)		
SHARED_NC_MEMORY   EQU (NC_MEMORY :OR: SHARED)
SHARED_SO_MEMORY   EQU (SO_MEMORY :OR: SHARED)
SHARED_DEVICE      EQU (DEVICE :OR: SHARED)
    
; first-level descriptors - all of them are 1MB sections

flat_pagetables
    GBLA    count16
    GBLA ramstart

count16  SETA    0                   
ramstart SETA    0
	
; NOT FOR RELEASE
    WHILE   count16 < ramstart+0x40         
        ; 0-64MB Secure ROM/NOR Flash
        DCD (count16<<20) :OR: SHARED_DEVICE
count16 SETA    count16 + 1         
    WEND

    WHILE   count16 < ramstart+0x80
        ; 64-128MB Secure RAM
        DCD (count16<<20) :OR: SHARED_S_RW_MEMORY
count16 SETA    count16 + 1         
    WEND

    WHILE   count16 < ramstart+0x800
        ; 128-2048MB Peripheral space
        DCD (count16<<20) :OR: SHARED_DEVICE
count16 SETA    count16 + 1         
    WEND

    WHILE   count16 < ramstart+0x810         
        ; 0-16MB Shared Memory
        DCD (count16<<20) :OR: SHARED_MEMORY
count16 SETA    count16 + 1         
    WEND
		
    WHILE   count16 < ramstart+0x81f
        ; 16-31MB Strongly Ordered
        DCD (count16<<20) :OR: SHARED_SO_MEMORY
count16 SETA    count16 + 1         
    WEND

    WHILE   count16 < ramstart+0x820
        ; 31-32MB Shared Noncached Normal Memory
        DCD (count16<<20) :OR: SHARED_NC_MEMORY
count16 SETA    count16 + 1         
    WEND
		
    WHILE   count16 < ramstart+0x1000
        ; rest of memory is RAM
        DCD (count16<<20) :OR: SHARED_MEMORY
count16 SETA    count16 + 1         
    WEND

    END