Revision: 14346
          http://edk2.svn.sourceforge.net/edk2/?rev=14346&view=rev
Author:   oliviermartin
Date:     2013-05-10 12:46:11 +0000 (Fri, 10 May 2013)
Log Message:
-----------
ARM Packages: Replaced the macro GetCorePositionFromMpId() by the 
ArmPlatformGetCorePosition()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>
Acked-by: Ryan Harkin <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h
    trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc
    
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
    
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
    
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
    
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
    trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
    trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
    trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
    trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm

Modified: trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h
===================================================================
--- trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h   2013-05-10 12:44:30 UTC (rev 
14345)
+++ trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h   2013-05-10 12:46:11 UTC (rev 
14346)
@@ -120,16 +120,6 @@
   .long (_Data)           ;                 \
 1:
 
-// Convert the (ClusterId,CoreId) into a Core Position
-// We assume there are 4 cores per cluster
-// Note: 0xFFFF is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)  \
-  ldr   Tmp, =0xFFFF                             \
-  and   MpId, Tmp                                \
-  lsr   Pos, MpId, #6 ;                          \
-  and   Tmp, MpId, #3 ;                          \
-  add   Pos, Pos, Tmp
-
 // Reserve a region at the top of the Primary Core stack
 // for Global variables for the XIP phase
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \
@@ -211,16 +201,6 @@
 #define LoadConstantToReg(Data, Reg) \
   ldr  Reg, =Data
 
-// Convert the (ClusterId,CoreId) into a Core Position
-// We assume there are 4 cores per cluster
-// Note: 0xFFFF is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)    \
-  ldr   Tmp, =0xFFFF ;                             \
-  and   MpId, Tmp ;                                \
-  lsr   Pos, MpId, #6 ;                            \
-  and   Tmp, MpId, #3 ;                            \
-  add   Pos, Pos, Tmp
-
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \
   and     Tmp, GlobalSize, #7         ;             \
   rsbne   Tmp, Tmp, #8                ;             \
@@ -313,8 +293,6 @@
 // conditional load testing eq flag
 #define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg
 
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)  GetCorePositionFromMpId Pos, 
MpId, Tmp
-
 #define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, 
GlobalSize, Tmp
 
 // Initialize the Global Variable with '0'

Modified: trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc
===================================================================
--- trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc 2013-05-10 12:44:30 UTC (rev 
14345)
+++ trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc 2013-05-10 12:46:11 UTC (rev 
14346)
@@ -80,17 +80,6 @@
   ldr  $Reg, =($Data) 
   MEND 
   
-  MACRO
-  GetCorePositionFromMpId $Pos, $MpId, $Tmp
-  ;Note: The ARM macro does not support the pre-processing. 0xFF and (0xFF << 
8) are the values of
-  ;      ARM_CORE_MASK and ARM_CLUSTER_MASK 
-  mov   $Tmp, #(0xFF :OR: (0xFF << 8))
-  and   $MpId, $Tmp
-  lsr   $Pos, $MpId, #6
-  and   $Tmp, $MpId, #3
-  add   $Pos, $Pos, $Tmp
-  MEND
-  
   ; The reserved place must be 8-bytes aligned for pushing 64-bit variable on 
the stack
   ; Note: Global Size will be modified
   MACRO

Modified: 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
===================================================================
--- 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
        2013-05-10 12:44:30 UTC (rev 14345)
+++ 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
        2013-05-10 12:46:11 UTC (rev 14346)
@@ -12,12 +12,14 @@
 #
 
 #include <AsmMacroIoLib.h>
+#include <Library/ArmLib.h>
 
 .text
 .align 2
 
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
 
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
@@ -46,4 +48,12 @@
   movne r0, #0
   bx    lr
 
+//UINTN
+//ArmPlatformGetCorePosition (
+//  IN UINTN MpId
+//  );
+ASM_PFX(ArmPlatformGetCorePosition):
+  and   r0, r0, #ARM_CORE_MASK
+  bx    lr
+
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED

Modified: 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
===================================================================
--- 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
      2013-05-10 12:44:30 UTC (rev 14345)
+++ 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
      2013-05-10 12:46:11 UTC (rev 14346)
@@ -12,6 +12,7 @@
 //
 
 #include <AsmMacroIoLib.h>
+#include <Library/ArmLib.h>
 
 #include <AutoGen.h>
 
