public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@nuviainc.com>
To: devel@edk2.groups.io, Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Wenyi Xie <xiewenyi2@huawei.com>,
	Peng Xie <xiepeng@phytium.com.cn>,
	Ling Jia <jialing@phytium.com.cn>,
	Yiqi Shu <shuyiqi@phytium.com.cn>,
	Nhi Pham <nhi@os.amperecomputing.com>,
	Vu Nguyen <vunguyen@os.amperecomputing.com>,
	Thang Nguyen <thang@os.amperecomputing.com>,
	Chuong Tran <chuong@os.amperecomputing.com>,
	Pete Batard <pete@akeo.ie>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Graeme Gregory <graeme@nuviainc.com>,
	Radoslaw Biernacki <rad@semihalf.com>,
	Marcin Wojtas <mw@semihalf.com>
Cc: Rebecca Cran <rebecca@nuviainc.com>
Subject: [PATCH v2 12/17] Silicon/AMD: Update Styx code to work with changes ARM_CORE_INFO struct
Date: Thu, 16 Dec 2021 15:07:55 -0700	[thread overview]
Message-ID: <20211216220800.9628-13-rebecca@nuviainc.com> (raw)
In-Reply-To: <20211216220800.9628-1-rebecca@nuviainc.com>

The ARM_CORE_INFO struct has been updated so the MPIDR is now a single
field instead of separate cluster/core fields. Update the Styx code in
AcpiPlatformDxe, PlatInitPei and StyxDtbLoaderLib.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
---
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c      |  3 +--
 Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c           |  8 +++----
 Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c | 22 +++++++++-----------
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
index 7c267542db19..5f059110ff0c 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
@@ -100,8 +100,7 @@ EnableAvailableCores (
 
   while (CoreCount--) {
     for (Index = 0; Index < MAX_CORES; Index++) {
-      if (GicC[Index].MPIDR == GET_MPID (ArmCoreInfoTable->ClusterId,
-                                         ArmCoreInfoTable->CoreId)) {
+      if (GicC[Index].MPIDR == ArmCoreInfoTable->Mpidr) {
         GicC[Index].Flags |= EFI_ACPI_5_1_GIC_ENABLED;
         break;
       }
diff --git a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
index 3f359ffbd2d8..45490aa33c5a 100644
--- a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
+++ b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
@@ -166,12 +166,12 @@ PlatInitPeiEntryPoint (
       ASSERT (CpuResetInfo.CoreStatus.Status != CPU_CORE_DISABLED);
       ASSERT (CpuResetInfo.CoreStatus.Status != CPU_CORE_UNDEFINED);
 
-      mAmdMpCoreInfoTable[Index].ClusterId = CpuResetInfo.CoreStatus.ClusterId;
-      mAmdMpCoreInfoTable[Index].CoreId = CpuResetInfo.CoreStatus.CoreId;
+      mAmdMpCoreInfoTable[Index].Mpidr = GET_MPID (CpuResetInfo.CoreStatus.ClusterId,
+		                           CpuResetInfo.CoreStatus.CoreId);
 
       DEBUG ((EFI_D_ERROR, "Core[%d]: ClusterId = %d   CoreId = %d\n",
-        Index, mAmdMpCoreInfoTable[Index].ClusterId,
-        mAmdMpCoreInfoTable[Index].CoreId));
+        Index, GET_MPIDR_AFF1 (mAmdMpCoreInfoTable[Index].Mpidr),
+        GET_MPIDR_AFF0 (mAmdMpCoreInfoTable[Index].Mpidr)));
 
       // Next core in Table
       ++Index;
diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
index 75e529021d09..178fb5698504 100644
--- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
+++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
@@ -50,7 +50,7 @@ ClusterInRange (
   )
 {
   do {
-    if (ClusterId == ArmCoreInfoTable[LowIndex].ClusterId)
+    if (ClusterId == GET_MPIDR_AFF1 (ArmCoreInfoTable[LowIndex].Mpidr))
       return TRUE;
   } while (++LowIndex <= HighIndex);
 
@@ -70,7 +70,7 @@ NumberOfCoresInCluster (
 
   Cores = 0;
   for (Index = 0; Index < NumberOfEntries; ++Index) {
-    if (ClusterId == ArmCoreInfoTable[Index].ClusterId)
+    if (ClusterId == GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr))
       ++Cores;
   }
 
@@ -92,7 +92,7 @@ NumberOfClustersInTable (
   Cores = NumberOfEntries;
   while (Cores) {
      ++Clusters;
-     ClusterId = ArmCoreInfoTable[Index].ClusterId;
+     ClusterId = GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr);
      Cores -= NumberOfCoresInCluster (ArmCoreInfoTable,
                                       NumberOfEntries,
                                       ClusterId);
@@ -100,7 +100,7 @@ NumberOfClustersInTable (
        do {
          ++Index;
        } while (ClusterInRange (ArmCoreInfoTable,
-                                ArmCoreInfoTable[Index].ClusterId,
+                                GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr),
                                 0, Index-1));
      }
   }
@@ -402,8 +402,7 @@ PrepareFdt (
 
     fdt_setprop_string (Fdt, CpuNode, "enable-method", "psci");
 
-    MpId = (UINTN)GET_MPID (ArmCoreInfoTable[Index].ClusterId,
-                            ArmCoreInfoTable[Index].CoreId);
+    MpId = ArmCoreInfoTable[Index].Mpidr;
     MpId = cpu_to_fdt64 (MpId);
     fdt_setprop (Fdt, CpuNode, "reg", &MpId, sizeof (MpId));
     fdt_setprop (Fdt, CpuNode, "compatible", mCpuCompatible,
@@ -417,7 +416,7 @@ PrepareFdt (
     fdt_setprop_cell (Fdt, CpuNode, "d-cache-line-size", 64);
     fdt_setprop_cell (Fdt, CpuNode, "d-cache-sets", 256);
     fdt_setprop_cell (Fdt, CpuNode, "l2-cache",
-      L2Phandle[ArmCoreInfoTable[Index].ClusterId]);
+      L2Phandle[GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr)]);
   }
 
   // Create /cpu-map node
@@ -435,7 +434,7 @@ PrepareFdt (
         return EFI_INVALID_PARAMETER;
       }
 
-      ClusterId = ArmCoreInfoTable[ClusterIndex].ClusterId;
+      ClusterId = GET_MPIDR_AFF1 (ArmCoreInfoTable[ClusterIndex].Mpidr);
       CoreIndex = ClusterIndex;
       CoresInCluster = NumberOfCoresInCluster (ArmCoreInfoTable,
                                                ArmCoreCount,
@@ -454,7 +453,7 @@ PrepareFdt (
         if (CoresInCluster) {
           do {
              --CoreIndex;
-          } while (ClusterId != ArmCoreInfoTable[CoreIndex].ClusterId);
+          } while (ClusterId != GET_MPIDR_AFF1 (ArmCoreInfoTable[CoreIndex].Mpidr));
         }
       }
 
@@ -463,7 +462,7 @@ PrepareFdt (
         do {
            --ClusterIndex;
         } while (ClusterInRange (ArmCoreInfoTable,
-                                 ArmCoreInfoTable[ClusterIndex].ClusterId,
+                                 GET_MPIDR_AFF1 (ArmCoreInfoTable[ClusterIndex].Mpidr),
                                  ClusterIndex + 1,
                                  ArmCoreCount - 1));
       }
@@ -481,8 +480,7 @@ PrepareFdt (
 
     // append PMU interrupts
     for (Index = 0; Index < ArmCoreCount; Index++) {
-      MpId = (UINTN)GET_MPID (ArmCoreInfoTable[Index].ClusterId,
-                              ArmCoreInfoTable[Index].CoreId);
+      MpId = (UINTN)ArmCoreInfoTable[Index].Mpidr;
 
       Status = AmdMpCoreInfoProtocol->GetPmuSpiFromMpId (MpId, &PmuInt.IntId);
       if (EFI_ERROR (Status)) {
-- 
2.31.1


  parent reply	other threads:[~2021-12-16 22:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 22:07 [PATCH v2 00/17] Update Arm platforms following addition of EFI_MP_SERVICES_PROTOCOL support in edk2 Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 01/17] Platform/ARM: Add MpInitLib instance Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 02/17] Platform/Socionext: Add instance of MpInitLib Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 03/17] Silicon/Marvell: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 04/17] Platform/Qemu: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 05/17] Platform/ARM: Update ARM_CORE_INFO initializer for MPIDR field change Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 06/17] Silicon/Marvell: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 07/17] Silicon/Socionext: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 08/17] Silicon/Qemu: " Rebecca Cran
