]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmLib/Arm11/Arm11Support.S
Sync up ArmPkg with patch from mailing list. Changed name of BdsLib.h to BdsUnixLib...
[mirror_edk2.git] / ArmPkg / Library / ArmLib / Arm11 / Arm11Support.S
CommitLineData
2ef2b01e
A
1#------------------------------------------------------------------------------
2#
d6ebcab7 3# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
2ef2b01e 4#
d6ebcab7 5# This program and the accompanying materials
2ef2b01e
A
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
1bfda055 15#include <AsmMacroIoLib.h>
16
2ef2b01e
A
17.text
18.align 2
1bfda055 19GCC_ASM_EXPORT(ArmCleanInvalidateDataCache)
20GCC_ASM_EXPORT(ArmCleanDataCache)
21GCC_ASM_EXPORT(ArmInvalidateDataCache)
22GCC_ASM_EXPORT(ArmInvalidateInstructionCache)
23GCC_ASM_EXPORT(ArmInvalidateDataCacheEntryByMVA)
24GCC_ASM_EXPORT(ArmCleanDataCacheEntryByMVA)
25GCC_ASM_EXPORT(ArmCleanInvalidateDataCacheEntryByMVA)
26GCC_ASM_EXPORT(ArmEnableMmu)
27GCC_ASM_EXPORT(ArmDisableMmu)
28GCC_ASM_EXPORT(ArmMmuEnabled)
29GCC_ASM_EXPORT(ArmEnableDataCache)
30GCC_ASM_EXPORT(ArmDisableDataCache)
31GCC_ASM_EXPORT(ArmEnableInstructionCache)
32GCC_ASM_EXPORT(ArmDisableInstructionCache)
33GCC_ASM_EXPORT(ArmEnableBranchPrediction)
34GCC_ASM_EXPORT(ArmDisableBranchPrediction)
35GCC_ASM_EXPORT(ArmDataMemoryBarrier)
36GCC_ASM_EXPORT(ArmDataSyncronizationBarrier)
37GCC_ASM_EXPORT(ArmInstructionSynchronizationBarrier)
026c3d34 38
2ef2b01e
A
39
40.set DC_ON, (0x1<<2)
41.set IC_ON, (0x1<<12)
42.set XP_ON, (0x1<<23)
43
44ASM_PFX(ArmInvalidateDataCacheEntryByMVA):
45 mcr p15, 0, r0, c7, c6, 1 @invalidate single data cache line
46 bx lr
47
48
49ASM_PFX(ArmCleanDataCacheEntryByMVA):
50 mcr p15, 0, r0, c7, c10, 1 @clean single data cache line
51 bx lr
52
53
54ASM_PFX(ArmCleanInvalidateDataCacheEntryByMVA):
55 mcr p15, 0, r0, c7, c14, 1 @clean and invalidate single data cache line
56 bx lr
57
58
59ASM_PFX(ArmCleanDataCache):
60 mcr p15, 0, r0, c7, c10, 0 @ clean entire data cache
61 bx lr
62
63
64ASM_PFX(ArmCleanInvalidateDataCache):
65 mcr p15, 0, r0, c7, c14, 0 @ clean and invalidate entire data cache
66 bx lr
67
68
69ASM_PFX(ArmInvalidateDataCache):
70 mcr p15, 0, r0, c7, c6, 0 @ invalidate entire data cache
71 bx lr
72
73
74ASM_PFX(ArmInvalidateInstructionCache):
75 mcr p15, 0, r0, c7, c5, 0 @invalidate entire instruction cache
76 mov R0,#0
77 mcr p15,0,R0,c7,c5,4 @Flush Prefetch buffer
78 bx lr
79
80ASM_PFX(ArmEnableMmu):
81 mrc p15,0,R0,c1,c0,0
82 orr R0,R0,#1
83 mcr p15,0,R0,c1,c0,0
84 bx LR
85
c2b5ca8b
A
86ASM_PFX(ArmMmuEnabled):
87 mrc p15,0,R0,c1,c0,0
88 and R0,R0,#1
89 bx LR
90
2ef2b01e
A
91ASM_PFX(ArmDisableMmu):
92 mrc p15,0,R0,c1,c0,0
93 bic R0,R0,#1
94 mcr p15,0,R0,c1,c0,0
95 mov R0,#0
96 mcr p15,0,R0,c7,c10,4 @Data synchronization barrier
97 mov R0,#0
98 mcr p15,0,R0,c7,c5,4 @Flush Prefetch buffer
99 bx LR
100
101ASM_PFX(ArmEnableDataCache):
1bfda055 102 LoadConstantToReg(DC_ON, R1) @ldr R1,=DC_ON
2ef2b01e
A
103 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
104 orr R0,R0,R1 @Set C bit
105 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
106 bx LR
107
108ASM_PFX(ArmDisableDataCache):
1bfda055 109 LoadConstantToReg(DC_ON, R1) @ldr R1,=DC_ON
2ef2b01e
A
110 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
111 bic R0,R0,R1 @Clear C bit
112 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
113 bx LR
114
115ASM_PFX(ArmEnableInstructionCache):
116 ldr R1,=IC_ON
117 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
118 orr R0,R0,R1 @Set I bit
119 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
120 bx LR
121
122ASM_PFX(ArmDisableInstructionCache):
123 ldr R1,=IC_ON
124 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
125 bic R0,R0,R1 @Clear I bit.
126 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
127 bx LR
128
129ASM_PFX(ArmEnableBranchPrediction):
130 mrc p15, 0, r0, c1, c0, 0
131 orr r0, r0, #0x00000800
132 mcr p15, 0, r0, c1, c0, 0
133 bx LR
134
135ASM_PFX(ArmDisableBranchPrediction):
136 mrc p15, 0, r0, c1, c0, 0
137 bic r0, r0, #0x00000800
138 mcr p15, 0, r0, c1, c0, 0
139 bx LR
140
026c3d34 141ASM_PFX(ArmDataMemoryBarrier):
142 mov R0, #0
143 mcr P15, #0, R0, C7, C10, #5
144 bx LR
145
146ASM_PFX(ArmDataSyncronizationBarrier):
147 mov R0, #0
148 mcr P15, #0, R0, C7, C10, #4
149 bx LR
150
151ASM_PFX(ArmInstructionSynchronizationBarrier):
152 mov R0, #0
153 mcr P15, #0, R0, C7, C5, #4
154 bx LR
155
156
2ef2b01e 157ASM_FUNCTION_REMOVE_IF_UNREFERENCED