From 21de944e0355f706fbbfc8c612b103a3b55dc3cb Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Fri, 28 Sep 2012 10:52:16 +0000 Subject: ARM Packages: Moved ARM assembly files to 'Arm' subdirectory Signed-off-by: Olivier Martin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13772 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S | 71 +++++++++++++++++++++ .../Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm | 73 ++++++++++++++++++++++ .../Library/ArmVExpressLibRTSM/ArmVExpressLib.inf | 8 ++- .../ArmVExpressLibRTSM/ArmVExpressLibSec.inf | 6 +- .../Library/ArmVExpressLibRTSM/RTSMHelper.S | 71 --------------------- .../Library/ArmVExpressLibRTSM/RTSMHelper.asm | 73 ---------------------- .../Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S | 50 +++++++++++++++ .../Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm | 54 ++++++++++++++++ .../Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.S | 71 +++++++++++++++++++++ .../ArmVExpressSecLibRTSM/Arm/RTSMHelper.asm | 73 ++++++++++++++++++++++ .../ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf | 10 +-- .../Library/ArmVExpressSecLibRTSM/RTSMBoot.S | 50 --------------- .../Library/ArmVExpressSecLibRTSM/RTSMBoot.asm | 54 ---------------- .../Library/ArmVExpressSecLibRTSM/RTSMHelper.S | 71 --------------------- .../Library/ArmVExpressSecLibRTSM/RTSMHelper.asm | 73 ---------------------- 15 files changed, 407 insertions(+), 401 deletions(-) create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm delete mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.S delete mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.asm create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.S create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.asm delete mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S delete mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm delete mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S delete mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm (limited to 'ArmPlatformPkg/ArmVExpressPkg') diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S new file mode 100644 index 0000000000..949e7a3014 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S @@ -0,0 +1,71 @@ +# +# Copyright (c) 2011, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http:#opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include +#include +#include +#include +#.include AsmMacroIoLib.inc + +#include + +.text +.align 2 + +GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) + +# IN None +# OUT r0 = SCU Base Address +ASM_PFX(ArmGetScuBaseAddress): + # Read Configuration Base Address Register. ArmCBar cannot be called to get + # the Configuration BAR as a stack is not necessary setup. The SCU is at the + # offset 0x0000 from the Private Memory Region. + mrc p15, 4, r0, c15, c0, 0 + bx lr + +# IN None +# OUT r0 = number of cores present in the system +ASM_PFX(ArmGetCpuCountPerCluster): + stmfd SP!, {r1-r2} + + # Read CP15 MIDR + mrc p15, 0, r1, c0, c0, 0 + + # Check if the CPU is A15 + mov r1, r1, LSR #4 + LoadConstantToReg (ARM_CPU_TYPE_MASK, r0) + and r1, r1, r0 + + LoadConstantToReg (ARM_CPU_TYPE_A15, r0) + cmp r1, r0 + beq _Read_cp15_reg + +_CPU_is_not_A15: + mov r2, lr @ Save link register + bl ArmGetScuBaseAddress @ Read SCU Base Address + mov lr, r2 @ Restore link register val + ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get CPU count + b _Return + +_Read_cp15_reg: + mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to get CPU count + lsr r0, #24 + +_Return: + and r0, r0, #3 + # Add '1' to the number of CPU on the Cluster + add r0, r0, #1 + ldmfd SP!, {r1-r2} + bx lr + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm new file mode 100644 index 0000000000..7326237bc7 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm @@ -0,0 +1,73 @@ +// +// Copyright (c) 2011, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include + +#include + +#include + + INCLUDE AsmMacroIoLib.inc + + EXPORT ArmGetCpuCountPerCluster + + AREA RTSMHelper, CODE, READONLY + +// IN None +// OUT r0 = SCU Base Address +ArmGetScuBaseAddress + // Read Configuration Base Address Register. ArmCBar cannot be called to get + // the Configuration BAR as a stack is not necessary setup. The SCU is at the + // offset 0x0000 from the Private Memory Region. + mrc p15, 4, r0, c15, c0, 0 + bx lr + +// IN None +// OUT r0 = number of cores present in the system +ArmGetCpuCountPerCluster + stmfd SP!, {r1-r2} + + // Read CP15 MIDR + mrc p15, 0, r1, c0, c0, 0 + + // Check if the CPU is A15 + mov r1, r1, LSR #4 + mov r0, #ARM_CPU_TYPE_MASK + and r1, r1, r0 + + mov r0, #ARM_CPU_TYPE_A15 + cmp r1, r0 + beq _Read_cp15_reg + +_CPU_is_not_A15 + mov r2, lr ; Save link register + bl ArmGetScuBaseAddress ; Read SCU Base Address + mov lr, r2 ; Restore link register val + ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count + b _Return + +_Read_cp15_reg + mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count + lsr r0, #24 + + +_Return + and r0, r0, #3 + // Add '1' to the number of CPU on the Cluster + add r0, r0, #1 + ldmfd SP!, {r1-r2} + bx lr + + END diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf index e098c75bd0..d4c1093bab 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.inf @@ -34,9 +34,11 @@ [Sources.common] RTSM.c - RTSMMem.c - RTSMHelper.asm | RVCT - RTSMHelper.S | GCC + RTSMMem.c + +[Sources.ARM] + Arm/RTSMHelper.asm | RVCT + Arm/RTSMHelper.S | GCC [FeaturePcd] gEmbeddedTokenSpaceGuid.PcdCacheEnable diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf index 4938b939a2..53252b1d05 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf @@ -33,8 +33,10 @@ [Sources.common] RTSM.c - RTSMHelper.asm | RVCT - RTSMHelper.S | GCC + +[Sources.ARM] + Arm/RTSMHelper.asm | RVCT + Arm/RTSMHelper.S | GCC [FeaturePcd] gEmbeddedTokenSpaceGuid.PcdCacheEnable diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.S deleted file mode 100644 index 949e7a3014..0000000000 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.S +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (c) 2011, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http:#opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#include -#include -#include -#.include AsmMacroIoLib.inc - -#include - -.text -.align 2 - -GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) - -# IN None -# OUT r0 = SCU Base Address -ASM_PFX(ArmGetScuBaseAddress): - # Read Configuration Base Address Register. ArmCBar cannot be called to get - # the Configuration BAR as a stack is not necessary setup. The SCU is at the - # offset 0x0000 from the Private Memory Region. - mrc p15, 4, r0, c15, c0, 0 - bx lr - -# IN None -# OUT r0 = number of cores present in the system -ASM_PFX(ArmGetCpuCountPerCluster): - stmfd SP!, {r1-r2} - - # Read CP15 MIDR - mrc p15, 0, r1, c0, c0, 0 - - # Check if the CPU is A15 - mov r1, r1, LSR #4 - LoadConstantToReg (ARM_CPU_TYPE_MASK, r0) - and r1, r1, r0 - - LoadConstantToReg (ARM_CPU_TYPE_A15, r0) - cmp r1, r0 - beq _Read_cp15_reg - -_CPU_is_not_A15: - mov r2, lr @ Save link register - bl ArmGetScuBaseAddress @ Read SCU Base Address - mov lr, r2 @ Restore link register val - ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get CPU count - b _Return - -_Read_cp15_reg: - mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to get CPU count - lsr r0, #24 - -_Return: - and r0, r0, #3 - # Add '1' to the number of CPU on the Cluster - add r0, r0, #1 - ldmfd SP!, {r1-r2} - bx lr - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.asm deleted file mode 100644 index 7326237bc7..0000000000 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMHelper.asm +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) 2011, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include - -#include - -#include - - INCLUDE AsmMacroIoLib.inc - - EXPORT ArmGetCpuCountPerCluster - - AREA RTSMHelper, CODE, READONLY - -// IN None -// OUT r0 = SCU Base Address -ArmGetScuBaseAddress - // Read Configuration Base Address Register. ArmCBar cannot be called to get - // the Configuration BAR as a stack is not necessary setup. The SCU is at the - // offset 0x0000 from the Private Memory Region. - mrc p15, 4, r0, c15, c0, 0 - bx lr - -// IN None -// OUT r0 = number of cores present in the system -ArmGetCpuCountPerCluster - stmfd SP!, {r1-r2} - - // Read CP15 MIDR - mrc p15, 0, r1, c0, c0, 0 - - // Check if the CPU is A15 - mov r1, r1, LSR #4 - mov r0, #ARM_CPU_TYPE_MASK - and r1, r1, r0 - - mov r0, #ARM_CPU_TYPE_A15 - cmp r1, r0 - beq _Read_cp15_reg - -_CPU_is_not_A15 - mov r2, lr ; Save link register - bl ArmGetScuBaseAddress ; Read SCU Base Address - mov lr, r2 ; Restore link register val - ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count - b _Return - -_Read_cp15_reg - mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count - lsr r0, #24 - - -_Return - and r0, r0, #3 - // Add '1' to the number of CPU on the Cluster - add r0, r0, #1 - ldmfd SP!, {r1-r2} - bx lr - - END diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S new file mode 100644 index 0000000000..371adcb8f9 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.S @@ -0,0 +1,50 @@ +// +// Copyright (c) 2011-2012, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include +#include + +.text +.align 3 + +GCC_ASM_EXPORT(ArmPlatformSecBootAction) +GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) + +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +ASM_PFX(ArmPlatformSecBootAction): + bx lr + +/** + Initialize the memory where the initial stacks will reside + + This memory can contain the initial stacks (Secure and Secure Monitor stacks). + In some platform, this region is already initialized and the implementation of this function can + do nothing. This memory can also represent the Secure RAM. + This function is called before the satck has been set up. Its implementation must ensure the stack + pointer is not used (probably required to use assembly language) + +**/ +ASM_PFX(ArmPlatformSecBootMemoryInit): + // The SMC does not need to be initialized for RTSM + bx lr diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm new file mode 100644 index 0000000000..2d0b94679f --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMBoot.asm @@ -0,0 +1,54 @@ +// +// Copyright (c) 2011, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include +#include +#include + + INCLUDE AsmMacroIoLib.inc + + EXPORT ArmPlatformSecBootAction + EXPORT ArmPlatformSecBootMemoryInit + + PRESERVE8 + AREA RTSMVExpressBootMode, CODE, READONLY + +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +ArmPlatformSecBootAction + bx lr + +/** + Initialize the memory where the initial stacks will reside + + This memory can contain the initial stacks (Secure and Secure Monitor stacks). + In some platform, this region is already initialized and the implementation of this function can + do nothing. This memory can also represent the Secure RAM. + This function is called before the satck has been set up. Its implementation must ensure the stack + pointer is not used (probably required to use assembly language) + +**/ +ArmPlatformSecBootMemoryInit + // The SMC does not need to be initialized for RTSM + bx lr + + END diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.S new file mode 100644 index 0000000000..f47a5312ff --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.S @@ -0,0 +1,71 @@ +# +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http:#opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include +#include +#include +#include +#.include AsmMacroIoLib.inc + +#include + +.text +.align 2 + +GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) + +# IN None +# OUT r0 = SCU Base Address +ASM_PFX(ArmGetScuBaseAddress): + # Read Configuration Base Address Register. ArmCBar cannot be called to get + # the Configuration BAR as a stack is not necessary setup. The SCU is at the + # offset 0x0000 from the Private Memory Region. + mrc p15, 4, r0, c15, c0, 0 + bx lr + +# IN None +# OUT r0 = number of cores present in the system +ASM_PFX(ArmGetCpuCountPerCluster): + stmfd SP!, {r1-r2} + + # Read CP15 MIDR + mrc p15, 0, r1, c0, c0, 0 + + # Check if the CPU is A15 + mov r1, r1, LSR #4 + LoadConstantToReg (ARM_CPU_TYPE_MASK, r0) + and r1, r1, r0 + + LoadConstantToReg (ARM_CPU_TYPE_A15, r0) + cmp r1, r0 + beq _Read_cp15_reg + +_CPU_is_not_A15: + mov r2, lr @ Save link register + bl ArmGetScuBaseAddress @ Read SCU Base Address + mov lr, r2 @ Restore link register val + ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get CPU count + b _Return + +_Read_cp15_reg: + mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to get CPU count + lsr r0, #24 + +_Return: + and r0, r0, #3 + # Add '1' to the number of CPU on the Cluster + add r0, r0, #1 + ldmfd SP!, {r1-r2} + bx lr + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.asm new file mode 100644 index 0000000000..402db58278 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/Arm/RTSMHelper.asm @@ -0,0 +1,73 @@ +// +// Copyright (c) 2011-2012, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// + +#include +#include +#include + +#include + +#include + + INCLUDE AsmMacroIoLib.inc + + EXPORT ArmGetCpuCountPerCluster + + AREA RTSMHelper, CODE, READONLY + +// IN None +// OUT r0 = SCU Base Address +ArmGetScuBaseAddress + // Read Configuration Base Address Register. ArmCBar cannot be called to get + // the Configuration BAR as a stack is not necessary setup. The SCU is at the + // offset 0x0000 from the Private Memory Region. + mrc p15, 4, r0, c15, c0, 0 + bx lr + +// IN None +// OUT r0 = number of cores present in the system +ArmGetCpuCountPerCluster + stmfd SP!, {r1-r2} + + // Read CP15 MIDR + mrc p15, 0, r1, c0, c0, 0 + + // Check if the CPU is A15 + mov r1, r1, LSR #4 + mov r0, #ARM_CPU_TYPE_MASK + and r1, r1, r0 + + mov r0, #ARM_CPU_TYPE_A15 + cmp r1, r0 + beq _Read_cp15_reg + +_CPU_is_not_A15 + mov r2, lr ; Save link register + bl ArmGetScuBaseAddress ; Read SCU Base Address + mov lr, r2 ; Restore link register val + ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count + b _Return + +_Read_cp15_reg + mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count + lsr r0, #24 + + +_Return + and r0, r0, #3 + // Add '1' to the number of CPU on the Cluster + add r0, r0, #1 + ldmfd SP!, {r1-r2} + bx lr + + END diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf index e2f9191714..4a1e056af0 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf @@ -33,10 +33,12 @@ [Sources.common] RTSMSec.c - RTSMBoot.asm | RVCT - RTSMBoot.S | GCC - RTSMHelper.asm | RVCT - RTSMHelper.S | GCC + +[Sources.ARM] + Arm/RTSMBoot.asm | RVCT + Arm/RTSMBoot.S | GCC + Arm/RTSMHelper.asm | RVCT + Arm/RTSMHelper.S | GCC [FeaturePcd] gEmbeddedTokenSpaceGuid.PcdCacheEnable diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S deleted file mode 100644 index 371adcb8f9..0000000000 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright (c) 2011-2012, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include -#include - -.text -.align 3 - -GCC_ASM_EXPORT(ArmPlatformSecBootAction) -GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) - -/** - Call at the beginning of the platform boot up - - This function allows the firmware platform to do extra actions at the early - stage of the platform power up. - - Note: This function must be implemented in assembler as there is no stack set up yet - -**/ -ASM_PFX(ArmPlatformSecBootAction): - bx lr - -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -ASM_PFX(ArmPlatformSecBootMemoryInit): - // The SMC does not need to be initialized for RTSM - bx lr diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm deleted file mode 100644 index 2d0b94679f..0000000000 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) 2011, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include -#include -#include - - INCLUDE AsmMacroIoLib.inc - - EXPORT ArmPlatformSecBootAction - EXPORT ArmPlatformSecBootMemoryInit - - PRESERVE8 - AREA RTSMVExpressBootMode, CODE, READONLY - -/** - Call at the beginning of the platform boot up - - This function allows the firmware platform to do extra actions at the early - stage of the platform power up. - - Note: This function must be implemented in assembler as there is no stack set up yet - -**/ -ArmPlatformSecBootAction - bx lr - -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -ArmPlatformSecBootMemoryInit - // The SMC does not need to be initialized for RTSM - bx lr - - END diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S deleted file mode 100644 index f47a5312ff..0000000000 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http:#opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#include -#include -#include -#.include AsmMacroIoLib.inc - -#include - -.text -.align 2 - -GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) - -# IN None -# OUT r0 = SCU Base Address -ASM_PFX(ArmGetScuBaseAddress): - # Read Configuration Base Address Register. ArmCBar cannot be called to get - # the Configuration BAR as a stack is not necessary setup. The SCU is at the - # offset 0x0000 from the Private Memory Region. - mrc p15, 4, r0, c15, c0, 0 - bx lr - -# IN None -# OUT r0 = number of cores present in the system -ASM_PFX(ArmGetCpuCountPerCluster): - stmfd SP!, {r1-r2} - - # Read CP15 MIDR - mrc p15, 0, r1, c0, c0, 0 - - # Check if the CPU is A15 - mov r1, r1, LSR #4 - LoadConstantToReg (ARM_CPU_TYPE_MASK, r0) - and r1, r1, r0 - - LoadConstantToReg (ARM_CPU_TYPE_A15, r0) - cmp r1, r0 - beq _Read_cp15_reg - -_CPU_is_not_A15: - mov r2, lr @ Save link register - bl ArmGetScuBaseAddress @ Read SCU Base Address - mov lr, r2 @ Restore link register val - ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get CPU count - b _Return - -_Read_cp15_reg: - mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to get CPU count - lsr r0, #24 - -_Return: - and r0, r0, #3 - # Add '1' to the number of CPU on the Cluster - add r0, r0, #1 - ldmfd SP!, {r1-r2} - bx lr - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm deleted file mode 100644 index 402db58278..0000000000 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) 2011-2012, ARM Limited. All rights reserved. -// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -// - -#include -#include -#include - -#include - -#include - - INCLUDE AsmMacroIoLib.inc - - EXPORT ArmGetCpuCountPerCluster - - AREA RTSMHelper, CODE, READONLY - -// IN None -// OUT r0 = SCU Base Address -ArmGetScuBaseAddress - // Read Configuration Base Address Register. ArmCBar cannot be called to get - // the Configuration BAR as a stack is not necessary setup. The SCU is at the - // offset 0x0000 from the Private Memory Region. - mrc p15, 4, r0, c15, c0, 0 - bx lr - -// IN None -// OUT r0 = number of cores present in the system -ArmGetCpuCountPerCluster - stmfd SP!, {r1-r2} - - // Read CP15 MIDR - mrc p15, 0, r1, c0, c0, 0 - - // Check if the CPU is A15 - mov r1, r1, LSR #4 - mov r0, #ARM_CPU_TYPE_MASK - and r1, r1, r0 - - mov r0, #ARM_CPU_TYPE_A15 - cmp r1, r0 - beq _Read_cp15_reg - -_CPU_is_not_A15 - mov r2, lr ; Save link register - bl ArmGetScuBaseAddress ; Read SCU Base Address - mov lr, r2 ; Restore link register val - ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count - b _Return - -_Read_cp15_reg - mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count - lsr r0, #24 - - -_Return - and r0, r0, #3 - // Add '1' to the number of CPU on the Cluster - add r0, r0, #1 - ldmfd SP!, {r1-r2} - bx lr - - END -- cgit v1.2.3