From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::241; helo=mail-io0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 547EA210F93E2 for ; Thu, 14 Jun 2018 23:18:25 -0700 (PDT) Received: by mail-io0-x241.google.com with SMTP id d185-v6so9748195ioe.0 for ; Thu, 14 Jun 2018 23:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bpXAKKpYD2ZwbUcLGvtnTzvU6GR1TIVLAMb3mRLzykA=; b=jTaZfBP3it3rkhTBkKEGDpLYhU1gGGVj+bUvOiwE06u5p2kNo6bZrhx1Vvg8rzl3AQ w25Xak/1rnBdBjdo+GBqBifodFaPCznLd3B5Z2EI4Fqp5Z+bfiCjYZ+FKzSm+qxIJD8b 8mUWtn8wt++j3bzw9vp2Lwe5BBekC09r9zZDM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=bpXAKKpYD2ZwbUcLGvtnTzvU6GR1TIVLAMb3mRLzykA=; b=gu/8Ewv4rv6aHNka001FC0N2FahusYiW9aqBz1ll0YK3ZpsYrjxpkdDw/As2FKb4TY BVP6cf/IhiYYZ72GxzDn4gW7+UGoulEBupveJLVdgEQ6Z7+jnrnGmzS4vqugb3+UYW2V HwF1M5TlfdB5SvefOrhXSQthmX/09/300Ls6y3xCi4We+Jvp2QMPE2yHUaM/5ONZaTY5 bKZbaRzStc+Qoj6Ygcn5ulnRMbscOMwWVWO5Sonu6lgnfChfb6EZ1YB2ulUhuplFXtDG MnlRlIyAsIlG7eYHHP1r+jF3fdfOOKw0vBFfipRqm8oFMVTZ3AEgzx9kL1HJS442EUTo UL8w== X-Gm-Message-State: APt69E0T5JKSdV8JG8nzfPRNlZGCBvdxB59/k5H4I5wJ9zu5KhUP6MkW bQleUTaHL2PFIzk0+gUY6XGJlGf/+uhYHvozPi6DlQ== X-Google-Smtp-Source: ADUXVKL29ymierCN2hW0/fZ32OBm7VbX13xILyNUiXnWoTwfaWRC2n/n18o3CkV4S+WL4nhyuYt5Ap7Bg3URX1uOmb4= X-Received: by 2002:a6b:520d:: with SMTP id g13-v6mr381006iob.60.1529043504379; Thu, 14 Jun 2018 23:18:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bbc7:0:0:0:0:0 with HTTP; Thu, 14 Jun 2018 23:18:23 -0700 (PDT) In-Reply-To: <1529042132-29377-3-git-send-email-chandni.cherukuri@arm.com> References: <1529042132-29377-1-git-send-email-chandni.cherukuri@arm.com> <1529042132-29377-3-git-send-email-chandni.cherukuri@arm.com> From: Ard Biesheuvel Date: Fri, 15 Jun 2018 08:18:23 +0200 Message-ID: To: Chandni Cherukuri Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [PATCH 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: Fri, 15 Jun 2018 06:18:25 -0000 Content-Type: text/plain; charset="UTF-8" Hello Chandni, On 15 June 2018 at 07:55, Chandni Cherukuri wrote: > 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 > --- > .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 33 ++++++++++++++++++---- > .../ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++ > Platform/ARM/SgiPkg/Include/SgiPlatform.h | 24 ++++++++++++++-- > Platform/ARM/SgiPkg/SgiPlatform.dsc | 1 + > Platform/ARM/SgiPkg/SgiPlatform.fdf | 1 + > 5 files changed, 53 insertions(+), 8 deletions(-) > > diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c > index edaae5b..d0d5808 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,20 +30,41 @@ 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; > if (FeaturePcdGet (PcdVirtioSupported)) { > Status = InitVirtioBlockIo (ImageHandle); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n", > __FUNCTION__)); > } > + } else { > + Status = EFI_REQUEST_UNLOAD_IMAGE; > } > > return Status; > 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/Include/SgiPlatform.h b/Platform/ARM/SgiPkg/Include/SgiPlatform.h > index 00ca7e9..756954c 100644 > --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h > +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h > @@ -12,8 +12,8 @@ > * > **/ > > -#ifndef __SGI_PLATFORM_H__ > -#define __SGI_PLATFORM_H__ > +#ifndef SGI_PLATFORM_H_ > +#define SGI_PLATFORM_H_ > > /*********************************************************************************** > // Platform Memory Map > @@ -68,4 +68,22 @@ > #define SGI_SYSPH_SYS_REG_FLASH 0x4C > #define SGI_SYSPH_SYS_REG_FLASH_RWEN 0x1 > > -#endif // __SGI_PLATFORM_H__ > +// SGI575_VERSION values > +#define SGI575_CONF_NUM 0x3 > +#define SGI575_PART_NUM 0x783 > + > +#define SGI_CONFIG_MASK 0x0F > +#define SGI_CONFIG_SHIFT 0x1C > +#define SGI_PART_NUM_MASK 0xFFF > + > +//HwConfig DT structure^M ^M ? > +typedef struct { > + UINT64 *HwConfigDtAddr; > +} SGI_HW_CONFIG_INFO_PPI; > + Please declare this PPI properly > +// ARM platform description data. > +typedef struct { > + UINTN PlatformId; > +} SGI_PLATFORM_DESCRIPTOR; > + > +#endif // SGI_PLATFORM_H_ > diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc > index a56175e..f571897 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/SgiPlatformPeiLib/SgiPlatformPeiLib.inf > > # > # DXE > diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiPlatform.fdf > index 17cdf48..05203a8 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/SgiPlatformPeiLib/SgiPlatformPeiLib.inf > > FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { > SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { > -- > 2.7.4 >