GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
\r
ASM_PFX(ArmPlatformPeiBootAction):\r
bx lr\r
movne r0, #0\r
bx lr\r
\r
+//UINTN\r
+//ArmPlatformGetPrimaryCoreMpId (\r
+// VOID\r
+// );\r
+ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
+ // Extract cpu_id and cluster_id from ARM_SCC_CFGREG48\r
+ // with cpu_id[0:3] and cluster_id[4:7]\r
+ LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)\r
+ ldr r0, [r0]\r
+ lsr r0, #24\r
+\r
+ // Shift the SCC value to get the cluster ID at the offset #8\r
+ lsl r1, r0, #4\r
+ and r1, r1, #0xF00\r
+\r
+ // Keep only the cpu ID from the original SCC\r
+ and r0, r0, #0x0F\r
+ // Add the Cluster ID to the Cpu ID\r
+ orr r0, r0, r1\r
+ bx lr\r