@@ -19,6 +20,7 @@
 
   EXPORT  ArmPlatformIsPrimaryCore
   EXPORT  ArmPlatformGetPrimaryCoreMpId
+  EXPORT  ArmPlatformGetCorePosition
 
   IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCore
   IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
@@ -51,4 +53,13 @@
   bx    lr
   ENDFUNC
 
+//UINTN
+//ArmPlatformGetCorePosition (
+//  IN UINTN MpId
+//  );
+ArmPlatformGetCorePosition FUNCTION
+  and   r0, r0, #ARM_CORE_MASK
+  bx    lr
+  ENDFUNC
+
   END

Modified: 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
===================================================================
--- 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
        2013-05-10 12:44:30 UTC (rev 14345)
+++ 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
        2013-05-10 12:46:11 UTC (rev 14346)
@@ -13,6 +13,7 @@
 
 #include <AsmMacroIoLib.h>
 #include <Base.h>
+#include <Library/ArmLib.h>
 #include <Library/PcdLib.h>
 #include <AutoGen.h>
 
@@ -24,6 +25,7 @@
 GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
 
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
@@ -96,4 +98,14 @@
   movne r0, #0
   bx   lr
 
+//UINTN
+//ArmPlatformGetCorePosition (
+//  IN UINTN MpId
+//  );
+ASM_PFX(ArmPlatformGetCorePosition):
+  and   r1, r0, #ARM_CORE_MASK
+  and   r0, r0, #ARM_CLUSTER_MASK
+  add   r0, r1, r0, LSR #7
+  bx    lr
+
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED 

Modified: 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
===================================================================
--- 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
      2013-05-10 12:44:30 UTC (rev 14345)
+++ 
trunk/edk2/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
      2013-05-10 12:46:11 UTC (rev 14346)
@@ -1,5 +1,5 @@
 //
-//  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+//  Copyright (c) 2011-2013, 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         
@@ -13,6 +13,7 @@
 
 #include <AsmMacroIoLib.h>
 #include <Base.h>
+#include <Library/ArmLib.h>
 #include <Library/PcdLib.h>
 
 #include <Chipset/ArmCortexA9.h>
@@ -24,9 +25,10 @@
   EXPORT    ArmGetCpuCountPerCluster
   EXPORT    ArmPlatformIsPrimaryCore
   EXPORT    ArmPlatformGetPrimaryCoreMpId
+  EXPORT    ArmPlatformGetCorePosition
 
-  IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCore
-  IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
+  IMPORT    _gPcd_FixedAtBuild_PcdArmPrimaryCore
+  IMPORT    _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
 
   AREA RTSMHelper, CODE, READONLY
 
@@ -103,4 +105,15 @@
   bx   lr
   ENDFUNC
 
+//UINTN
+//ArmPlatformGetCorePosition (
+//  IN UINTN MpId
+//  );
+ArmPlatformGetCorePosition FUNCTION
+  and   r1, r0, #ARM_CORE_MASK
+  and   r0, r0, #ARM_CLUSTER_MASK
+  add   r0, r1, r0, LSR #7
+  bx    lr
+  ENDFUNC
+
   END

Modified: trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
===================================================================
--- trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S     
2013-05-10 12:44:30 UTC (rev 14345)
+++ trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S     
2013-05-10 12:46:11 UTC (rev 14346)
@@ -20,6 +20,7 @@
 .align 3
 
 GCC_ASM_IMPORT(CEntryPoint)
+GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
 GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
 GCC_ASM_IMPORT(ArmReadMpidr)
 GCC_ASM_EXPORT(_ModuleEntryPoint)
@@ -47,8 +48,10 @@
 _SetupSecondaryCoreStack:
   // r1 contains the base of the secondary stacks
 
-  // Get the Core Position (ClusterId * 4) + CoreId
-  GetCorePositionFromMpId(r0, r5, r2)
+  // Get the Core Position
+  mov   r6, r1      // Save base of the secondary stacks
+  mov   r0, r5
+  bl    ASM_PFX(ArmPlatformGetCorePosition)
   // The stack starts at the top of the stack region. Add '1' to the Core 
Position to get the top of the stack
   add   r0, r0, #1
 
@@ -56,7 +59,7 @@
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)
   mul   r0, r0, r2
   // SP = StackBase + StackOffset
