]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S
ArmPkg/ArmLib: AARCH64: set frame pointer in cache maintenance routine
[mirror_edk2.git] / ArmPkg / Library / ArmLib / AArch64 / ArmLibSupportV8.S
CommitLineData
25402f5d
HL
1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
51ad04cb 4# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.\r
0efaa42f 5# Copyright (c) 2016, Linaro Limited. All rights reserved.\r
25402f5d
HL
6#\r
7# This program and the accompanying materials\r
8# are licensed and made available under the terms and conditions of the BSD License\r
9# which accompanies this distribution. The full text of the license may be found at\r
10# http://opensource.org/licenses/bsd-license.php\r
11#\r
12# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14#\r
15#------------------------------------------------------------------------------\r
16\r
51ad04cb 17#include <AsmMacroIoLibV8.h>\r
25402f5d 18\r
25402f5d
HL
19.set MPIDR_U_BIT, (30)\r
20.set MPIDR_U_MASK, (1 << MPIDR_U_BIT)\r
4af3dd80
EC
21\r
22// DAIF bit definitions for writing through msr daifclr/sr daifset\r
23.set DAIF_WR_FIQ_BIT, (1 << 0)\r
24.set DAIF_WR_IRQ_BIT, (1 << 1)\r
25.set DAIF_WR_ABORT_BIT, (1 << 2)\r
26.set DAIF_WR_DEBUG_BIT, (1 << 3)\r
27.set DAIF_WR_INT_BITS, (DAIF_WR_FIQ_BIT | DAIF_WR_IRQ_BIT)\r
28.set DAIF_WR_ALL, (DAIF_WR_DEBUG_BIT | DAIF_WR_ABORT_BIT | DAIF_WR_INT_BITS)\r
25402f5d
HL
29\r
30\r
0efaa42f 31ASM_FUNC(ArmIsMpCore)\r
25402f5d
HL
32 mrs x0, mpidr_el1 // Read EL1 Mutliprocessor Affinty Reg (MPIDR)\r
33 and x0, x0, #MPIDR_U_MASK // U Bit clear, the processor is part of a multiprocessor system\r
34 lsr x0, x0, #MPIDR_U_BIT\r
35 eor x0, x0, #1\r
36 ret\r
37\r
38\r
0efaa42f 39ASM_FUNC(ArmEnableAsynchronousAbort)\r
4af3dd80 40 msr daifclr, #DAIF_WR_ABORT_BIT\r
25402f5d
HL
41 isb\r
42 ret\r
43\r
44\r
0efaa42f 45ASM_FUNC(ArmDisableAsynchronousAbort)\r
4af3dd80 46 msr daifset, #DAIF_WR_ABORT_BIT\r
25402f5d
HL
47 isb\r
48 ret\r
49\r
50\r
0efaa42f 51ASM_FUNC(ArmEnableIrq)\r
4af3dd80 52 msr daifclr, #DAIF_WR_IRQ_BIT\r
25402f5d
HL
53 isb\r
54 ret\r
55\r
56\r
0efaa42f 57ASM_FUNC(ArmDisableIrq)\r
4af3dd80 58 msr daifset, #DAIF_WR_IRQ_BIT\r
25402f5d
HL
59 isb\r
60 ret\r
61\r
62\r
0efaa42f 63ASM_FUNC(ArmEnableFiq)\r
4af3dd80 64 msr daifclr, #DAIF_WR_FIQ_BIT\r
25402f5d
HL
65 isb\r
66 ret\r
67\r
68\r
0efaa42f 69ASM_FUNC(ArmDisableFiq)\r
4af3dd80 70 msr daifset, #DAIF_WR_FIQ_BIT\r
25402f5d
HL
71 isb\r
72 ret\r
73\r
74\r
0efaa42f 75ASM_FUNC(ArmEnableInterrupts)\r
4af3dd80 76 msr daifclr, #DAIF_WR_INT_BITS\r
25402f5d
HL
77 isb\r
78 ret\r
79\r
80\r
0efaa42f 81ASM_FUNC(ArmDisableInterrupts)\r
4af3dd80 82 msr daifset, #DAIF_WR_INT_BITS\r
25402f5d
HL
83 isb\r
84 ret\r
85\r
86\r
0efaa42f 87ASM_FUNC(ArmDisableAllExceptions)\r
4af3dd80 88 msr daifset, #DAIF_WR_ALL\r
25402f5d
HL
89 isb\r
90 ret\r
91\r
92\r
93// UINT32\r
94// ReadCCSIDR (\r
95// IN UINT32 CSSELR\r
96// )\r
0efaa42f 97ASM_FUNC(ReadCCSIDR)\r
25402f5d
HL
98 msr csselr_el1, x0 // Write Cache Size Selection Register (CSSELR)\r
99 isb\r
100 mrs x0, ccsidr_el1 // Read current Cache Size ID Register (CCSIDR)\r
101 ret\r
102\r
103\r
104// UINT32\r
105// ReadCLIDR (\r
106// IN UINT32 CSSELR\r
107// )\r
0efaa42f 108ASM_FUNC(ReadCLIDR)\r
25402f5d
HL
109 mrs x0, clidr_el1 // Read Cache Level ID Register\r
110 ret\r
111\r
112ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r