]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbHelper.S
ArmPlatformPkg/ArmPlatformLib: Introduce the function ArmPlatformGetBootMode()
[mirror_edk2.git] / ArmPlatformPkg / ArmRealViewEbPkg / Library / ArmRealViewEbLibRTSM / ArmRealViewEbHelper.S
1 //
2 // Copyright (c) 2011, 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 <AsmMacroIoLib.h>
15 #include <Base.h>
16 #include <Library/PcdLib.h>
17 #include <ArmPlatform.h>
18 #include <AutoGen.h>
19
20 #Start of Code section
21 .text
22 .align 3
23
24 GCC_ASM_EXPORT(ArmPlatformIsMemoryInitialized)
25 GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory)
26
27 /**
28 Called at the early stage of the Boot phase to know if the memory has already been initialized
29
30 Running the code from the reset vector does not mean we start from cold boot. In some case, we
31 can go through this code with the memory already initialized.
32 Because this function is called at the early stage, the implementation must not use the stack.
33 Its implementation must probably done in assembly to ensure this requirement.
34
35 @return Return the condition value into the 'Z' flag
36
37 **/
38 ASM_PFX(ArmPlatformIsMemoryInitialized):
39 // Check if the memory has been already mapped, if so skipped the memory initialization
40 LoadConstantToReg (ARM_EB_SYSCTRL, r0)
41 ldr r0, [r0, #0]
42
43 // 0x200 (BIT9): This read-only bit returns the remap status.
44 and r0, r0, #0x200
45 tst r0, #0x200
46 bx lr
47
48 /**
49 Initialize the memory where the initial stacks will reside
50
51 This memory can contain the initial stacks (Secure and Secure Monitor stacks).
52 In some platform, this region is already initialized and the implementation of this function can
53 do nothing. This memory can also represent the Secure RAM.
54 This function is called before the satck has been set up. Its implementation must ensure the stack
55 pointer is not used (probably required to use assembly language)
56
57 **/
58 ASM_PFX(ArmPlatformInitializeBootMemory):
59 // The SMC does not need to be initialized for RTSM
60 bx lr
61
62 ASM_FUNCTION_REMOVE_IF_UNREFERENCED