]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmLib/Arm9/Arm9Support.S
Need to add some extra functions to the libraries to support paging in the CpuDxe...
[mirror_edk2.git] / ArmPkg / Library / ArmLib / Arm9 / Arm9Support.S
CommitLineData
2ef2b01e
A
1#------------------------------------------------------------------------------
2#
3# Copyright (c) 2008-2009 Apple Inc. All rights reserved.
4#
5# All rights reserved. This program and the accompanying materials
6# are licensed and made available under the terms and conditions of the BSD License
7# which accompanies this distribution. The full text of the license may be found at
8# http://opensource.org/licenses/bsd-license.php
9#
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12#
13#------------------------------------------------------------------------------
14
15.text
16.align 2
17.globl ASM_PFX(ArmCleanInvalidateDataCache)
18.globl ASM_PFX(ArmCleanDataCache)
19.globl ASM_PFX(ArmInvalidateDataCache)
20.globl ASM_PFX(ArmInvalidateInstructionCache)
21.globl ASM_PFX(ArmInvalidateDataCacheEntryByMVA)
22.globl ASM_PFX(ArmCleanDataCacheEntryByMVA)
23.globl ASM_PFX(ArmCleanInvalidateDataCacheEntryByMVA)
24.globl ASM_PFX(ArmEnableMmu)
25.globl ASM_PFX(ArmDisableMmu)
c2b5ca8b 26.globl ASM_PFX(ArmMmuEnabled)
2ef2b01e
A
27.globl ASM_PFX(ArmEnableDataCache)
28.globl ASM_PFX(ArmDisableDataCache)
29.globl ASM_PFX(ArmEnableInstructionCache)
30.globl ASM_PFX(ArmDisableInstructionCache)
31.globl ASM_PFX(ArmEnableBranchPrediction)
32.globl ASM_PFX(ArmDisableBranchPrediction)
33
34.set DC_ON, (1<<2)
35.set IC_ON, (1<<12)
36
37#------------------------------------------------------------------------------
38
39ASM_PFX(ArmInvalidateDataCacheEntryByMVA):
40 mcr p15, 0, r0, c7, c6, 1 @ invalidate single data cache line
41 bx lr
42
43ASM_PFX(ArmCleanDataCacheEntryByMVA):
44 mcr p15, 0, r0, c7, c10, 1 @ clean single data cache line
45 bx lr
46
47ASM_PFX(ArmCleanInvalidateDataCacheEntryByMVA):
48 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate single data cache line
49 bx lr
50
51ASM_PFX(ArmEnableInstructionCache):
52 ldr r1,=IC_ON
53 mrc p15,0,r0,c1,c0,0 @Read control register configuration data
54 orr r0,r0,r1 @Set I bit
55 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
56 bx LR
57
58ASM_PFX(ArmDisableInstructionCache):
59 ldr r1,=IC_ON
60 mrc p15,0,r0,c1,c0,0 @Read control register configuration data
61 bic r0,r0,r1 @Clear I bit.
62 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
63 bx LR
64
65ASM_PFX(ArmInvalidateInstructionCache):
66 mov r0,#0
67 mcr p15,0,r0,c7,c5,0 @Invalidate entire Instruction cache.
68 @Also flushes the branch target cache.
69 mov r0,#0
70 mcr p15,0,r0,c7,c10,4 @Data write buffer
71 bx LR
72
73ASM_PFX(ArmEnableMmu):
74 mrc p15,0,R0,c1,c0,0
75 orr R0,R0,#1
76 mcr p15,0,R0,c1,c0,0
77 bx LR
78
c2b5ca8b
A
79ASM_PFX(ArmMmuEnabled):
80 mrc p15,0,R0,c1,c0,0
81 and R0,R0,#1
82 bx LR
83
2ef2b01e
A
84ASM_PFX(ArmDisableMmu):
85 mrc p15,0,R0,c1,c0,0
86 bic R0,R0,#1
87 mcr p15,0,R0,c1,c0,0
88 mov R0,#0
89 mcr p15,0,R0,c7,c10,4 @Drain write buffer
90 bx LR
91
92ASM_PFX(ArmEnableDataCache):
93 ldr R1,=DC_ON
94 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
95 orr R0,R0,R1 @Set C bit
96 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
97 bx LR
98
99ASM_PFX(ArmDisableDataCache):
100 ldr R1,=DC_ON
101 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
102 bic R0,R0,R1 @Clear C bit
103 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
104 bx LR
105
106ASM_PFX(ArmCleanDataCache):
107 mrc p15,0,r15,c7,c10,3
108 bne ASM_PFX(ArmCleanDataCache)
109 mov R0,#0
110 mcr p15,0,R0,c7,c10,4 @Drain write buffer
111 bx LR
112
113ASM_PFX(ArmInvalidateDataCache):
114 mov R0,#0
115 mcr p15,0,R0,c7,c6,0 @Invalidate entire data cache
116 mov R0,#0
117 mcr p15,0,R0,c7,c10,4 @Drain write buffer
118 bx LR
119
120ASM_PFX(ArmCleanInvalidateDataCache):
121 mrc p15,0,r15,c7,c14,3
122 bne ASM_PFX(ArmCleanInvalidateDataCache)
123 mov R0,#0
124 mcr p15,0,R0,c7,c10,4 @Drain write buffer
125 bx LR
126
127ASM_PFX(ArmEnableBranchPrediction):
128 bx LR @Branch prediction is not supported.
129
130ASM_PFX(ArmDisableBranchPrediction):
131 bx LR @Branch prediction is not supported.
132
133ASM_FUNCTION_REMOVE_IF_UNREFERENCED
134