From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 30531D80851 for ; Thu, 14 Dec 2023 15:48:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MOSCYwggH7j3ZfHG9zQzKzyLZ2RuEUSgSnuZXk/G00s=; c=relaxed/simple; d=groups.io; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1702568913; v=1; b=M6f3shcMHqE61kjcs3LizyFJAlvCAX8ynCTUMR3JGAb2ujdfmV7dRvsc0v05buWmNG2b+ooO lZiPOaA3H7gQ7vCJz8g90KqksBM8D3a2Xu1YQ8215vmlJwERcGNPPThHFASB6jqjxj49dRKxahY d9o17GRGG20NB3zWGP3qRcww= X-Received: by 127.0.0.2 with SMTP id npQJYY7687511xIJZlfDVZib; Thu, 14 Dec 2023 07:48:33 -0800 X-Received: from smtp.joursoir.net (smtp.joursoir.net [91.192.102.115]) by mx.groups.io with SMTP id smtpd.web10.25836.1702568912604229951 for ; Thu, 14 Dec 2023 07:48:33 -0800 X-Received: from reeva (unknown [185.23.230.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.joursoir.net (Postfix) with ESMTPSA id CA48E41DC5; Thu, 14 Dec 2023 18:48:25 +0300 (MSK) Date: Thu, 14 Dec 2023 18:48:20 +0300 From: "Joursoir" To: devel@edk2.groups.io Cc: ray.ni@intel.com, guo.dong@intel.com, benjamin.you@intel.com, maurice.ma@intel.com, sean@starlabs.systems, james.lu@intel.com, gua.guo@intel.com Subject: Re: [edk2-devel] [PATCH 1/1] UefiPayloadPkg: Add SMM variable related HOBs support for SBL Message-ID: <20231214184820.143da680@reeva> In-Reply-To: <1796553B09588C08.3202@groups.io> References: <1796553B09588C08.3202@groups.io> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chat@joursoir.net List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: oKObd4HuBEaiZtsOZjaSPAtlx7686176AA= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=M6f3shcM; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none ping. any comments? On Fri, 10 Nov 2023 21:06:48 +0300 "Joursoir" wrote: > When UefiPayloadPkg is compiled with SMM_SUPPORT enabled and > VARIABLE_SUPPORT set to SPI, the following HOBs must be > available: >=20 > * gSmmRegisterInfoGuid > * gEfiSmmSmramMemoryGuid > * gSpiFlashInfoGuid > * gNvVariableInfoGuid > * gS3CommunicationGuid >=20 > Migrate these HOBs information from the bootloader HOB space to the > UEFI payload HOB space. Parse them in misc function, so it won't fail > if there would be no HOBs. >=20 > This patch was tested on Slim Bootloader with latest UEFI payload, and > it worked as expected. >=20 > Signed-off-by: Alexander Goncharov > --- > .../Library/SblParseLib/SblParseLib.c | 109 > ++++++++++++++++-- .../Library/SblParseLib/SblParseLib.inf | > 5 + 2 files changed, 107 insertions(+), 7 deletions(-) >=20 > diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c > b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c index > d88238bfdc..a4cf90618b 100644 --- > a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c +++ > b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c @@ -16,6 +16,11 @@ > #include > #include > #include > +#include > +#include > +#include > +#include > +#include > =20 > /** > This function retrieves the parameter base address from boot > loader. @@ -264,6 +269,17 @@ ParseMiscInfo ( > RETURN_STATUS Status; > UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *BlRootBridgesHob; > UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PldRootBridgesHob; > + PLD_SMM_REGISTERS *BlSmmRegisterHob; > + PLD_SMM_REGISTERS *PldSmmRegisterHob; > + EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *BlSmmMemoryHob; > + EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *PldSmmMemoryHob; > + SPI_FLASH_INFO *BlSpiFlashInfoHob; > + SPI_FLASH_INFO *PldSpiFlashInfoHob; > + NV_VARIABLE_INFO *BlNvVariableHob; > + NV_VARIABLE_INFO *PldNvVariableHob; > + PLD_S3_COMMUNICATION *BlS3CommunicationHob; > + PLD_S3_COMMUNICATION *PldS3CommunicationHob; > + UINT32 Length; > =20 > Status =3D RETURN_NOT_FOUND; > BlRootBridgesHob =3D (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES > *)GetGuidHobDataFromSbl ( @@ -278,13 +294,92 @@ ParseMiscInfo ( > BlRootBridgesHob->Header.Length > ); > ASSERT (PldRootBridgesHob !=3D NULL); > - if (PldRootBridgesHob !=3D NULL) { > - CopyMem (PldRootBridgesHob, BlRootBridgesHob, > BlRootBridgesHob->Header.Length); > - DEBUG ((DEBUG_INFO, "Create PCI root bridge info guid hob\n")); > - Status =3D RETURN_SUCCESS; > - } else { > - Status =3D RETURN_OUT_OF_RESOURCES; > - } > + if (PldRootBridgesHob =3D=3D NULL) > + return RETURN_OUT_OF_RESOURCES; > + > + CopyMem (PldRootBridgesHob, BlRootBridgesHob, > BlRootBridgesHob->Header.Length); > + DEBUG ((DEBUG_INFO, "Create PCI root bridge info guid hob\n")); > + Status =3D RETURN_SUCCESS; > + } > + > + // > + // Create SMM info hob. > + // > + BlSmmRegisterHob =3D (PLD_SMM_REGISTERS *)GetGuidHobDataFromSbl > (&gSmmRegisterInfoGuid); > + if (BlSmmRegisterHob !=3D NULL) { > + Length =3D sizeof (PLD_SMM_REGISTERS) + 5 * sizeof > (PLD_GENERIC_REGISTER); > + PldSmmRegisterHob =3D BuildGuidHob (&gSmmRegisterInfoGuid, Length); > + ASSERT (PldSmmRegisterHob !=3D NULL); > + if (PldSmmRegisterHob =3D=3D NULL) > + return RETURN_OUT_OF_RESOURCES; > + > + CopyMem (PldSmmRegisterHob, BlSmmRegisterHob, Length); > + DEBUG ((DEBUG_INFO, "Created SMM info hob\n")); > + Status =3D RETURN_SUCCESS; > + } > + > + // > + // Create SMM memory hob. > + // > + BlSmmMemoryHob =3D (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK > *)GetGuidHobDataFromSbl (&gEfiSmmSmramMemoryGuid); > + if (BlSmmMemoryHob !=3D NULL) { > + Length =3D sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK) + sizeof > (EFI_SMRAM_DESCRIPTOR); > + PldSmmMemoryHob =3D BuildGuidHob (&gEfiSmmSmramMemoryGuid, Length); > + ASSERT (PldSmmMemoryHob !=3D NULL); > + if (PldSmmMemoryHob =3D=3D NULL) > + return RETURN_OUT_OF_RESOURCES; > + > + CopyMem (PldSmmMemoryHob, BlSmmMemoryHob, Length); > + DEBUG ((DEBUG_INFO, "Created SMM memory hob\n")); > + Status =3D RETURN_SUCCESS; > + } > + > + // > + // Create SPI flash info hob. > + // > + BlSpiFlashInfoHob =3D (SPI_FLASH_INFO *)GetGuidHobDataFromSbl > (&gSpiFlashInfoGuid); > + if (BlSpiFlashInfoHob !=3D NULL) { > + Length =3D sizeof (SPI_FLASH_INFO); > + PldSpiFlashInfoHob =3D BuildGuidHob (&gSpiFlashInfoGuid, Length); > + ASSERT (PldSpiFlashInfoHob !=3D NULL); > + if (PldSpiFlashInfoHob =3D=3D NULL) > + return RETURN_OUT_OF_RESOURCES; > + > + CopyMem (PldSpiFlashInfoHob, BlSpiFlashInfoHob, Length); > + DEBUG ((DEBUG_INFO, "Created SPI flash info hob\n")); > + Status =3D RETURN_SUCCESS; > + } > + > + // > + // Create SPI flash variable info hob. > + // > + BlNvVariableHob =3D (NV_VARIABLE_INFO *)GetGuidHobDataFromSbl > (&gNvVariableInfoGuid); > + if (BlNvVariableHob !=3D NULL) { > + Length =3D sizeof (NV_VARIABLE_INFO); > + PldNvVariableHob =3D BuildGuidHob (&gNvVariableInfoGuid, Length); > + ASSERT (PldNvVariableHob !=3D NULL); > + if (PldNvVariableHob =3D=3D NULL) > + return RETURN_OUT_OF_RESOURCES; > + > + CopyMem (PldNvVariableHob, BlNvVariableHob, Length); > + DEBUG ((DEBUG_INFO, "Created SPI flash variable info hob\n")); > + Status =3D RETURN_SUCCESS; > + } > + > + // > + // Create SMM S3 communication hob. > + // > + BlS3CommunicationHob =3D (PLD_S3_COMMUNICATION > *)GetGuidHobDataFromSbl (&gS3CommunicationGuid); > + if (BlS3CommunicationHob !=3D NULL) { > + Length =3D sizeof (PLD_S3_COMMUNICATION); > + PldS3CommunicationHob =3D BuildGuidHob (&gS3CommunicationGuid, > Length); > + ASSERT (PldS3CommunicationHob !=3D NULL); > + if (PldS3CommunicationHob =3D=3D NULL) > + return RETURN_OUT_OF_RESOURCES; > + > + CopyMem (PldS3CommunicationHob, BlS3CommunicationHob, Length); > + DEBUG ((DEBUG_INFO, "Created SMM S3 communication hob\n")); > + Status =3D RETURN_SUCCESS; > } > =20 > return Status; > diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf > b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf index > f83a10ccd8..1c77d86a86 100644 --- > a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf +++ > b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf @@ -41,6 +41,11 > @@ gEfiGraphicsInfoHobGuid > gEfiGraphicsDeviceInfoHobGuid > gUniversalPayloadPciRootBridgeInfoGuid > + gSmmRegisterInfoGuid > + gEfiSmmSmramMemoryGuid > + gSpiFlashInfoGuid > + gNvVariableInfoGuid > + gS3CommunicationGuid > =20 > [Pcd] > gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter --=20 Joursoir -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112543): https://edk2.groups.io/g/devel/message/112543 Mute This Topic: https://groups.io/mt/103172106/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-