From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 4B316209605C9 for ; Sun, 17 Jun 2018 22:29:41 -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 E6DCF80D; Sun, 17 Jun 2018 22:29:40 -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 9DADC3F59D; Sun, 17 Jun 2018 22:29:39 -0700 (PDT) From: Chandni Cherukuri To: edk2-devel@lists.01.org Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org Date: Mon, 18 Jun 2018 10:59:01 +0530 Message-Id: <1529299741-30054-3-git-send-email-chandni.cherukuri@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529299741-30054-1-git-send-email-chandni.cherukuri@arm.com> References: <1529299741-30054-1-git-send-email-chandni.cherukuri@arm.com> Subject: [PATCH edk2-platforms v3 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: , X-List-Received-Date: Mon, 18 Jun 2018 05:29:41 -0000 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 | 30 +++++++++++++++++--- Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++ Platform/ARM/SgiPkg/SgiPlatform.dsc | 1 + Platform/ARM/SgiPkg/SgiPlatform.fdf | 1 + 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c index edaae5b..83adb63 100644 --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c @@ -14,6 +14,8 @@ #include #include +#include +#include EFI_STATUS InitVirtioBlockIo ( @@ -28,11 +30,31 @@ ArmSgiPkgEntryPoint ( ) { EFI_STATUS Status; + VOID *PlatformIdHob; + SGI_PLATFORM_DESCRIPTOR *HobData; + UINT32 ConfigId; + UINT32 PartNum; - Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__)); - return Status; + PlatformIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid); + if (PlatformIdHob == NULL) { + DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n")); + return EFI_INVALID_PARAMETER; + } + + HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob)); + + PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK); + ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK); + + if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) { + Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__)); + return Status; + } + } else { + DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n")); + return EFI_UNSUPPORTED; } Status = EFI_REQUEST_UNLOAD_IMAGE; diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/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 @@ [LibraryClasses] AcpiLib + HobLib UefiDriverEntryPoint VirtioMmioDeviceLib [Guids] + gArmSgiPlatformIdDescriptorGuid gSgi575AcpiTablesiFileGuid [FeaturePcd] diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.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/LzmaCustomDecompressLib.inf } + Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf # # DXE diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiPlatform.fdf index 17cdf48..0e5739e 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf @@ -220,6 +220,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { -- 2.7.4