From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.131]) by mx.groups.io with SMTP id smtpd.web10.2506.1627673645897496916 for ; Fri, 30 Jul 2021 12:34:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=emremIbc; spf=pass (domain: microsoft.com, ip: 40.107.102.131, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nyS4EV01tO9VHJEy1pYsRlW2FTcNi6cM0LBpYNugZA79HPLJW2nYa6ZVeCwaBG+7mQimQgu86Jc6tgNzQsPuyPvmSgvKPt3ioBGXDaW+mRZQ+j/iEA/r+MjkicjdXNmshgKe+s288iJVlyxbY5V2ljNvQSHGaHabZq9xpLDDZ2OCx4mQ06KSCw8xJjnWIa8XuZuistHuKui3zzk+7hfP3t/n9CUF2tTOXYy+O6A2/Twlw2msFpunvGszQ7SCDdiF0w1XM+J8pBQoOMxu3TXJGEx8ePaK07Q8Mu2VfjcqPQ5CM31YdAuHN0nyajsRkctpfNex51BCRygp3DTsNmnMtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DywWOroUtPsEz5Gh2w1fG2/3q9q4898afUSVJmO9dPo=; b=N1kB3bu+xwsIC+2U5YWnMLVtJL/ay87GOkrhHqjUsqic2Zmzor9Dz94hNtgZciR1N/ah5o6Iv/VnmL3PuiN0auio93ttbFc1T767vLKAb/t6aIgLtlUd/iKjh5LtPay76/UDSeYEIPHfMJj31aCrq4aCmLT70eEO7KRcTfOuxIhc4bM7Fh9BDQhkrSQ8TBH6cXuewX7uTu3Xnh1cnBVieDtD9XkdMt1rBbzsTfHF9qibkRi0BvSgyk3FIfZkcZLXAGO5mdZF3gOtd/o1fmv5YaG8f2nIv6DQMmdgyxQFPMz3agN4/NtwxnJruYSQAAT/JJh4Sbq9y/vCN//Bjl2PoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DywWOroUtPsEz5Gh2w1fG2/3q9q4898afUSVJmO9dPo=; b=emremIbchUD4WMhlHDAhao0n38mre7+MlsDcTOoEXg+AhelKf4WFagPFn3J2dobBqGq7IotH7wFseoXEbARlbmhyZ4w1h29eHYF/dN+AKGxhd+2ZqcMzaEh4SD+0KAzpuhpZOZDD4wjOG2C0WyVa2Qjl/Jw1lTz5mSQAgHs4jr8= Received: from MW4PR21MB1907.namprd21.prod.outlook.com (2603:10b6:303:71::8) by MW4PR21MB1859.namprd21.prod.outlook.com (2603:10b6:303:7f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.2; Fri, 30 Jul 2021 19:34:03 +0000 Received: from MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::9836:7dc8:5316:f512]) by MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::9836:7dc8:5316:f512%6]) with mapi id 15.20.4394.008; Fri, 30 Jul 2021 19:34:03 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "sayanta.pattanayak@arm.com" CC: Ard Biesheuvel , Sami Mujawar , Achin Gupta Subject: Re: [EXTERNAL] [edk2-devel] [edk2][PATCH v1 1/1] StandaloneMmPkg: add support to populate StMM boot data from device tree Thread-Topic: [EXTERNAL] [edk2-devel] [edk2][PATCH v1 1/1] StandaloneMmPkg: add support to populate StMM boot data from device tree Thread-Index: AQHXhWlnZ2zOoyfwCkO2pIgc6p6H7qtb6E/j Date: Fri, 30 Jul 2021 19:34:02 +0000 Message-ID: References: <20210730173510.24235-1-sayanta.pattanayak@arm.com> In-Reply-To: <20210730173510.24235-1-sayanta.pattanayak@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-07-30T19:31:59.8274478Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 32d59d95-17d4-4fc2-1dff-08d95390fcbe x-ms-traffictypediagnostic: MW4PR21MB1859: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cJYfNvJH1E1ABbRhejdARrjeirbexAFYCHOqbfhmB3JOxLHgDA1nOdot4UnFE4czygCZfF5d0DJ52Z2/bqEC1oICoNfZNaMeaXIK7n2bq0yOcm/bID5Hb46n4NhPiGGx/NYLKjCeU9KsjgGRJW5l9u+TY5Ik75RkFuRKS0by0rs0qX9hMylqm3at08ptLzTcyFgdfa+TNaf31o0Aw+jLm5rfoldYujhoj4P+zADHMp46Z1b7rXzlCPmmvsuA6VrVwFyNLqpcYjSBwCvxMdeYvZE7zWQmrl0ChlP9x+0Ls7zYjb5tk45NI4VdHdMh2vENe5IlNYYP4RrI7A6OQqe39k3pfgKPzR7KIhbGulhkr45QA5ZyrJXe4XnzRvesqCFJmvM9uCT35dZQmNQGvHyUjlnRL8f/FwcO5Z5jpCnL+sJbJ25CKxshO1Fec9vZmLHAkdk9XayQbTFBJ1+NBcX55iQaNLdFxu23KEAYDbxLjTF4HwYfMGqbA1B4HcXlghzix1dzkOUwsD62Bio4et2VSCei1By4O6GsxDQFDSVtBuv2zt4evlax8DPiuX//b+JcwXtfslVI+4F2Th0rDlkxt2Y2O6dIC7ejMfaC5Hz//d5JUqzmTzCsuBzrSsEk4QyRQKR9NFdqeW8oZSED97YyoqGNRfauHpIEbF/muQ3iU3vQIdhliD0Raqq7K311cxxGRhQEnWYrnuYbVVTCW6TVjPrTbmwjFiL8yZbAIsM4ZrADusD7anwMGr+PsiPTuwFLCgm/+QNNDPqvSttvHnKD1n8N9Ua2e15etObBbt37ZiA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR21MB1907.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(366004)(110136005)(33656002)(8990500004)(54906003)(66476007)(966005)(122000001)(8676002)(316002)(6506007)(82950400001)(7696005)(38100700002)(53546011)(26005)(66556008)(55016002)(8936002)(10290500003)(83380400001)(52536014)(186003)(66946007)(30864003)(9686003)(4326008)(5660300002)(66446008)(71200400001)(2906002)(166002)(86362001)(64756008)(76116006)(38070700005)(82960400001)(508600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?j9xaXCltqjxTLYVU/gP1ppTFaQTmEYopXCdtSRuXsmvZV/zLJ+xN3v44?= =?Windows-1252?Q?uJXYbn8IIS3dOmH9PibTsPJvwc30V9Ef1N5QnHDQPJddkbgkufgdwz9Q?= =?Windows-1252?Q?27T/DzfH8g0uB125cP3OcC/710jC4Yi0yue6/muIx9Pnql6jvDcbFM/Q?= =?Windows-1252?Q?8TpxLwsC2re4IOGkDOsjYz1mFuQ3k47/jie4qWnXPIkEp3NhJtM89v2X?= =?Windows-1252?Q?N2nkv6Vxv3Z6LI198e63sH6Puyd3nxQzH4NJ5oDIev+PYYFi7tY91cm+?= =?Windows-1252?Q?Xwli86Xb+emtdnNR1FL4Iy93rp/f+ysXarpzw3uULJGl18bxQKPyI05Z?= =?Windows-1252?Q?nKpPVZvsFjdnkgEZe3jKEOB2jMAUWxDbHvpTQXla6PsXlLCSEqF6HN98?= =?Windows-1252?Q?kTil4eBFk80zdBUklyguLwEDQQipHZNkceS6lDSIBm9c3RLm24iNmSkv?= =?Windows-1252?Q?obYCxn6qaO2WHiNPqjRXYhNiOhmw81l8dSKHf5+pWSBhW5IYERBjqGYU?= =?Windows-1252?Q?BnPmJUZsLDhz/DP6w/5cLJ9K96h3wJhpSofUxEHXLM+qOR2Nx2wpqWj1?= =?Windows-1252?Q?GTEoUNHDhG3wnhoZ4u/uDLDS99pLG4lr4d5RB8cxSuqHteVT2HdnEi23?= =?Windows-1252?Q?gtGETB7YLCDS4aeiJjLIEwxFUeO3amb2/X8Tl0j7pR1qD6uCx/YBqeBJ?= =?Windows-1252?Q?AhDGtoiTtyHGr12vRQHxKsl//z6ELWVqHaebCBa9qE7+Zi8UIbqMBHKm?= =?Windows-1252?Q?ANKKnTp5A8PrdeP57LNyvYsRp4iqxFEao/xdabIk2k5SHRaC/AlNHZSU?= =?Windows-1252?Q?DtK/z9chpYT1AGRVTqPlAxs+GsqVHsl6Gwdaab5c4PMuZyUH0qS1Kunj?= =?Windows-1252?Q?wMRrLTEua/1W3F5Ye36USWtImvv2HkNilDgME8fOjIQ7vdbpXC67qnN6?= =?Windows-1252?Q?GaIeGRJJdU+6yMakzG7OFa8hfGb0whoqEMO6U0aOKlgaJCcat4g4AdBg?= =?Windows-1252?Q?2kZN03Tqltq8x/drI6aBpuIxHVblHnCmL3yNLTJWhhmnOqVZxrWhxeTh?= =?Windows-1252?Q?RpoW5eN94YcpI5rrJP5yiZKigz0Afd3F9oR3KacuGDLuz2hzhBLXcQlJ?= =?Windows-1252?Q?0O6xbLr23nZ/96i5184yuPDzPXaLf5qOh5iMTbmP4XMz7BFrmAaE+yCA?= =?Windows-1252?Q?9F9PLyRglwuEiNZklQiFhDAFHUP/XY1wHWPp6wnT5ZDVwvxhazRK6bfB?= =?Windows-1252?Q?MyVulPlWOqqihfrPJ1SCJyLiK4szkDHyyDw01xlGGnsos64hLcXTBTLd?= =?Windows-1252?Q?NT+Xyfb5tiDrYKwHsC40RCvu01DYXAtf2qS+HQbc9LrBGK/2Abj2QZgl?= =?Windows-1252?Q?wddXTj1VPr0k62a/dMJMCulJZHl54WTWFWCNaRD01FzmZSEOgTsTBgpV?= =?Windows-1252?Q?tPShAj88P70n8YIWG4JMzw=3D=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR21MB1907.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32d59d95-17d4-4fc2-1dff-08d95390fcbe X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2021 19:34:02.9374 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +VyViGlizUTTpok39uKn1NfulO+hn4KVnRiDSLvfpOWOFHHDhOquJsjmN3kCYtR1n0lQL0GtvduuG+DtZ3boCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1859 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MW4PR21MB1907911E6BE695A67080A624EFEC9MW4PR21MB1907namp_" --_000_MW4PR21MB1907911E6BE695A67080A624EFEC9MW4PR21MB1907namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I don=92t think this is a good dependency. StandaloneMmCore shouldn=92t req= uire anything from EmbeddedPkg, and if it does there=92s probably some more= generalization necessary. Further, we can=92t require the MmCore (which should be considered generic = at the level of PEI Core or DXE Core) include some external library like Li= bfdt without significant justification. - Bret From: Sayanta Pattanayak via groups.io Sent: Friday, July 30, 2021 10:36 AM To: devel@edk2.groups.io Cc: Ard Biesheuvel; Sami Mujawar; Achin Gupta Subject: [EXTERNAL] [edk2-devel] [edk2][PATCH v1 1/1] StandaloneMmPkg: add = support to populate StMM boot data from device tree Introduce support to populate StMM boot data via DTS parsing. The DTB is passed as a boot argument by a binary of higer exception level. Previously it was achieved by placing the boot data structure in a shared buffer and the address of this shared buffer was passed by the binary of higher exception level. Now either of the option can be used for populating StMM boot info. StMM boot information structure binding in device tree can be of following prototype. Property values are not mentioned here. bootarg { compatible =3D "bootargs"; h_type =3D <..>; h_version =3D <..>; h_size =3D <..>; h_attr =3D <..>; sp_mem_base =3D <..>; sp_mem_limit =3D <..>; sp_image_base =3D <..>; sp_stack_base =3D <..>; sp_heap_base =3D <..>; sp_ns_comm_buf_base =3D <..>;fc sp_shared_buf_base =3D <..>; sp_image_size =3D <..>; sp_pcpu_stack_size =3D <..>; sp_heap_size =3D <..>; sp_ns_comm_buf_size =3D <..>; sp_shared_buf_size =3D <..>; num_sp_mem_regions =3D <..>; num_cpus =3D <..>; }; Addition of DTS supoort involves a dependency on FdtLib from EmbeddedPkg. Signed-off-by: Sayanta Pattanayak --- Link to github branch with this patch - https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub= .com%2FSayantaP-arm%2Fedk2%2Ftree%2Fstmm-dts&data=3D04%7C01%7Cbret.bark= elew%40microsoft.com%7Cb365266c83cb433d1e0108d953806c83%7C72f988bf86f141af9= 1ab2d7cd011db47%7C1%7C0%7C637632633786132182%7CUnknown%7CTWFpbGZsb3d8eyJWIj= oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sda= ta=3DgJw%2BH8Dj9lih1DNrIzbNPToJn9nH%2BHqpvpSr2JJrS4I%3D&reserved=3D0 StandaloneMmPkg/StandaloneMmPkg.dsc = | 1 + StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPo= int.inf | 3 + StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCor= eEntryPoint.c | 153 ++++++++++++++++++-- 3 files changed, 143 insertions(+), 14 deletions(-) diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/Standalo= neMmPkg.dsc index 0c45df95e2dd..e3a3a6ee3ba1 100644 --- a/StandaloneMmPkg/StandaloneMmPkg.dsc +++ b/StandaloneMmPkg/StandaloneMmPkg.dsc @@ -49,6 +49,7 @@ HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMemoryAlloca= tionLib/StandaloneMmCoreMemoryAllocationLib.inf MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Standalon= eMmServicesTableLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf index 4fa426f58ef4..0a2e519dd664 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf @@ -30,6 +30,7 @@ X64/StandaloneMmCoreEntryPoint.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec StandaloneMmPkg/StandaloneMmPkg.dec @@ -40,10 +41,12 @@ [LibraryClasses] BaseLib DebugLib + FdtLib [LibraryClasses.AARCH64] StandaloneMmMmuLib ArmSvcLib + FdtLib [Guids] gMpInformationHobGuid diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c index 6c50f470aa35..cc09d75dac36 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c @@ -16,6 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include +#include #include #include #include @@ -45,33 +46,31 @@ STATIC CONST UINT32 mSpmMinorVerFfa =3D SPM_MINOR_VERSI= ON_FFA; PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT CpuDriverEntryPoint =3D NULL; /** - Retrieve a pointer to and print the boot information passed by privilege= d - secure firmware. + Prints boot information. - @param [in] SharedBufAddress The pointer memory shared with privilege= d - firmware. + This function prints the boot information, which is passed by privileged + secure firmware through shared buffer or other mechanism. + @param [in] PayloadBootInfo Pointer to StandaloneMM Boot Info structu= re. **/ -EFI_SECURE_PARTITION_BOOT_INFO * -GetAndPrintBootinformation ( - IN VOID *SharedBufAddress +VOID +PrintBootinformation ( + IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo ) { - EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo; EFI_SECURE_PARTITION_CPU_INFO *PayloadCpuInfo; UINTN Index; - PayloadBootInfo =3D (EFI_SECURE_PARTITION_BOOT_INFO *) SharedBufAddress; if (PayloadBootInfo =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "PayloadBootInfo NULL\n")); - return NULL; + return; } if (PayloadBootInfo->Header.Version !=3D BOOT_PAYLOAD_VERSION) { DEBUG ((DEBUG_ERROR, "Boot Information Version Mismatch. Current=3D0x%= x, Expected=3D0x%x.\n", PayloadBootInfo->Header.Version, BOOT_PAYLOAD_VERSION)); - return NULL; + return; } DEBUG ((DEBUG_INFO, "NumSpMemRegions - 0x%x\n", PayloadBootInfo->NumSpMe= mRegions)); @@ -96,7 +95,7 @@ GetAndPrintBootinformation ( if (PayloadCpuInfo =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "PayloadCpuInfo NULL\n")); - return NULL; + return; } for (Index =3D 0; Index < PayloadBootInfo->NumCpus; Index++) { @@ -105,7 +104,7 @@ GetAndPrintBootinformation ( DEBUG ((DEBUG_INFO, "Flags - 0x%x\n", PayloadCpuInfo[Index].= Flags)); } - return PayloadBootInfo; + return; } /** @@ -194,6 +193,119 @@ DelegatedEventLoop ( } } +/** + Populates StandAloneMM boot information structure. + + This function receives dtb Address, where StMM Boot information specific + properties will be looked out to form the booting structure of type + EFI_SECURE_PARTITION_BOOT_INFO. At first, the properties for StandAloneM= M + ConfigSize and Memory limit will be checked out. Boot information will + be stored at address (Memory Limit - ConfigSize). Thereafter all boot + information specific properties will be parsed and corresponding values + will be obtained. + + @param [out] BootInfo Pointer, where Boot Info structure will be popu= lated. + @param [in] DtbAddress Address of the Device tree from where Boot + information will be fetched. +**/ +VOID +PopulateBootinformation ( + OUT EFI_SECURE_PARTITION_BOOT_INFO **BootInfo, + IN VOID *DtbAddress +) +{ + INT32 Offset; + CONST UINT32 *Property; + CONST UINT64 *Property64; + UINT32 ConfigSize; + UINT64 SpMemLimit; + EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo; + + Offset =3D fdt_node_offset_by_compatible (DtbAddress, -1, "config-size")= ; + if (Offset < 0) { + DEBUG ((DEBUG_WARN, "Total Config Size is not defined\n")); + } else { + Property =3D fdt_getprop (DtbAddress, Offset, "size", NULL); + if (Property) { + ConfigSize =3D fdt32_to_cpu (*Property); + DEBUG ((DEBUG_INFO, "stmm dtb config-size =3D 0x%x \n", ConfigSize)= ); + } + } + + Offset =3D fdt_node_offset_by_compatible (DtbAddress, -1, "bootargs"); + if (Offset >=3D 0) { + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_mem_limit", NULL)= ; + SpMemLimit =3D fdt64_to_cpu (*Property64); + } + + if (SpMemLimit && ConfigSize) + PayloadBootInfo =3D + (EFI_SECURE_PARTITION_BOOT_INFO *)(SpMemLimit - ConfigSize); + + if (PayloadBootInfo) { + PayloadBootInfo->SpMemLimit =3D SpMemLimit; + + Property =3D fdt_getprop (DtbAddress, Offset, "h_type", NULL); + PayloadBootInfo->Header.Type =3D (UINT8) fdt32_to_cpu(*Property); + + Property =3D fdt_getprop (DtbAddress, Offset, "h_version", NULL); + PayloadBootInfo->Header.Version =3D (UINT8) fdt32_to_cpu(*Property); + + Property =3D fdt_getprop (DtbAddress, Offset, "h_size", NULL); + PayloadBootInfo->Header.Size =3D (UINT8) fdt32_to_cpu(*Property); + + Property =3D fdt_getprop (DtbAddress, Offset, "h_attr", NULL); + PayloadBootInfo->Header.Attr =3D fdt32_to_cpu(*Property); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_mem_base", NULL); + PayloadBootInfo->SpMemBase =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_image_base", NULL= ); + PayloadBootInfo->SpImageBase =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_stack_base", NULL= ); + PayloadBootInfo->SpStackBase =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_heap_base", NULL)= ; + PayloadBootInfo->SpHeapBase =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_ns_comm_buf_base"= , NULL); + PayloadBootInfo->SpNsCommBufBase =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_shared_buf_base",= NULL); + PayloadBootInfo->SpSharedBufBase =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_image_size", NULL= ); + PayloadBootInfo->SpImageSize =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_pcpu_stack_size",= NULL); + PayloadBootInfo->SpPcpuStackSize =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_heap_size", NULL)= ; + PayloadBootInfo->SpHeapSize =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_ns_comm_buf_size"= , NULL); + PayloadBootInfo->SpNsCommBufSize =3D fdt64_to_cpu(*Property64); + + Property64 =3D fdt_getprop (DtbAddress, Offset, "sp_shared_buf_size",= NULL); + PayloadBootInfo->SpPcpuSharedBufSize =3D fdt64_to_cpu(*Property64); + + Property =3D fdt_getprop (DtbAddress, Offset, "num_sp_mem_regions", N= ULL); + PayloadBootInfo->NumSpMemRegions =3D fdt32_to_cpu(*Property); + + Property =3D fdt_getprop (DtbAddress, Offset, "num_cpus", NULL); + PayloadBootInfo->NumCpus =3D fdt32_to_cpu(*Property); + + PayloadBootInfo->CpuInfo =3D + (EFI_SECURE_PARTITION_CPU_INFO *)((UINT64)PayloadBootInfo + + sizeof(EFI_SECURE_PARTITION_BOOT_I= NFO)); + } + + *BootInfo =3D PayloadBootInfo; + + return; +} + /** Query the SPM version, check compatibility and return success if compati= ble. @@ -313,6 +425,7 @@ _ModuleEntryPoint ( VOID *TeData; UINTN TeDataSize; EFI_PHYSICAL_ADDRESS ImageBase; + VOID *DtbAddress; // Get Secure Partition Manager Version Information Status =3D GetSpmVersion (); @@ -320,12 +433,24 @@ _ModuleEntryPoint ( goto finish; } - PayloadBootInfo =3D GetAndPrintBootinformation (SharedBufAddress); + // In cookie1 the DTB address is passed. With reference to DTB, Boot + // info structure can be populated. + // If cookie1 doesn't have any value, then Boot info is copied from + // Sharedbuffer. + if (cookie1) { + DtbAddress =3D (void *)cookie1; + PopulateBootinformation (&PayloadBootInfo, DtbAddress); + } else { + PayloadBootInfo =3D (EFI_SECURE_PARTITION_BOOT_INFO *)SharedBufAddress= ; + } + if (PayloadBootInfo =3D=3D NULL) { Status =3D EFI_UNSUPPORTED; goto finish; } + PrintBootinformation (PayloadBootInfo); + // Locate PE/COFF File information for the Standalone MM core module Status =3D LocateStandaloneMmCorePeCoffData ( (EFI_FIRMWARE_VOLUME_HEADER *) PayloadBootInfo->SpImageBase, -- 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#78449): https://nam06.safelinks.protection.outlook.com/= ?url=3Dhttps%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F78449&data= =3D04%7C01%7Cbret.barkelew%40microsoft.com%7Cb365266c83cb433d1e0108d953806c= 83%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637632633786132182%7CUnknow= n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI= 6Mn0%3D%7C3000&sdata=3D0DbkyBJe0prgx2vSCVVsrI0GoVbCipcfmbZp83LREjo%3D&a= mp;reserved=3D0 Mute This Topic: https://nam06.safelinks.protection.outlook.com/?url=3Dhttp= s%3A%2F%2Fgroups.io%2Fmt%2F84555304%2F1852292&data=3D04%7C01%7Cbret.bar= kelew%40microsoft.com%7Cb365266c83cb433d1e0108d953806c83%7C72f988bf86f141af= 91ab2d7cd011db47%7C1%7C0%7C637632633786132182%7CUnknown%7CTWFpbGZsb3d8eyJWI= joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sd= ata=3D1u3cr0MmJmjrkxtGgfOe1mb8%2F7vUXaoyUr5%2FmC1Uq%2F8%3D&reserved=3D0 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A= %2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=3D04%7C01%7Cbret.barkelew= %40microsoft.com%7Cb365266c83cb433d1e0108d953806c83%7C72f988bf86f141af91ab2= d7cd011db47%7C1%7C0%7C637632633786142135%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC= 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata= =3DYr%2BSNqWHllfxHkFqBhCyP2TE4IGRLFLm%2FCCWexjB0AM%3D&reserved=3D0 [bre= t.barkelew@microsoft.com] -=3D-=3D-=3D-=3D-=3D-=3D --_000_MW4PR21MB1907911E6BE695A67080A624EFEC9MW4PR21MB1907namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

I don=92t think this is a good dependency. Standalon= eMmCore shouldn=92t require anything from EmbeddedPkg, and if it does there= =92s probably some more generalization necessary.

 

Further, we can=92t require the MmCore (which should= be considered generic at the level of PEI Core or DXE Core) include some e= xternal library like Libfdt without significant justification.

 

- Bret

 

From: Sayanta Pattanayak via= groups.io
Sent: Friday, July 30, 2021 10:36 AM
To: devel@edk2.groups.io=
Cc: Ard Biesheuvel;= Sami Mujawar; Achin Gupta Subject: [EXTERNAL] [edk2-devel] [edk2][PATCH v1 1/1] StandaloneMmPk= g: add support to populate StMM boot data from device tree

 

Introduce support to = populate StMM boot data via DTS parsing. The DTB is
passed as a boot argument by a binary of higer exception level.
Previously it was achieved by placing the boot data structure in a
shared buffer and the address of this shared buffer was passed by the
binary of higher exception level. Now either of the option can be used
for populating StMM boot info.

StMM boot information structure binding in device tree can be of following<= br> prototype. Property values are not mentioned here.

bootarg {
  compatible =3D "bootargs";
  h_type  =3D <..>;
  h_version =3D <..>;
  h_size    =3D <..>;
  h_attr    =3D <..>;
  sp_mem_base         =3D <= ..>;
  sp_mem_limit        =3D <..>= ;;
  sp_image_base       =3D <..>;   sp_stack_base       =3D <..>;   sp_heap_base        =3D <..>= ;;
  sp_ns_comm_buf_base =3D <..>;fc
  sp_shared_buf_base  =3D <..>;
  sp_image_size       =3D <..>;   sp_pcpu_stack_size  =3D <..>;
  sp_heap_size        =3D <..>= ;;
  sp_ns_comm_buf_size =3D <..>;
  sp_shared_buf_size  =3D <..>;
  num_sp_mem_regions  =3D <..>;
  num_cpus          =   =3D <..>;
};

Addition of DTS supoort involves a dependency on FdtLib from EmbeddedPkg.
Signed-off-by: Sayanta Pattanayak <sayanta.pattanayak@arm.com>
---
 Link to github branch with this patch -
 https://nam06.safelinks.protection.outlook.com= /?url=3Dhttps%3A%2F%2Fgithub.com%2FSayantaP-arm%2Fedk2%2Ftree%2Fstmm-dts&am= p;amp;data=3D04%7C01%7Cbret.barkelew%40microsoft.com%7Cb365266c83cb433d1e01= 08d953806c83%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63763263378613218= 2%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha= WwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=3DgJw%2BH8Dj9lih1DNrIzbNPToJn9nH%2BH= qpvpSr2JJrS4I%3D&amp;reserved=3D0

 StandaloneMmPkg/StandaloneMmPkg.dsc     &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;         |   1 +
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf       |   3 +
 StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c | 153 ++++++++++++++++++--
 3 files changed, 143 insertions(+), 14 deletions(-)

diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/Standalo= neMmPkg.dsc
index 0c45df95e2dd..e3a3a6ee3ba1 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -49,6 +49,7 @@
   HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMm= HobLib.inf
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf=
   MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMm= MemLib.inf
+  FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
   MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmCoreMe= moryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
   MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib= /StandaloneMmServicesTableLib.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneM= mCoreEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/St= andaloneMmCoreEntryPoint.inf
index 4fa426f58ef4..0a2e519dd664 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEn= tryPoint.inf
@@ -30,6 +30,7 @@
   X64/StandaloneMmCoreEntryPoint.c
 
 [Packages]
+  EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   StandaloneMmPkg/StandaloneMmPkg.dec
@@ -40,10 +41,12 @@
 [LibraryClasses]
   BaseLib
   DebugLib
+  FdtLib
 
 [LibraryClasses.AARCH64]
   StandaloneMmMmuLib
   ArmSvcLib
+  FdtLib
 
 [Guids]
   gMpInformationHobGuid
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Sta= ndaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPo= int/AArch64/StandaloneMmCoreEntryPoint.c
index 6c50f470aa35..cc09d75dac36 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone= MmCoreEntryPoint.c
@@ -16,6 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Guid/MmramMemoryReserve.h>
 #include <Guid/MpInformation.h>
 
+#include <libfdt.h>
 #include <Library/ArmMmuLib.h>
 #include <Library/ArmSvcLib.h>
 #include <Library/DebugLib.h>
@@ -45,33 +46,31 @@ STATIC CONST UINT32 mSpmMinorVerFfa =3D SPM_MINOR_VERSI= ON_FFA;
 PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT      CpuD= riverEntryPoint =3D NULL;
 
 /**
-  Retrieve a pointer to and print the boot information passed by priv= ileged
-  secure firmware.
+  Prints boot information.
 
-  @param  [in] SharedBufAddress   The pointer memory s= hared with privileged
-            &n= bsp;            = ;         firmware.
+  This function prints the boot information, which is passed by privi= leged
+  secure firmware through shared buffer or other mechanism.
 
+  @param  [in] PayloadBootInfo   Pointer to Standalone= MM Boot Info structure.
 **/
-EFI_SECURE_PARTITION_BOOT_INFO *
-GetAndPrintBootinformation (
-  IN VOID          =             *SharedB= ufAddress
+VOID
+PrintBootinformation (
+  IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo
 )
 {
-  EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo;
   EFI_SECURE_PARTITION_CPU_INFO  *PayloadCpuInfo;
   UINTN         &nb= sp;            =     Index;
 
-  PayloadBootInfo =3D (EFI_SECURE_PARTITION_BOOT_INFO *) SharedBufAdd= ress;
 
   if (PayloadBootInfo =3D=3D NULL) {
     DEBUG ((DEBUG_ERROR, "PayloadBootInfo NULL\n&= quot;));
-    return NULL;
+    return;
   }
 
   if (PayloadBootInfo->Header.Version !=3D BOOT_PAYLOAD_VERSI= ON) {
     DEBUG ((DEBUG_ERROR, "Boot Information Versio= n Mismatch. Current=3D0x%x, Expected=3D0x%x.\n",
             Pa= yloadBootInfo->Header.Version, BOOT_PAYLOAD_VERSION));
-    return NULL;
+    return;
   }
 
   DEBUG ((DEBUG_INFO, "NumSpMemRegions - 0x%x\n", Payl= oadBootInfo->NumSpMemRegions));
@@ -96,7 +95,7 @@ GetAndPrintBootinformation (
 
   if (PayloadCpuInfo =3D=3D NULL) {
     DEBUG ((DEBUG_ERROR, "PayloadCpuInfo NULL\n&q= uot;));
-    return NULL;
+    return;
   }
 
   for (Index =3D 0; Index < PayloadBootInfo->NumCpus; Inde= x++) {
@@ -105,7 +104,7 @@ GetAndPrintBootinformation (
     DEBUG ((DEBUG_INFO, "Flags   &= nbsp;       - 0x%x\n", PayloadCpuInfo[In= dex].Flags));
   }
 
-  return PayloadBootInfo;
+  return;
 }
 
 /**
@@ -194,6 +193,119 @@ DelegatedEventLoop (
   }
 }
 
+/**
+  Populates StandAloneMM boot information structure.
+
+  This function receives dtb Address, where StMM Boot information spe= cific
+  properties will be looked out to form the booting structure of type=
+  EFI_SECURE_PARTITION_BOOT_INFO. At first, the properties for StandA= loneMM
+  ConfigSize and  Memory limit will be checked out. Boot informa= tion will
+  be stored at address (Memory Limit - ConfigSize). Thereafter all bo= ot
+  information specific properties will be parsed and corresponding va= lues
+  will be obtained.
+
+  @param  [out] BootInfo   Pointer, where Boot Info st= ructure will be populated.
+  @param  [in] DtbAddress  Address of the Device tree from = where Boot
+            &n= bsp;            = ;  information will be fetched.
+**/
+VOID
+PopulateBootinformation (
+  OUT EFI_SECURE_PARTITION_BOOT_INFO **BootInfo,
+  IN VOID   *DtbAddress
+)
+{
+  INT32           O= ffset;
+  CONST UINT32    *Property;
+  CONST UINT64    *Property64;
+  UINT32          Config= Size;
+  UINT64          SpMemL= imit;
+  EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo;
+
+  Offset =3D fdt_node_offset_by_compatible (DtbAddress, -1, "con= fig-size");
+  if (Offset < 0) {
+    DEBUG ((DEBUG_WARN, "Total Config Size is not = ; defined\n"));
+  } else {
+    Property =3D fdt_getprop (DtbAddress, Offset, "siz= e", NULL);
+    if (Property) {
+      ConfigSize =3D fdt32_to_cpu (*Property); +      DEBUG ((DEBUG_INFO, "stmm dtb config-s= ize  =3D 0x%x \n", ConfigSize));
+    }
+  }
+
+  Offset =3D fdt_node_offset_by_compatible (DtbAddress, -1, "boo= targs");
+  if (Offset >=3D 0) {
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_mem_limit", NULL);
+    SpMemLimit =3D fdt64_to_cpu (*Property64);
+  }
+
+  if (SpMemLimit && ConfigSize)
+    PayloadBootInfo =3D
+      (EFI_SECURE_PARTITION_BOOT_INFO *)(SpMemLim= it - ConfigSize);
+
+  if (PayloadBootInfo) {
+    PayloadBootInfo->SpMemLimit =3D SpMemLimit;
+
+    Property =3D  fdt_getprop (DtbAddress, Offset, &qu= ot;h_type", NULL);
+    PayloadBootInfo->Header.Type =3D (UINT8) fdt32_to_cp= u(*Property);
+
+    Property =3D  fdt_getprop (DtbAddress, Offset, &qu= ot;h_version", NULL);
+    PayloadBootInfo->Header.Version =3D (UINT8) fdt32_to= _cpu(*Property);
+
+    Property =3D  fdt_getprop (DtbAddress, Offset, &qu= ot;h_size", NULL);
+    PayloadBootInfo->Header.Size =3D (UINT8) fdt32_to_cp= u(*Property);
+
+    Property =3D  fdt_getprop (DtbAddress, Offset, &qu= ot;h_attr", NULL);
+    PayloadBootInfo->Header.Attr =3D fdt32_to_cpu(*Prope= rty);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_mem_base", NULL);
+    PayloadBootInfo->SpMemBase =3D fdt64_to_cpu(*Propert= y64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_image_base", NULL);
+    PayloadBootInfo->SpImageBase =3D fdt64_to_cpu(*Prope= rty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_stack_base", NULL);
+    PayloadBootInfo->SpStackBase =3D fdt64_to_cpu(*Prope= rty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_heap_base", NULL);
+    PayloadBootInfo->SpHeapBase =3D fdt64_to_cpu(*Proper= ty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_ns_comm_buf_base", NULL);
+    PayloadBootInfo->SpNsCommBufBase =3D fdt64_to_cpu(*P= roperty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_shared_buf_base", NULL);
+    PayloadBootInfo->SpSharedBufBase =3D fdt64_to_cpu(*P= roperty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_image_size", NULL);
+    PayloadBootInfo->SpImageSize =3D fdt64_to_cpu(*Prope= rty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_pcpu_stack_size", NULL);
+    PayloadBootInfo->SpPcpuStackSize =3D fdt64_to_cpu(*P= roperty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_heap_size", NULL);
+    PayloadBootInfo->SpHeapSize =3D fdt64_to_cpu(*Proper= ty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_ns_comm_buf_size", NULL);
+    PayloadBootInfo->SpNsCommBufSize =3D fdt64_to_cpu(*P= roperty64);
+
+    Property64 =3D  fdt_getprop (DtbAddress, Offset, &= quot;sp_shared_buf_size", NULL);
+    PayloadBootInfo->SpPcpuSharedBufSize =3D fdt64_to_cp= u(*Property64);
+
+    Property =3D  fdt_getprop (DtbAddress, Offset, &qu= ot;num_sp_mem_regions", NULL);
+    PayloadBootInfo->NumSpMemRegions =3D fdt32_to_cpu(*P= roperty);
+
+    Property =3D  fdt_getprop (DtbAddress, Offset, &qu= ot;num_cpus", NULL);
+    PayloadBootInfo->NumCpus =3D fdt32_to_cpu(*Property)= ;
+
+    PayloadBootInfo->CpuInfo =3D
+      (EFI_SECURE_PARTITION_CPU_INFO *)((UINT64)P= ayloadBootInfo +
+            &n= bsp;            = ;            &n= bsp;  sizeof(EFI_SECURE_PARTITION_BOOT_INFO));
+  }
+
+  *BootInfo =3D PayloadBootInfo;
+
+  return;
+}
+
 /**
   Query the SPM version, check compatibility and return success = if compatible.
 
@@ -313,6 +425,7 @@ _ModuleEntryPoint (
   VOID         &nbs= p;            &= nbsp;           &nbs= p; *TeData;
   UINTN         &nb= sp;            =              Te= DataSize;
   EFI_PHYSICAL_ADDRESS       =              Im= ageBase;
+  VOID          &nb= sp;            =              *D= tbAddress;
 
   // Get Secure Partition Manager Version Information
   Status =3D GetSpmVersion ();
@@ -320,12 +433,24 @@ _ModuleEntryPoint (
     goto finish;
   }
 
-  PayloadBootInfo =3D GetAndPrintBootinformation (SharedBufAddress);<= br> +  // In cookie1 the DTB address is passed. With reference to DTB, Boo= t
+  // info structure can be populated.
+  // If cookie1 doesn't have any value, then Boot info is copied from=
+  // Sharedbuffer.
+  if (cookie1) {
+    DtbAddress =3D (void *)cookie1;
+    PopulateBootinformation (&PayloadBootInfo, DtbAddre= ss);
+  } else {
+    PayloadBootInfo =3D (EFI_SECURE_PARTITION_BOOT_INFO *)S= haredBufAddress;
+  }
+
   if (PayloadBootInfo =3D=3D NULL) {
     Status =3D EFI_UNSUPPORTED;
     goto finish;
   }
 
+  PrintBootinformation (PayloadBootInfo);
+
   // Locate PE/COFF File information for the Standalone MM core = module
   Status =3D LocateStandaloneMmCorePeCoffData (
            &nb= sp; (EFI_FIRMWARE_VOLUME_HEADER *) PayloadBootInfo->SpImageBase,
--
2.17.1



-=3D-=3D-=3D-=3D-=3D-=3D
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78449): https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2.gr= oups.io%2Fg%2Fdevel%2Fmessage%2F78449&amp;data=3D04%7C01%7Cbret.barkele= w%40microsoft.com%7Cb365266c83cb433d1e0108d953806c83%7C72f988bf86f141af91ab= 2d7cd011db47%7C1%7C0%7C637632633786132182%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM= C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sd= ata=3D0DbkyBJe0prgx2vSCVVsrI0GoVbCipcfmbZp83LREjo%3D&amp;reserved=3D0
Mute This Topic:
https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgroups.= io%2Fmt%2F84555304%2F1852292&amp;data=3D04%7C01%7Cbret.barkelew%40micro= soft.com%7Cb365266c83cb433d1e0108d953806c83%7C72f988bf86f141af91ab2d7cd011d= b47%7C1%7C0%7C637632633786132182%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD= AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=3D1u3= cr0MmJmjrkxtGgfOe1mb8%2F7vUXaoyUr5%2FmC1Uq%2F8%3D&amp;reserved=3D0<= br> Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2.gr= oups.io%2Fg%2Fdevel%2Funsub&amp;data=3D04%7C01%7Cbret.barkelew%40micros= oft.com%7Cb365266c83cb433d1e0108d953806c83%7C72f988bf86f141af91ab2d7cd011db= 47%7C1%7C0%7C637632633786142135%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDA= iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=3DYr%2= BSNqWHllfxHkFqBhCyP2TE4IGRLFLm%2FCCWexjB0AM%3D&amp;reserved=3D0 [bret.barkelew@microsoft.com]
-=3D-=3D-=3D-=3D-=3D-=3D

 

--_000_MW4PR21MB1907911E6BE695A67080A624EFEC9MW4PR21MB1907namp_--