]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/PrePeiCore/AArch64/Helper.S
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / AArch64 / Helper.S
1 #========================================================================================
2 # Copyright (c) 2011-2017, ARM Limited. All rights reserved.
3 #
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http:#opensource.org/licenses/bsd-license.php
8 #
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 #
12 #=======================================================================================
13
14 #include <AsmMacroIoLibV8.h>
15 #include <Chipset/AArch64.h>
16
17 // Setup EL1 while in EL1
18 ASM_FUNC(SetupExceptionLevel1)
19 mov x5, x30 // Save LR
20
21 mov x0, #CPACR_CP_FULL_ACCESS
22 bl ASM_PFX(ArmWriteCpacr) // Disable copro traps to EL1
23
24 ret x5
25
26 // Setup EL2 while in EL2
27 ASM_FUNC(SetupExceptionLevel2)
28 msr sctlr_el2, xzr
29 mrs x0, hcr_el2 // Read EL2 Hypervisor configuration Register
30
31 // Send all interrupts to their respective Exception levels for EL2
32 orr x0, x0, #(1 << 3) // Enable EL2 FIQ
33 orr x0, x0, #(1 << 4) // Enable EL2 IRQ
34 orr x0, x0, #(1 << 5) // Enable EL2 SError and Abort
35 msr hcr_el2, x0 // Write back our settings
36
37 msr cptr_el2, xzr // Disable copro traps to EL2
38
39 // Enable Timer access for non-secure EL1 and EL0
40 // The cnthctl_el2 register bits are architecturally
41 // UNKNOWN on reset.
42 // Disable event stream as it is not in use at this stage
43 mov x0, #(CNTHCTL_EL2_EL1PCTEN | CNTHCTL_EL2_EL1PCEN)
44 msr cnthctl_el2, x0
45
46 ret
47
48 ASM_FUNCTION_REMOVE_IF_UNREFERENCED