From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mx.groups.io with SMTP id smtpd.web11.38139.1634571595411544449 for ; Mon, 18 Oct 2021 08:39:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20210112.gappssmtp.com header.s=20210112 header.b=TSEskH57; spf=pass (domain: nuviainc.com, ip: 209.85.214.169, mailfrom: rebecca@nuviainc.com) Received: by mail-pl1-f169.google.com with SMTP id g5so11533589plg.1 for ; Mon, 18 Oct 2021 08:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Agrq1FTO57n6gNKmvfNGVVP+BjaVh5TF1D6DR8sGSCg=; b=TSEskH57J2ZiYLHvIy3TSjEZ93wHfzwrSmZdeGUQnJbNvrGqoech6fRpdSCXpLWagU Q16p3ftzaL/xg/Puo0z93KrEgGYuNTfIwW2vf+AQqpoheCnnGtz33HvagHKEuXw+2zCf VIz5I1WcIJAD1tBC7QkA0iQ1qH/2m2LsShckHEoPAdqjHtLLmSQqnmWzd5a554O67I6P BDx2TnsL9cAZuXGBCqA5yuAFtQP6iGMfY3mX1VP+doY8aOhmP+WVjq1puf6WBM/seRm0 u6HO+bVtb/m+Xt2tXxLCX/O9qGWTbGHdANbU+3KEfmlxlHBT5OqTeFkM918Syar+uOb/ crtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Agrq1FTO57n6gNKmvfNGVVP+BjaVh5TF1D6DR8sGSCg=; b=u5aKF8+92BWiy1f4P5ZDdMc2Lv/k0YxFiQbet0Pp1JUSoTVUvr7RsVwE+AMVzSweWl buz4uku1O8pHN8Mh0N6kKs7aLCtuI7mHeuwAKd2q2lZkXFTxOqqJyQMPKAhTIKdhg2bn oT3neybEU9wi5QIasVGGrqqi3BwSyqyBUOaLILDQ2u6cK/wv8wtD2YhA6O/C4s1Np7DI qpka0iqAwipIFTu9H43lLMk7PguQpPL0egs0av7w2RB1shir7yCRsMnYT1/sN1+n4iP0 N0aZM0tqZVJxJbSwvjIXq0AF2LW0FcUqwoRRGycYNw2+uQGCHupv1PTsKdtp1O+cgfdS cGqw== X-Gm-Message-State: AOAM532cTouBVMDEDTMivV7I1EMHr60RGfb2yG6sbGN3zV5aTDK3xcQm hZSspS+lSrAc9owr5I0de+BbZQ== X-Google-Smtp-Source: ABdhPJwpSb5i0LQLvhn/IVeSR7O85J0zXEOkuX8YOhzt8o9d9AFbGfHYZwEm1oZn1kssMbhErA11WA== X-Received: by 2002:a17:902:dacb:b0:13e:f6c3:57dd with SMTP id q11-20020a170902dacb00b0013ef6c357ddmr27503704plx.45.1634571594946; Mon, 18 Oct 2021 08:39:54 -0700 (PDT) Return-Path: Received: from linbox.ba.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y3sm13246952pfo.188.2021.10.18.08.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 08:39:54 -0700 (PDT) From: "Rebecca Cran" To: Sami Mujawar , Ard Biesheuvel , Gerd Hoffmann , Samer El-Haj-Mahmoud , Leif Lindholm , devel@edk2.groups.io Cc: Rebecca Cran Subject: [PATCH 1/2] ArmPkg: Replace CoreId and ClusterId with Mpidr in ARM_CORE_INFO struct Date: Mon, 18 Oct 2021 09:39:44 -0600 Message-Id: <20211018153945.1690-2-rebecca@nuviainc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018153945.1690-1-rebecca@nuviainc.com> References: <20211018153945.1690-1-rebecca@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- ArmPkg/Include/Guid/ArmMpCoreInfo.h | 3 +-- ArmPkg/Include/Library/ArmLib.h | 4 ++++ ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c | 8 ++++---- ArmPlatformPkg/PrePeiCore/MainMPCore.c | 2 +- ArmPlatformPkg/PrePi/MainMPCore.c | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ArmPkg/Include/Guid/ArmMpCoreInfo.h b/ArmPkg/Include/Guid/ArmMpCoreInfo.h index b810767879ae..04c44650ebf5 100644 --- a/ArmPkg/Include/Guid/ArmMpCoreInfo.h +++ b/ArmPkg/Include/Guid/ArmMpCoreInfo.h @@ -14,8 +14,7 @@ #define MPIDR_U_BIT_MASK 0x40000000 typedef struct { - UINT32 ClusterId; - UINT32 CoreId; + UINT64 Mpidr; // MP Core Mailbox EFI_PHYSICAL_ADDRESS MailboxSetAddress; diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index 79ea755777a9..d764cc670970 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -107,6 +107,10 @@ typedef enum { #define GET_CORE_ID(MpId) ((MpId) & ARM_CORE_MASK) #define GET_CLUSTER_ID(MpId) (((MpId) & ARM_CLUSTER_MASK) >> 8) #define GET_MPID(ClusterId, CoreId) (((ClusterId) << 8) | (CoreId)) +#define GET_MPIDR_AFF0(MpId) ((MpId) & ARM_CORE_AFF0) +#define GET_MPIDR_AFF1(MpId) (((MpId) & ARM_CORE_AFF1) >> 8) +#define GET_MPIDR_AFF2(MpId) (((MpId) & ARM_CORE_AFF2) >> 16) +#define GET_MPIDR_AFF3(MpId) (((MpId) & ARM_CORE_AFF3) >> 32) #define PRIMARY_CORE_ID (PcdGet32(PcdArmPrimaryCore) & ARM_CORE_MASK) /** Reads the CCSIDR register for the specified cache. diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c index 1cd9ec30a977..6630cb68452c 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c +++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c @@ -15,7 +15,7 @@ ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = { { // Cluster 0, Core 0 - 0x0, 0x0, + 0x0, // MP Core MailBox Set/Get/Clear Addresses and Clear Value (EFI_PHYSICAL_ADDRESS)0, @@ -25,7 +25,7 @@ ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = { }, { // Cluster 0, Core 1 - 0x0, 0x1, + 0x1, // MP Core MailBox Set/Get/Clear Addresses and Clear Value (EFI_PHYSICAL_ADDRESS)0, @@ -35,7 +35,7 @@ ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = { }, { // Cluster 0, Core 2 - 0x0, 0x2, + 0x2, // MP Core MailBox Set/Get/Clear Addresses and Clear Value (EFI_PHYSICAL_ADDRESS)0, @@ -45,7 +45,7 @@ ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = { }, { // Cluster 0, Core 3 - 0x0, 0x3, + 0x3, // MP Core MailBox Set/Get/Clear Addresses and Clear Value (EFI_PHYSICAL_ADDRESS)0, diff --git a/ArmPlatformPkg/PrePeiCore/MainMPCore.c b/ArmPlatformPkg/PrePeiCore/MainMPCore.c index 859f1adf2078..5f8a268bf664 100644 --- a/ArmPlatformPkg/PrePeiCore/MainMPCore.c +++ b/ArmPlatformPkg/PrePeiCore/MainMPCore.c @@ -65,7 +65,7 @@ SecondaryMain ( // Find the core in the ArmCoreTable for (Index = 0; Index < ArmCoreCount; Index++) { - if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) { + if ((GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr) == ClusterId) && (GET_MPIDR_AFF0 (ArmCoreInfoTable[Index].Mpidr) == CoreId)) { break; } } diff --git a/ArmPlatformPkg/PrePi/MainMPCore.c b/ArmPlatformPkg/PrePi/MainMPCore.c index 091464df2aa9..6497a1ad27fd 100644 --- a/ArmPlatformPkg/PrePi/MainMPCore.c +++ b/ArmPlatformPkg/PrePi/MainMPCore.c @@ -64,7 +64,7 @@ SecondaryMain ( // Find the core in the ArmCoreTable for (Index = 0; Index < ArmCoreCount; Index++) { - if ((ArmCoreInfoTable[Index].ClusterId == ClusterId) && (ArmCoreInfoTable[Index].CoreId == CoreId)) { + if ((GET_MPIDR_AFF1 (ArmCoreInfoTable[Index].Mpidr) == ClusterId) && (GET_MPIDR_AFF0 (ArmCoreInfoTable[Index].Mpidr) == CoreId)) { break; } } -- 2.31.1