1 #------------------------------------------------------------------------------
3 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 # Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
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
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.
14 #------------------------------------------------------------------------------
16 #include <AsmMacroIoLibV8.h>
21 GCC_ASM_EXPORT (ArmIsMpCore)
22 GCC_ASM_EXPORT (ArmEnableAsynchronousAbort)
23 GCC_ASM_EXPORT (ArmDisableAsynchronousAbort)
24 GCC_ASM_EXPORT (ArmEnableIrq)
25 GCC_ASM_EXPORT (ArmDisableIrq)
26 GCC_ASM_EXPORT (ArmEnableFiq)
27 GCC_ASM_EXPORT (ArmDisableFiq)
28 GCC_ASM_EXPORT (ArmEnableInterrupts)
29 GCC_ASM_EXPORT (ArmDisableInterrupts)
30 GCC_ASM_EXPORT (ArmDisableAllExceptions)
31 GCC_ASM_EXPORT (ReadCCSIDR)
32 GCC_ASM_EXPORT (ReadCLIDR)
34 #------------------------------------------------------------------------------
36 .set MPIDR_U_BIT, (30)
37 .set MPIDR_U_MASK, (1 << MPIDR_U_BIT)
39 // DAIF bit definitions for writing through msr daifclr/sr daifset
40 .set DAIF_WR_FIQ_BIT, (1 << 0)
41 .set DAIF_WR_IRQ_BIT, (1 << 1)
42 .set DAIF_WR_ABORT_BIT, (1 << 2)
43 .set DAIF_WR_DEBUG_BIT, (1 << 3)
44 .set DAIF_WR_INT_BITS, (DAIF_WR_FIQ_BIT | DAIF_WR_IRQ_BIT)
45 .set DAIF_WR_ALL, (DAIF_WR_DEBUG_BIT | DAIF_WR_ABORT_BIT | DAIF_WR_INT_BITS)
49 mrs x0, mpidr_el1 // Read EL1 Mutliprocessor Affinty Reg (MPIDR)
50 and x0, x0, #MPIDR_U_MASK // U Bit clear, the processor is part of a multiprocessor system
51 lsr x0, x0, #MPIDR_U_BIT
56 ASM_PFX(ArmEnableAsynchronousAbort):
57 msr daifclr, #DAIF_WR_ABORT_BIT
62 ASM_PFX(ArmDisableAsynchronousAbort):
63 msr daifset, #DAIF_WR_ABORT_BIT
68 ASM_PFX(ArmEnableIrq):
69 msr daifclr, #DAIF_WR_IRQ_BIT
74 ASM_PFX(ArmDisableIrq):
75 msr daifset, #DAIF_WR_IRQ_BIT
80 ASM_PFX(ArmEnableFiq):
81 msr daifclr, #DAIF_WR_FIQ_BIT
86 ASM_PFX(ArmDisableFiq):
87 msr daifset, #DAIF_WR_FIQ_BIT
92 ASM_PFX(ArmEnableInterrupts):
93 msr daifclr, #DAIF_WR_INT_BITS
98 ASM_PFX(ArmDisableInterrupts):
99 msr daifset, #DAIF_WR_INT_BITS
104 ASM_PFX(ArmDisableAllExceptions):
105 msr daifset, #DAIF_WR_ALL
115 msr csselr_el1, x0 // Write Cache Size Selection Register (CSSELR)
117 mrs x0, ccsidr_el1 // Read current Cache Size ID Register (CCSIDR)
126 mrs x0, clidr_el1 // Read Cache Level ID Register
129 ASM_FUNCTION_REMOVE_IF_UNREFERENCED