2021-12-21 14:34   ` Graeme Gregory
2021-12-16 22:07 ` [PATCH v2 09/17] Platform/AMD: Add instance of MpInitLib to OverdriveBoard.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 10/17] Platform/SoftIron: Add instance of MpInitLib to Overdrive1000Board.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 11/17] Platform/RaspberryPi: Add instance of MpInitLib to RPi3.dsc and RPi4.dsc Rebecca Cran
2021-12-16 22:07 ` Rebecca Cran [this message]
2021-12-16 22:07 ` [PATCH v2 13/17] Silicon/Ampere: Add instance of MpInitLib to AmpereAltraPkg.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 14/17] Silicon/Ampere: Update ArmPlatformLib to work with changed ARM_CORE_INFO Rebecca Cran
2021-12-19  3:35   ` Nhi Pham
2022-01-30 10:36     ` Ard Biesheuvel
2022-01-31 12:08       ` Leif Lindholm
2022-02-08  3:41         ` Nhi Pham
2022-02-08  3:45       ` Nhi Pham
2022-03-25 16:30     ` [edk2-devel] " Leif Lindholm
2022-03-26  9:12       ` Nhi Pham
2022-03-26 22:00         ` Leif Lindholm
2022-03-29  2:57           ` Nhi Pham
2021-12-16 22:07 ` [PATCH v2 15/17] Silicon/Phytium: Add instance of MpInitLib to PhytiumCommonPkg.dsc.inf Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 16/17] Silicon/Phytium: Update FT2000-4Pkg PlatformLib for ARM_CORE_INFO change Rebecca Cran
2021-12-16 22:08 ` [PATCH v2 17/17] Silicon/Hisilicon: Add instance of MpInitLib to Hisilicon.dsc.inc Rebecca Cran
2022-01-30 11:01 ` [PATCH v2 00/17] Update Arm platforms following addition of EFI_MP_SERVICES_PROTOCOL support in edk2 Ard Biesheuvel
2022-01-31  9:07   ` Sami Mujawar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211216220800.9628-13-rebecca@nuviainc.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox