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