-  add   sp, r1, r0
+  add   sp, r6, r0
 
 _PrepareArguments:
   // The PEI Core Entry Point has been computed by GenFV and stored in the 
second entry of the Reset Vector

Modified: trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
===================================================================
--- trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm   
2013-05-10 12:44:30 UTC (rev 14345)
+++ trunk/edk2/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm   
2013-05-10 12:46:11 UTC (rev 14346)
@@ -19,6 +19,7 @@
   INCLUDE AsmMacroIoLib.inc
   
   IMPORT  CEntryPoint
+  IMPORT  ArmPlatformGetCorePosition
   IMPORT  ArmPlatformIsPrimaryCore
   IMPORT  ArmReadMpidr
   EXPORT  _ModuleEntryPoint
@@ -49,8 +50,10 @@
 _SetupSecondaryCoreStack
   // r1 contains the base of the secondary stacks
 
-  // Get the Core Position (ClusterId * 4) + CoreId
-  GetCorePositionFromMpId(r0, r5, r2)
+  // Get the Core Position
+  mov   r6, r1      // Save base of the secondary stacks
+  mov   r0, r5
+  bl    ArmPlatformGetCorePosition
   // The stack starts at the top of the stack region. Add '1' to the Core 
Position to get the top of the stack
   add   r0, r0, #1
 
@@ -58,7 +61,7 @@
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)
   mul   r0, r0, r2
   // SP = StackBase + StackOffset
-  add   sp, r1, r0
+  add   sp, r6, r0
 
 _PrepareArguments
   // The PEI Core Entry Point has been computed by GenFV and stored in the 
second entry of the Reset Vector

Modified: trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
===================================================================
--- trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S   2013-05-10 12:44:30 UTC 
(rev 14345)
+++ trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.S   2013-05-10 12:46:11 UTC 
(rev 14346)
@@ -20,6 +20,7 @@
 
 GCC_ASM_IMPORT(CEntryPoint)
 GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
+GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
 GCC_ASM_IMPORT(ArmPlatformSecBootAction)
 GCC_ASM_IMPORT(ArmPlatformSecBootMemoryInit)
 GCC_ASM_IMPORT(ArmDisableInterrupts)
@@ -91,10 +92,11 @@
   // Get the top of the primary stacks (and the base of the secondary stacks)
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)
-  add   r1, r1, r2
+  add   r6, r1, r2
 
-  // Get the Core Position (ClusterId * 4) + CoreId
-  GetCorePositionFromMpId(r0, r9, r2)
+  // Get the Core Position
+  mov   r0, r9
+  bl    ASM_PFX(ArmPlatformGetCorePosition)
   // The stack starts at the top of the stack region. Add '1' to the Core 
Position to get the top of the stack
   add   r0, r0, #1
 
@@ -102,7 +104,7 @@
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2)
   mul   r0, r0, r2
   // SP = StackBase + StackOffset
-  add   sp, r1, r0
+  add   sp, r6, r0
 
 _PrepareArguments:
   // Move sec startup address into a data register

Modified: trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm
===================================================================
--- trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm 2013-05-10 12:44:30 UTC 
(rev 14345)
+++ trunk/edk2/ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm 2013-05-10 12:46:11 UTC 
(rev 14346)
@@ -19,6 +19,7 @@
   
   IMPORT  CEntryPoint
   IMPORT  ArmPlatformIsPrimaryCore
+  IMPORT  ArmPlatformGetCorePosition
   IMPORT  ArmPlatformSecBootAction
   IMPORT  ArmPlatformSecBootMemoryInit
   IMPORT  ArmDisableInterrupts
@@ -93,10 +94,11 @@
   // Get the top of the primary stacks (and the base of the secondary stacks)
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)
-  add   r1, r1, r2
+  add   r6, r1, r2
 
-  // Get the Core Position (ClusterId * 4) + CoreId
-  GetCorePositionFromMpId(r0, r9, r2)
+  // Get the Core Position
+  mov   r0, r9
+  bl    ArmPlatformGetCorePosition
   // The stack starts at the top of the stack region. Add '1' to the Core 
Position to get the top of the stack
   add   r0, r0, #1
 
@@ -104,7 +106,7 @@
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2)
   mul   r0, r0, r2
   // SP = StackBase + StackOffset
-  add   sp, r1, r0
+  add   sp, r6, r0
 
 _PrepareArguments
   // Move sec startup address into a data register

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to