]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Replace CoreId and ClusterId with Mpidr in ARM_CORE_INFO struct
authorRebecca Cran <rebecca@nuviainc.com>
Thu, 16 Dec 2021 03:46:31 +0000 (20:46 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sun, 30 Jan 2022 11:04:41 +0000 (11:04 +0000)
Remove the ClusterId and CoreId fields in the ARM_CORE_INFO structure in
favor of a new Mpidr field. Update code in
ArmPlatformPkg/PrePeiCore/MainMPCore and ArmPlatformPkg/PrePi/MainMPCore.c
to use the new field and call new macros GET_MPIDR_AFF0 and GET_MPIDR_AFF1
instead.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
ArmPkg/Include/Guid/ArmMpCoreInfo.h
ArmPkg/Include/Library/ArmLib.h
ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c
ArmPlatformPkg/PrePeiCore/MainMPCore.c
ArmPlatformPkg/PrePi/MainMPCore.c

index 06f9326ca021c61e0428a7fc877a647f85357b75..43f0848e78b899a69efc0c0c4fa1ea0ded52e2c2 100644 (file)
@@ -14,8 +14,7 @@
 #define MPIDR_U_BIT_MASK            0x40000000\r
 \r
 typedef struct {\r
-  UINT32                  ClusterId;\r
-  UINT32                  CoreId;\r
+  UINT64                  Mpidr;\r
 \r
   // MP Core Mailbox\r
   EFI_PHYSICAL_ADDRESS    MailboxSetAddress;\r
index e4d0476090c7b72dff82aeae4280e0bccf5f11d9..6566deebdde20861c8d93fd401cd14fe4f93a269 100644 (file)
@@ -111,6 +111,10 @@ typedef enum {
 #define GET_CORE_ID(MpId)            ((MpId) & ARM_CORE_MASK)\r
 #define GET_CLUSTER_ID(MpId)         (((MpId) & ARM_CLUSTER_MASK) >> 8)\r
 #define GET_MPID(ClusterId, CoreId)  (((ClusterId) << 8) | (CoreId))\r
+#define GET_MPIDR_AFF0(MpId)         ((MpId) & ARM_CORE_AFF0)\r
+#define GET_MPIDR_AFF1(MpId)         (((MpId) & ARM_CORE_AFF1) >> 8)\r
+#define GET_MPIDR_AFF2(MpId)         (((MpId) & ARM_CORE_AFF2) >> 16)\r
+#define GET_MPIDR_AFF3(MpId)         (((MpId) & ARM_CORE_AFF3) >> 32)\r
 #define PRIMARY_CORE_ID  (PcdGet32(PcdArmPrimaryCore) & ARM_CORE_MASK)\r
 \r
 /** Reads the CCSIDR register for the specified cache.\r
index eeab58805e675b53869d5bfeebe417f61265584d..852275f44fc329f9a1ea08372e894118ae0d7f5d 100644 (file)
@@ -14,7 +14,7 @@
 ARM_CORE_INFO  mArmPlatformNullMpCoreInfoTable[] = {\r
   {\r
     // Cluster 0, Core 0\r
-    0x0, 0x0,\r
+    0x0,\r
 \r
     // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
     (EFI_PHYSICAL_ADDRESS)0,\r
@@ -24,7 +24,7 @@ ARM_CORE_INFO  mArmPlatformNullMpCoreInfoTable[] = {
   },\r
   {\r
     // Cluster 0, Core 1\r
-    0x0, 0x1,\r
+    0x1,\r
 \r
     // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
     (EFI_PHYSICAL_ADDRESS)0,\r
@@ -34,7 +34,7 @@ ARM_CORE_INFO  mArmPlatformNullMpCoreInfoTable[] = {
   },\r
   {\r
     // Cluster 0, Core 2\r
-    0x0, 0x2,\r
+    0x2,\r
 \r
     // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
     (EFI_PHYSICAL_ADDRESS)0,\r
@@ -44,7 +44,7 @@ ARM_CORE_INFO  mArmPlatformNullMpCoreInfoTable[] = {
   },\r
   {\r
     // Cluster 0, Core 3\r
-    0x0, 0x3,\r
+    0x3,\r
 \r
     // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
     (EFI_PHYSICAL_ADDRESS)0,\r
index 0b8e5dfb3f309c5c72a966e38f7b0a34f66275b3..b5d0d3a6442ff6d13051842389c3262c5662611d 100644 (file)
@@ -68,7 +68,9 @@ SecondaryMain (
 \r
   // Find the core in the ArmCoreTable\r
   for (Index = 0; Index < ArmCoreCount; Index++) {\r
-    if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) {\r
+    if ((GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr) == ClusterId) &&\r
+        (GET_MPIDR_AFF0 (ArmCoreInfoTable[Index].Mpidr) == CoreId))\r
+    {\r
       break;\r
     }\r
   }\r
index ce53cea6367cd75c760ae2eab51bc0bbb1c94d2e..68a7c13298d0d17bd4ff4c2a4dfaf6928ffe4083 100644 (file)
@@ -67,7 +67,9 @@ SecondaryMain (
 \r
   // Find the core in the ArmCoreTable\r
   for (Index = 0; Index < ArmCoreCount; Index++) {\r
-    if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) {\r
+    if ((GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr) == ClusterId) &&\r
+        (GET_MPIDR_AFF0 (ArmCoreInfoTable[Index].Mpidr) == CoreId))\r
+    {\r
       break;\r
     }\r
   }\r