From nobody Mon Sep 16 19:48:25 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 1529064025571943.7916709445864; Fri, 15 Jun 2018 05:00:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 25AD1210F673B; Fri, 15 Jun 2018 05:00:21 -0700 (PDT) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 0D300210E38B1 for ; Fri, 15 Jun 2018 05:00:19 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B870C1529; Fri, 15 Jun 2018 05:00:19 -0700 (PDT) Received: from usa.arm.com (a73437-lin.blr.arm.com [10.162.0.155]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CE2FA3F557; Fri, 15 Jun 2018 05:00:18 -0700 (PDT) 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.101.70; helo=foss.arm.com; envelope-from=chandni.cherukuri@arm.com; receiver=edk2-devel@lists.01.org From: Chandni Cherukuri To: edk2-devel@lists.01.org Date: Fri, 15 Jun 2018 17:30:02 +0530 Message-Id: <1529064002-18779-3-git-send-email-chandni.cherukuri@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529064002-18779-1-git-send-email-chandni.cherukuri@arm.com> References: <1529064002-18779-1-git-send-email-chandni.cherukuri@arm.com> Subject: [edk2] [PATCH edk2-platforms v2 2/2] Platform/ARM/Sgi: Pick ACPI tables to install based on platform ID 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: 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" Use the platform ID and config ID values from the platform ID HOB to choose the right set of ACPI tables to be installed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chandni Cherukuri --- Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 33 +++++++++++++= ++++--- Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++ Platform/ARM/SgiPkg/SgiPlatform.dsc | 1 + Platform/ARM/SgiPkg/SgiPlatform.fdf | 1 + 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platfo= rm/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c index edaae5b..f077a2c 100644 --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c @@ -14,6 +14,8 @@ =20 #include #include +#include +#include =20 EFI_STATUS InitVirtioBlockIo ( @@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint ( ) { EFI_STATUS Status; + VOID *PlatformIdHob; + SGI_PLATFORM_DESCRIPTOR *HobData; + UINT32 ConfigId; + UINT32 PartNum; =20 - Status =3D LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION= __)); - return Status; + PlatformIdHob =3D GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid); + if (PlatformIdHob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n")); + return EFI_INVALID_PARAMETER; + } + + HobData =3D (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob= )); + + PartNum =3D (HobData->PlatformId & SGI_PART_NUM_MASK); + ConfigId =3D ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MAS= K); + + if ((PartNum =3D=3D SGI575_PART_NUM) && (ConfigId =3D=3D SGI575_CONF_NUM= )) { + Status =3D LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTI= ON__)); + return Status; + } + } else { + DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n")); + return EFI_UNSUPPORTED; } =20 - Status =3D EFI_REQUEST_UNLOAD_IMAGE; if (FeaturePcdGet (PcdVirtioSupported)) { Status =3D InitVirtioBlockIo (ImageHandle); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n", __FUNCTION__)); } + } else { + Status =3D EFI_REQUEST_UNLOAD_IMAGE; } =20 return Status; diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Plat= form/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf index 51ad22f..b6b8209 100644 --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf @@ -30,10 +30,12 @@ =20 [LibraryClasses] AcpiLib + HobLib UefiDriverEntryPoint VirtioMmioDeviceLib =20 [Guids] + gArmSgiPlatformIdDescriptorGuid gSgi575AcpiTablesiFileGuid =20 [FeaturePcd] diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiP= latform.dsc index a56175e..7b8e051 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc @@ -199,6 +199,7 @@ NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf } + Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf =20 # # DXE diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiP= latform.fdf index 17cdf48..0e5739e 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf @@ -220,6 +220,7 @@ READ_LOCK_STATUS =3D TRUE INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.i= nf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf =20 FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE { --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel