]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmLib/ArmV7/ArmLibSupportV7.S
ArmPkg: update InvalidateInstructionCacheRange to flush only to PoU
[mirror_edk2.git] / ArmPkg / Library / ArmLib / ArmV7 / ArmLibSupportV7.S
CommitLineData
3402aac7 1#------------------------------------------------------------------------------\r
bd6b9799 2#\r
3# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
d6dc67ba 4# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
bd6b9799 5#\r
6# This program and the accompanying materials\r
7# are licensed and made available under the terms and conditions of the BSD License\r
8# which accompanies this distribution. The full text of the license may be found at\r
9# http://opensource.org/licenses/bsd-license.php\r
10#\r
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13#\r
14#------------------------------------------------------------------------------\r
15\r
16#include <AsmMacroIoLib.h>\r
17\r
18.text\r
19.align 2\r
20\r
21GCC_ASM_EXPORT(ArmIsMpCore)\r
2ea66ed9 22GCC_ASM_EXPORT(ArmHasMpExtensions)\r
bd6b9799 23GCC_ASM_EXPORT(ArmEnableAsynchronousAbort)\r
24GCC_ASM_EXPORT(ArmDisableAsynchronousAbort)\r
25GCC_ASM_EXPORT(ArmEnableIrq)\r
26GCC_ASM_EXPORT(ArmDisableIrq)\r
27GCC_ASM_EXPORT(ArmEnableFiq)\r
28GCC_ASM_EXPORT(ArmDisableFiq)\r
29GCC_ASM_EXPORT(ArmEnableInterrupts)\r
30GCC_ASM_EXPORT(ArmDisableInterrupts)\r
31GCC_ASM_EXPORT(ReadCCSIDR)\r
32GCC_ASM_EXPORT(ReadCLIDR)\r
d6dc67ba
OM
33GCC_ASM_EXPORT(ArmReadNsacr)\r
34GCC_ASM_EXPORT(ArmWriteNsacr)\r
bd6b9799 35\r
36#------------------------------------------------------------------------------\r
37\r
38ASM_PFX(ArmIsMpCore):\r
39 mrc p15,0,R0,c0,c0,5\r
40 // Get Multiprocessing extension (bit31) & U bit (bit30)\r
41 and R0, R0, #0xC0000000\r
5a539eb5
OM
42 // if (bit31 == 1) && (bit30 == 0) then the processor is part of a multiprocessor system\r
43 cmp R0, #0x80000000\r
44 moveq R0, #1\r
45 movne R0, #0\r
bd6b9799 46 bx LR\r
47\r
2ea66ed9
AB
48ASM_PFX(ArmHasMpExtensions):\r
49 mrc p15,0,R0,c0,c0,5\r
50 // Get Multiprocessing extension (bit31)\r
51 lsr R0, R0, #31\r
52 bx LR\r
53\r
bd6b9799 54ASM_PFX(ArmEnableAsynchronousAbort):\r
55 cpsie a\r
56 isb\r
57 bx LR\r
58\r
59ASM_PFX(ArmDisableAsynchronousAbort):\r
60 cpsid a\r
61 isb\r
62 bx LR\r
63\r
64ASM_PFX(ArmEnableIrq):\r
65 cpsie i\r
66 isb\r
67 bx LR\r
68\r
69ASM_PFX(ArmDisableIrq):\r
70 cpsid i\r
71 isb\r
72 bx LR\r
73\r
74ASM_PFX(ArmEnableFiq):\r
75 cpsie f\r
76 isb\r
77 bx LR\r
78\r
79ASM_PFX(ArmDisableFiq):\r
80 cpsid f\r
81 isb\r
82 bx LR\r
83\r
84ASM_PFX(ArmEnableInterrupts):\r
85 cpsie if\r
86 isb\r
87 bx LR\r
88\r
89ASM_PFX(ArmDisableInterrupts):\r
90 cpsid if\r
91 isb\r
92 bx LR\r
3402aac7
RC
93\r
94// UINT32\r
bd6b9799 95// ReadCCSIDR (\r
96// IN UINT32 CSSELR\r
3402aac7 97// )\r
bd6b9799 98ASM_PFX(ReadCCSIDR):\r
99 mcr p15,2,r0,c0,c0,0 @ Write Cache Size Selection Register (CSSELR)\r
100 isb\r
101 mrc p15,1,r0,c0,c0,0 @ Read current CP15 Cache Size ID Register (CCSIDR)\r
102 bx lr\r
3402aac7
RC
103\r
104// UINT32\r
bd6b9799 105// ReadCLIDR (\r
106// IN UINT32 CSSELR\r
3402aac7 107// )\r
bd6b9799 108ASM_PFX(ReadCLIDR):\r
109 mrc p15,1,r0,c0,c0,1 @ Read CP15 Cache Level ID Register\r
110 bx lr\r
111\r
d6dc67ba
OM
112ASM_PFX(ArmReadNsacr):\r
113 mrc p15, 0, r0, c1, c1, 2\r
114 bx lr\r
115\r
116ASM_PFX(ArmWriteNsacr):\r
117 mcr p15, 0, r0, c1, c1, 2\r
118 bx lr\r
119\r
bd6b9799 120ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r