]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Include/AsmMacroIoLib.h
ArmPlatformPkg/ArmPlatformLib: Added support for ArmPlatformIsPrimaryCore()
[mirror_edk2.git] / ArmPkg / Include / AsmMacroIoLib.h
index c8692fcfd71e7cd70f3677ea17fee105d32cc3f7..c5073297417568a7ced154547a70fbb4cf31ffc0 100644 (file)
 \r
 // Convert the (ClusterId,CoreId) into a Core Position\r
 // We assume there are 4 cores per cluster\r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp) \\r
-  lsr   Pos, MpId, #6 ;                        \\r
-  and   Tmp, MpId, #3 ;                        \\r
+// Note: 0xFFFF is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK\r
+#define GetCorePositionFromMpId(Pos, MpId, Tmp)  \\r
+  ldr   Tmp, =0xFFFF                             \\r
+  and   MpId, Tmp                                \\r
+  lsr   Pos, MpId, #6 ;                          \\r
+  and   Tmp, MpId, #3 ;                          \\r
   add   Pos, Pos, Tmp\r
 \r
 // Reserve a region at the top of the Primary Core stack\r
@@ -207,10 +210,15 @@ _InitializePrimaryStackEnd:
 \r
 #define LoadConstantToReg(Data, Reg) \\r
   ldr  Reg, =Data\r
-  \r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp) \\r
-  lsr   Pos, MpId, #6 ;                        \\r
-  and   Tmp, MpId, #3 ;                        \\r
+\r
+// Convert the (ClusterId,CoreId) into a Core Position\r
+// We assume there are 4 cores per cluster\r
+// Note: 0xFFFF is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK\r
+#define GetCorePositionFromMpId(Pos, MpId, Tmp)    \\r
+  ldr   Tmp, =0xFFFF ;                             \\r
+  and   MpId, Tmp ;                                \\r
+  lsr   Pos, MpId, #6 ;                            \\r
+  and   Tmp, MpId, #3 ;                            \\r
   add   Pos, Pos, Tmp\r
 \r
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \\r