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 A3B70740032 for ; Mon, 11 Dec 2023 22:39:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=N4uhN2UMQDJ6ZjImTAdJYB4fI32HqflcvFGy+AX/NSM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1702334368; v=1; b=mooqQTYqj1CjBRyIV37SFxhH64wKrRLFdDarrKvZccGYeOdsjgijaIExopQMAw1r7YQNb86C jggGtwynNl1EMnocBjuRTzhiQpjbQUMc8RPzNqCQJpT1Hi2FzIJsZc/fhWls20uRTo0ElAZiUTY e+9GkdZXFsPW/xmjHzQBT0z8= X-Received: by 127.0.0.2 with SMTP id GRMCYY7687511xw2ABGQvTin; Mon, 11 Dec 2023 14:39:28 -0800 X-Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) by mx.groups.io with SMTP id smtpd.web11.5166.1702334367742855090 for ; Mon, 11 Dec 2023 14:39:27 -0800 X-Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6d8029dae41so3809597a34.0 for ; Mon, 11 Dec 2023 14:39:27 -0800 (PST) X-Gm-Message-State: 6yfMSS6A7j6XOPhgBkoutNeOx7686176AA= X-Google-Smtp-Source: AGHT+IH7+soR2+v5HOFQjilVvp33nNIYqMj1lax18HwTFkTWfxRb9IzdlKiVK1f4OFKok4cdx9iZYw== X-Received: by 2002:a9d:75d0:0:b0:6d9:af1c:70f3 with SMTP id c16-20020a9d75d0000000b006d9af1c70f3mr5197965otl.74.1702334366888; Mon, 11 Dec 2023 14:39:26 -0800 (PST) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e9b1:f59a:bf3c:db4:6459:ea26]) by smtp.gmail.com with ESMTPSA id l7-20020a0cc207000000b0067aa8e67fc5sm3619070qvh.84.2023.12.11.14.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 14:39:26 -0800 (PST) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo Subject: [edk2-devel] [PATCH v2 1/4] UefiPayloadPkg/SblParseLib: Build SMM feature GUID HOBs from bootloader Date: Mon, 11 Dec 2023 17:39:09 -0500 Message-ID: <20231211223919.1225565-1-benjamin.doron00@gmail.com> 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,benjamin.doron00@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: 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=mooqQTYq; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Benjamin Doron UefiPayload does not install all SBL HOBs, EDK2-relevant ones must be installed individually. This was omitted from the SMM feature pushes. Cc: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo Signed-off-by: Benjamin Doron --- UefiPayloadPkg/Library/SblParseLib/SblParseLib.c | 77 ++++++++++++++++++= ++ UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf | 5 ++ 2 files changed, 82 insertions(+) diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c b/UefiPayload= Pkg/Library/SblParseLib/SblParseLib.c index d88238bfdccb..9775ad4ac2a6 100644 --- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c +++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.c @@ -15,6 +15,11 @@ #include =0D #include =0D #include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D #include =0D =0D /**=0D @@ -264,6 +269,17 @@ ParseMiscInfo ( RETURN_STATUS Status;=0D UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *BlRootBridgesHob;=0D UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PldRootBridgesHob;=0D + // TODO: Drop half by ignoring return?=0D + PLD_SMM_REGISTERS *BlSmmRegisters;=0D + PLD_SMM_REGISTERS *PldSmmRegisters;=0D + EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *BlSmramHob;=0D + EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *PldSmramHob;=0D + SPI_FLASH_INFO *BlSpiFlashInfo;=0D + SPI_FLASH_INFO *PldSpiFlashInfo;=0D + NV_VARIABLE_INFO *BlNvVariableInfo;=0D + NV_VARIABLE_INFO *PldNvVariableInfo;=0D + PLD_S3_COMMUNICATION *BlS3Communication;=0D + PLD_S3_COMMUNICATION *PldS3Communication;=0D =0D Status =3D RETURN_NOT_FOUND;=0D BlRootBridgesHob =3D (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *)GetGuidHobDat= aFromSbl (=0D @@ -287,5 +303,66 @@ ParseMiscInfo ( }=0D }=0D =0D + // Perhaps payload does not perform SMM, do not override Status=0D + BlSmmRegisters =3D GetGuidHobDataFromSbl (&gSmmRegisterInfoGuid);=0D + if (BlSmmRegisters !=3D NULL) {=0D + PldSmmRegisters =3D BuildGuidDataHob (=0D + &gSmmRegisterInfoGuid,=0D + BlSmmRegisters,=0D + sizeof (PLD_SMM_REGISTERS) + (BlSmmRegisters->Coun= t * sizeof (PLD_GENERIC_REGISTER))=0D + );=0D + if (PldSmmRegisters !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "Create SMM register info guid hob\n"));=0D + }=0D + }=0D +=0D + BlSmramHob =3D GetGuidHobDataFromSbl (&gEfiSmmSmramMemoryGuid);=0D + if (BlSmramHob !=3D NULL) {=0D + PldSmramHob =3D BuildGuidDataHob (=0D + &gEfiSmmSmramMemoryGuid,=0D + BlSmramHob,=0D + sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK) + ((BlSmramHob= ->number_of_smm_regions - 1) * sizeof (EFI_SMRAM_DESCRIPTOR))=0D + );=0D + if (PldSmramHob !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "Create SMM SMRAM memory info guid hob\n"));=0D + }=0D + }=0D +=0D + BlSpiFlashInfo =3D GetGuidHobDataFromSbl (&gSpiFlashInfoGuid);=0D + if (BlSpiFlashInfo !=3D NULL) {=0D + PldSpiFlashInfo =3D BuildGuidDataHob (=0D + &gSpiFlashInfoGuid,=0D + BlSpiFlashInfo,=0D + sizeof (SPI_FLASH_INFO)=0D + );=0D + if (PldSpiFlashInfo !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "Create SPI flash info guid hob\n"));=0D + }=0D + }=0D +=0D + BlNvVariableInfo =3D GetGuidHobDataFromSbl (&gNvVariableInfoGuid);=0D + if (BlNvVariableInfo !=3D NULL) {=0D + PldNvVariableInfo =3D BuildGuidDataHob (=0D + &gNvVariableInfoGuid,=0D + BlNvVariableInfo,=0D + sizeof (NV_VARIABLE_INFO)=0D + );=0D + if (PldNvVariableInfo !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "Create NV variable info guid hob\n"));=0D + }=0D + }=0D +=0D + BlS3Communication =3D GetGuidHobDataFromSbl (&gS3CommunicationGuid);=0D + if (BlS3Communication !=3D NULL) {=0D + PldS3Communication =3D BuildGuidDataHob (=0D + &gS3CommunicationGuid,=0D + BlS3Communication,=0D + sizeof (PLD_S3_COMMUNICATION)=0D + );=0D + if (PldS3Communication !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "Create S3 communication guid hob\n"));=0D + }=0D + }=0D +=0D return Status;=0D }=0D diff --git a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf b/UefiPaylo= adPkg/Library/SblParseLib/SblParseLib.inf index f83a10ccd826..1c77d86a8643 100644 --- a/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf +++ b/UefiPayloadPkg/Library/SblParseLib/SblParseLib.inf @@ -41,6 +41,11 @@ gEfiGraphicsInfoHobGuid=0D gEfiGraphicsDeviceInfoHobGuid=0D gUniversalPayloadPciRootBridgeInfoGuid=0D + gSmmRegisterInfoGuid=0D + gEfiSmmSmramMemoryGuid=0D + gSpiFlashInfoGuid=0D + gNvVariableInfoGuid=0D + gS3CommunicationGuid=0D =0D [Pcd]=0D gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter=0D --=20 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112336): https://edk2.groups.io/g/devel/message/112336 Mute This Topic: https://groups.io/mt/103119569/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-