From nobody Mon Sep 16 19:54:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1529071831737244.18149845579683; Fri, 15 Jun 2018 07:10:31 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A59E0210F2579; Fri, 15 Jun 2018 07:10:30 -0700 (PDT) Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 278D0210F2016 for ; Fri, 15 Jun 2018 07:10:28 -0700 (PDT) Received: from E107875.Emea.Arm.com (e107875.emea.arm.com [10.1.206.50]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w5FEAPB0002333; Fri, 15 Jun 2018 15:10:26 +0100 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.96.140; helo=cam-smtp0.cambridge.arm.com; envelope-from=girish.pathak@arm.com; receiver=edk2-devel@lists.01.org From: Girish Pathak To: edk2-devel@lists.01.org Date: Fri, 15 Jun 2018 15:10:20 +0100 Message-Id: <20180615141020.9428-3-girish.pathak@arm.com> X-Mailer: git-send-email 2.13.3.windows.1 In-Reply-To: <20180615141020.9428-1-girish.pathak@arm.com> References: <20180615141020.9428-1-girish.pathak@arm.com> Subject: [edk2] [PATCH v1 2/2] ArmPkg/ArmScmiDxe: Dynamically allocate buffer for protocol ids X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Stephanie.Hughes-Fitt@arm.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Dynamically allocate the buffer to receive the SCMI protocol list. This makes MAX_PROTOCOLS redundant, so it is removed. It also fixes one minor code alignment issue and removes an unused macro PROTOCOL_MASK. Change-Id: Idc5880d4fb7b5c674f5fb7dce1198a7cad0303a7 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Tested-by: Sudeep Holla --- ArmPkg/Drivers/ArmScmiDxe/Scmi.c | 5 ---- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c | 27 +++++++++++++++----- ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h | 1 - 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/Scmi.c b/ArmPkg/Drivers/ArmScmiDxe/S= cmi.c index 1e279f69cf615428dbb6477b8ac7de3258628df3..d247d3a932fe9f197460a95e9af= a88681742e4b4 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/Scmi.c +++ b/ArmPkg/Drivers/ArmScmiDxe/Scmi.c @@ -22,11 +22,6 @@ =20 #include "ScmiPrivate.h" =20 -// SCMI Specification 1.0 -#define MAX_PROTOCOLS 6 - -#define PROTOCOL_MASK 0xF - // Arbitrary timeout value 20ms. #define RESPONSE_TIMEOUT 20000 =20 diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c b/ArmPkg/Drivers/ArmScmiDx= e/ScmiDxe.c index cc68cbc922fcc06bff8f7e0aa8b6bf64a9932874..e7b9feca5e1b565fc031385bfe2= f2dc0ca53aab0 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.c @@ -63,8 +63,8 @@ ArmScmiDxeEntryPoint ( UINT32 Index; UINT32 NumProtocols; UINT32 ProtocolIndex =3D 0; - UINT8 SupportedList[MAX_PROTOCOLS]; - UINT32 SupportedListSize =3D sizeof (SupportedList); + UINT8 *SupportedList; + UINT32 SupportedListSize; =20 // Every SCMI implementation must implement the base protocol. ASSERT (Protocols[ProtocolIndex].Id =3D=3D SCMI_PROTOCOL_ID_BASE); @@ -108,13 +108,26 @@ ArmScmiDxeEntryPoint ( =20 ASSERT (NumProtocols !=3D 0); =20 + SupportedListSize =3D (NumProtocols * sizeof (*SupportedList)); + + Status =3D gBS->AllocatePool ( + EfiBootServicesData, + SupportedListSize, + (VOID**)&SupportedList + ); + if (EFI_ERROR (Status)) { + ASSERT (FALSE); + return Status; + } + // Get the list of protocols supported by SCP firmware on the platform. Status =3D BaseProtocol->DiscoverListProtocols ( - BaseProtocol, - &SupportedListSize, - SupportedList - ); + BaseProtocol, + &SupportedListSize, + SupportedList + ); if (EFI_ERROR (Status)) { + gBS->FreePool (SupportedList); ASSERT (FALSE); return Status; } @@ -133,5 +146,7 @@ ArmScmiDxeEntryPoint ( } } =20 + gBS->FreePool (SupportedList); + return EFI_SUCCESS; } diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h b/ArmPkg/Drivers/ArmScmiDx= e/ScmiDxe.h index 5815e1e78074067760b6f618e248526ee25e59c8..b50a52a01d47efbbccec8c97bf4= 4041c47ff8b38 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiDxe.h @@ -19,7 +19,6 @@ =20 #include "ScmiPrivate.h" =20 -#define MAX_PROTOCOLS 6 #define MAX_VENDOR_LEN SCMI_MAX_STR_LEN =20 /** Pointer to protocol initialization function. --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel