]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmLib/ArmV7/ArmLibSupportV7.asm
ArmPkg/ArmV7Lib: add function to test for presence of MP extensions
[mirror_edk2.git] / ArmPkg / Library / ArmLib / ArmV7 / ArmLibSupportV7.asm
CommitLineData
3402aac7 1//------------------------------------------------------------------------------\r
bd6b9799 2//\r
3// Copyright (c) 2008 - 2010, 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\r
17 EXPORT ArmIsMpCore\r
2ea66ed9 18 EXPORT ArmHasMpExtensions\r
bd6b9799 19 EXPORT ArmEnableAsynchronousAbort\r
20 EXPORT ArmDisableAsynchronousAbort\r
21 EXPORT ArmEnableIrq\r
22 EXPORT ArmDisableIrq\r
23 EXPORT ArmEnableFiq\r
24 EXPORT ArmDisableFiq\r
25 EXPORT ArmEnableInterrupts\r
26 EXPORT ArmDisableInterrupts\r
27 EXPORT ReadCCSIDR\r
28 EXPORT ReadCLIDR\r
d6dc67ba
OM
29 EXPORT ArmReadNsacr\r
30 EXPORT ArmWriteNsacr\r
31\r
bd6b9799 32 AREA ArmLibSupportV7, CODE, READONLY\r
33\r
34\r
35//------------------------------------------------------------------------------\r
36\r
37ArmIsMpCore\r
38 mrc p15,0,R0,c0,c0,5\r
39 // Get Multiprocessing extension (bit31) & U bit (bit30)\r
40 and R0, R0, #0xC0000000\r
5a539eb5
OM
41 // if (bit31 == 1) && (bit30 == 0) then the processor is part of a multiprocessor system\r
42 cmp R0, #0x80000000\r
43 moveq R0, #1\r
44 movne R0, #0\r
bd6b9799 45 bx LR\r
46\r
2ea66ed9
AB
47ArmHasMpExtensions\r
48 mrc p15,0,R0,c0,c0,5\r
49 // Get Multiprocessing extension (bit31)\r
50 lsr R0, R0, #31\r
51 bx LR\r
52\r
bd6b9799 53ArmEnableAsynchronousAbort\r
54 cpsie a\r
55 isb\r
56 bx LR\r
57\r
58ArmDisableAsynchronousAbort\r
59 cpsid a\r
60 isb\r
61 bx LR\r
62\r
63ArmEnableIrq\r
64 cpsie i\r
65 isb\r
66 bx LR\r
67\r
68ArmDisableIrq\r
69 cpsid i\r
70 isb\r
71 bx LR\r
72\r
73ArmEnableFiq\r
74 cpsie f\r
75 isb\r
76 bx LR\r
77\r
78ArmDisableFiq\r
79 cpsid f\r
80 isb\r
81 bx LR\r
82\r
83ArmEnableInterrupts\r
84 cpsie if\r
85 isb\r
86 bx LR\r
87\r
88ArmDisableInterrupts\r
89 cpsid if\r
90 isb\r
91 bx LR\r
3402aac7
RC
92\r
93// UINT32\r
bd6b9799 94// ReadCCSIDR (\r
95// IN UINT32 CSSELR\r
3402aac7 96// )\r
bd6b9799 97ReadCCSIDR\r
98 mcr p15,2,r0,c0,c0,0 ; Write Cache Size Selection Register (CSSELR)\r
99 isb\r
100 mrc p15,1,r0,c0,c0,0 ; Read current CP15 Cache Size ID Register (CCSIDR)\r
101 bx lr\r
3402aac7
RC
102\r
103// UINT32\r
bd6b9799 104// ReadCLIDR (\r
105// IN UINT32 CSSELR\r
3402aac7 106// )\r
bd6b9799 107ReadCLIDR\r
108 mrc p15,1,r0,c0,c0,1 ; Read CP15 Cache Level ID Register\r
109 bx lr\r
d6dc67ba
OM
110\r
111ArmReadNsacr\r
112 mrc p15, 0, r0, c1, c1, 2\r
113 bx lr\r
114\r
115ArmWriteNsacr\r
116 mcr p15, 0, r0, c1, c1, 2\r
117 bx lr\r
118\r
2575b726 119 END\r