From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.682.1611191662185565436 for ; Wed, 20 Jan 2021 17:14:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=lbVKMp/w; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: maurice.ma@intel.com) IronPort-SDR: TwB1IEkn3XwE/5MWm04xNb/fxv330l3diyb6qlzZbFwNB06iL3n3ZzzD54Ze8KmAc0Ck2LSbnI S2vP8iuO60uQ== X-IronPort-AV: E=McAfee;i="6000,8403,9870"; a="197934647" X-IronPort-AV: E=Sophos;i="5.79,362,1602572400"; d="scan'208";a="197934647" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2021 17:14:19 -0800 IronPort-SDR: TJAgqR6igb1w/Ikfz8+IqikWsXALY/aVAVkuZ40WXuxgndztKb96pOt0+lxKjkRKUCJzpSi9yB 1Ji84kxnPx5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,362,1602572400"; d="scan'208";a="347747857" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga007.fm.intel.com with ESMTP; 20 Jan 2021 17:14:19 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 20 Jan 2021 17:14:19 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 20 Jan 2021 17:14:18 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 20 Jan 2021 17:14:18 -0800 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.58) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 20 Jan 2021 17:14:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l2KGmSAZugrqp/wOp8hTFqKXbX4Szg3Q2xTO6DXypklJ6oQc3vZjqm5gDOmV96P8ojD0kxvwI07/BXyicV8X/5zRFLI6SNNoQPUQtCEAxdQoEU1dpxcLpCtDBJHV7ItG4hwTxmGWRDrcdrxH2+JbQ1nCh4PCJEsn1NRGVxfq6pz+qRI7KMXyw2mh7ukx6Q5YumwVQ6rSoOlCV2OwE4DPpbgppXJ+bc//9aeuHq4tVPNqJklHwIXdMhXuWIYCU12v5cchg+JmkzAZAcAz7Q4DQBKdESQ2CgMELKKDo1+W4gwxWMN7WZQ73WbDqICxG5W5c1WSHeHfLwxXQxeZ9Fc5Tw== 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=6vV801IA6E5oAbcqGD0qqlmduN9KDzAysqPfAgH0ywQ=; b=moct3jdPKVqvmbKduXQhLHmsWmoSyTNZw9Aw8xc2dLWg+bDZQw2NZpeQ3HpXzA6C0PNWhEaN2eLvq5lhMX1cP06sMlJ74FzTG44giNcmpDUC9Ce6wqFw5noSqYCAJo6OhiHdEuUqIFt/CCAhv96M+Mj714vWoo3GMSCGTH8RmJ45yc/3X++Mc7+LU9TTP37ImhOZaRK7U1ujpjtrvhFauC36J+FeNlRI/YADq1lzhqo0+bsCB5l3fyAUnOUA6E1PbDRLhsZzKxHGZUwhk5kw/dHP95WjV+fSNv1ki9tIRBcnCek53MOpXJJx9t1FbW/T0tsTaa0O6iJkiK8wl9+kqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6vV801IA6E5oAbcqGD0qqlmduN9KDzAysqPfAgH0ywQ=; b=lbVKMp/wBq04rENlNAFJ7q4VwN3plWjuAXcMJ9TNXLyu+y6SgvnIVsiNseks/zh419hbxAsRUnn5PfJTZiybr08RE/vezLwVdkpL+fBCKqaB8jdrjm69ViA7YQGcarFTD2O41icdCt/hXkWusviOWBAwrKTRktGeACqk6aFYwGA= Received: from DM6PR11MB2793.namprd11.prod.outlook.com (2603:10b6:5:c0::29) by DM6PR11MB4689.namprd11.prod.outlook.com (2603:10b6:5:2a0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Thu, 21 Jan 2021 01:14:12 +0000 Received: from DM6PR11MB2793.namprd11.prod.outlook.com ([fe80::19ca:d5c5:d1d4:a22f]) by DM6PR11MB2793.namprd11.prod.outlook.com ([fe80::19ca:d5c5:d1d4:a22f%6]) with mapi id 15.20.3763.014; Thu, 21 Jan 2021 01:14:12 +0000 From: "Ma, Maurice" To: Patrick Rudolph , "devel@edk2.groups.io" CC: "Dong, Guo" , "You, Benjamin" Subject: Re: [PATCH] UefiPayloadPkg/BlSupportDxe: Use EfiSmbiosProtocol to install tables Thread-Topic: [PATCH] UefiPayloadPkg/BlSupportDxe: Use EfiSmbiosProtocol to install tables Thread-Index: AQHW70WiLur1MrywAUW4rsf7F9hjHqoxPzug Date: Thu, 21 Jan 2021 01:14:12 +0000 Message-ID: References: <20210120160157.3343911-1-patrick.rudolph@9elements.com> In-Reply-To: <20210120160157.3343911-1-patrick.rudolph@9elements.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.5.1.3 dlp-reaction: no-action authentication-results: 9elements.com; dkim=none (message not signed) header.d=none;9elements.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [104.153.200.60] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b49bd437-5e51-4ac0-e5b0-08d8bda9dcd8 x-ms-traffictypediagnostic: DM6PR11MB4689: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kmVI/cW9O/a1MuHJ8eiXeRuZ++yry/3QZVsEkMw5zvIgfxy3tNBadvvpToMuGFOiFAoIYBZegD1maQKpRq9A1jmQv6yuUlXiv7PCnw07wS6aeZp3yX7k+CJLfIdze8LMZzPKaIyLuBjsZBGTVMPEv2aTYXE1x1hbdzI/xCVvZuKIkhXb00OBkyxix237yAI96PuHcVovBFrOcmRQP1y6cisUnLEyeg//eiPtrYXH2UheQtpD6ukIBGr55112RD7R5AzM15Z0rp2H2uKVYQrpbL4vq7Jm2ZGdJZu/mgcMUBFOQAgiPfeWO0H+n+GBhhqLZjqv/aD7srQI4uxTXQEopdupZ0iQ9dANwkkXvwa6DtX39hyM5wJUPrR5zrOAmrqpyQ3VhCO2671TxrVn1bUwXRabJf4WLEl67KGLrRGzaAlrMjgzMKGsNXNaiKeBZx8b0wkGv/KGlUrs95WQXDewcQp9n2gYGd1fz0AmvZLOa3DcGT0h17imQWh7ywbENAMGDQrt5r7SpF9htQvT6+zDCQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB2793.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(346002)(396003)(366004)(376002)(136003)(39860400002)(6506007)(71200400001)(5660300002)(9686003)(8936002)(186003)(478600001)(316002)(66476007)(66946007)(33656002)(55016002)(76116006)(54906003)(83380400001)(66556008)(52536014)(107886003)(53546011)(8676002)(26005)(64756008)(66446008)(110136005)(4326008)(86362001)(7696005)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?J0znMlcFdG9s5Xmtxapt5R5WRXC4m3wIBg15GrepxZR7hXn1BUBnDOWC2EBN?= =?us-ascii?Q?msD1hfFpaLbxY0CprMtXlaze4XfA+Cu4QHGV5FK7u/5SnFgIIib5Z9M24BZi?= =?us-ascii?Q?A8QmWyK9pFdkoKpN7AvPCGZahjVFT2IYIiURy6Hx8737/gfWfWHVwud3T15h?= =?us-ascii?Q?gg/cPk7MPFBXQmmk4frZzlCBIAXyHwb5OvqHxWvgVYhiUuH0NDq65lJdSSj7?= =?us-ascii?Q?hHp2p37TQ4HoOudrzOZYalOV4ri89wiHUNYtu/nfx/Ov6j7z5+5B2gdM+X3S?= =?us-ascii?Q?nVmChS/cy6v4Imw0AWVJFmkx1LGkYg6++d4Kuapjdai6QiKTkBbe74/Rev0H?= =?us-ascii?Q?Mo94/tVnxCBF+FLhAW1QwGa3eoru50SvR449PFyGV13J58yH6AVR59lV6aON?= =?us-ascii?Q?BeWUEd1v+ROdrNLApI+5t7Fe13SpyJLQr1kx/t9Qwakp2FC4YPooiqB6DhOc?= =?us-ascii?Q?2ls6KuDvv6I9zaA7tKAg2xMTAx1Ak1CCMZoIeV8LnVz1wQXzb8Y+yCiPUo9a?= =?us-ascii?Q?rExow84goZmmH2Eemx9GRcnMS6hBuHK3RzyRmMJ1F8y7iL4oLkdtxtiGfxH2?= =?us-ascii?Q?O7wZjeXQmvex/QEUfNL5lR06IXD1o2slIko1HTZvvh6Hkfw0QawG+XorFqCi?= =?us-ascii?Q?YCKX53UfkPSAI+8gxJDS3Bt0Z47KnEUYkmVg88uQ5qIlNxNPbfvcFjjoYGLS?= =?us-ascii?Q?kTC3dMBIV55YQcpGShxm2GFIsG1x44v0prA2HCWSEC1bgAyQjnWZKG7ZTb7p?= =?us-ascii?Q?q47SQ/Tx97x7DrOfzcf+OkRu9tWDfiGWUh0Q3jefRY6zHg/5HBG9F4VnDzLa?= =?us-ascii?Q?lp1l0MOKaMT5mVT1MqCO4DQLx8CWp01o6qt9e0Vo+7Zx3WKOTawvrmO+6Omi?= =?us-ascii?Q?0L/2HTCGkbx+ItuAhQLYRdxX4pmQJyqZEwsbpbB4t3uLzLI9DxrPr5A0OSaY?= =?us-ascii?Q?AyXZXt5Ca+EoUY4Xsx24QYwCjcwcLmzYVnE84H6boE4=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB2793.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b49bd437-5e51-4ac0-e5b0-08d8bda9dcd8 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2021 01:14:12.4320 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eklzvBG3wM/SlJmUg3LrYaAqk0lVGdH4clh0PPMR/XEYcjT6Rd42WBwruGT9X9fkCJVivbPX5SUe/KYXvGCJCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4689 Return-Path: maurice.ma@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Patrick In this patch I noticed that we changed the BlSupportDxe dependency from Tr= ue to gEfiSmbiosProtocolGuid. Since BlSupportDxe is considered as critical for UEFI payload, and on the = other side SMBIOS driver could be optional in some case, do you think it i= s better to handle it through RegisterProtocolNotify() ? In this way, if= gEfiSmbiosProtocolGuid is not installed for any reason, BlSupportDxe can = still be dispatched and the boot flow can continue. Some other comments: - Please add function and parameter description for BlDxeInstallSMBIOStabl= es(). - To follow the naming convention in EDK2, maybe use BlDxeInstallSmbios= Tables instead of BlDxeInstallSMBIOStables(). Thanks Maurice > -----Original Message----- > From: Patrick Rudolph > Sent: Wednesday, January 20, 2021 8:02 > To: devel@edk2.groups.io > Cc: Ma, Maurice ; Dong, Guo ; > You, Benjamin > Subject: [PATCH] UefiPayloadPkg/BlSupportDxe: Use EfiSmbiosProtocol to > install tables >=20 > The default EfiSmbiosProtocol operates on an empty SMBIOS table. > As the SMBIOS tables are provided by the bootloader, install the SMBIOS t= ables > using the EfiSmbiosProtocol. >=20 > This fixes the settings menu not showing any hardware information, instea= d only > "0 MB RAM" was displayed. >=20 > Tests showed that the OS can still see the SMBIOS tables. >=20 > Signed-off-by: Patrick Rudolph > --- > UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 111 > +++++++++++++++++++- > UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h | 3 + > UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf | 5 +- > 3 files changed, 115 insertions(+), 4 deletions(-) >=20 > diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c > b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c > index a746d0581e..db478c1abc 100644 > --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c > +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c > @@ -79,6 +79,107 @@ ReserveResourceInGcd ( > return Status; } +EFI_STATUS+EFIAPI+BlDxeInstallSMBIOStables(+ IN UIN= T64 > SmbiosTableBase,+ IN UINT32 SmbiosTableSize+)+{+ EFI_STATUS > Status;+ SMBIOS_TABLE_ENTRY_POINT *SmbiosTable;+ > SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios30Table;+ > SMBIOS_STRUCTURE_POINTER Smbios;+ SMBIOS_STRUCTURE_POINTER > SmbiosEnd;+ CHAR8 *String;+ EFI_SMBIOS_HANDLE > SmbiosHandle;+ EFI_SMBIOS_PROTOCOL *SmbiosProto;++ //+ // Lo= cate > Smbios protocol.+ //+ Status =3D gBS->LocateProtocol (&gEfiSmbiosProtoc= olGuid, > NULL, (VOID **)&SmbiosProto);+ if (EFI_ERROR (Status)) {+ DEBUG > ((DEBUG_ERROR, "%a: Failed to locate gEfiSmbiosProtocolGuid\n",+ > __FUNCTION__));+ return Status;+ }++ Smbios30Table =3D > (SMBIOS_TABLE_3_0_ENTRY_POINT *)(UINTN)(SmbiosTableBase);+ > SmbiosTable =3D (SMBIOS_TABLE_ENTRY_POINT *)(UINTN)(SmbiosTableBase);++ > if (CompareMem (Smbios30Table->AnchorString, "_SM3_", 5) =3D=3D 0) {+ > Smbios.Hdr =3D (SMBIOS_STRUCTURE *) (UINTN) Smbios30Table- > >TableAddress;+ SmbiosEnd.Raw =3D (UINT8 *) (UINTN) (Smbios30Table- > >TableAddress + Smbios30Table->TableMaximumSize);+ if (Smbios30Table- > >TableMaximumSize > SmbiosTableSize) {+ DEBUG((DEBUG_INFO, "%a: > SMBIOS table size greater than reported by bootloader\n",+ > __FUNCTION__));+ }+ } else if (CompareMem (SmbiosTable->AnchorString, > "_SM_", 4) =3D=3D 0) {+ Smbios.Hdr =3D (SMBIOS_STRUCTURE *) (UINTN) > SmbiosTable->TableAddress;+ SmbiosEnd.Raw =3D (UINT8 *) ((UINTN) > SmbiosTable->TableAddress + SmbiosTable->TableLength);++ if (SmbiosTab= le- > >TableLength > SmbiosTableSize) {+ DEBUG((DEBUG_INFO, "%a: SMBIOS > table size greater than reported by bootloader\n",+ > __FUNCTION__));+ }+ } else {+ DEBUG ((DEBUG_ERROR, "%a: No valid > SMBIOS table found\n", __FUNCTION__ ));+ return EFI_NOT_FOUND;+ }++ > do {+ // Check for end marker+ if (Smbios.Hdr->Type =3D=3D 127) {+ > break;+ }++ // Install the table+ SmbiosHandle =3D > SMBIOS_HANDLE_PI_RESERVED;+ Status =3D SmbiosProto->Add (+ > SmbiosProto,+ gImageHandle,+ = &SmbiosHandle,+ > Smbios.Hdr+ );+ ASSERT_EFI_ERROR (Status);+ = if (EFI_ERROR > (Status)) {+ return Status;+ }+ //+ // Go to the next SMBIO= S structure. > Each SMBIOS structure may include 2 parts:+ // 1. Formatted section; 2= . > Unformatted string section. So, 2 steps are needed+ // to skip one SMB= IOS > structure.+ //++ //+ // Step 1: Skip over formatted section.+ = //+ String =3D > (CHAR8 *) (Smbios.Raw + Smbios.Hdr->Length);++ //+ // Step 2: Skip = over > unformatted string section.+ //+ do {+ //+ // Each string= is terminated > with a NULL(00h) BYTE and the sets of strings+ // is terminated with= an > additional NULL(00h) BYTE.+ //+ for ( ; *String !=3D 0; String+= +) {+ }++ if > (*(UINT8*)++String =3D=3D 0) {+ //+ // Pointer to the next = SMBIOS > structure.+ //+ Smbios.Raw =3D (UINT8 *)++String;+ b= reak;+ }+ } > while (TRUE);+ } while (Smbios.Raw < SmbiosEnd.Raw);++ return > EFI_SUCCESS;+} /** Main entry for the bootloader support DXE module.@@= - > 133,9 +234,13 @@ BlDxeEntryPoint ( > // Install Smbios Table // if (SystemTableInfo->SmbiosTableBase != =3D 0 && > SystemTableInfo->SmbiosTableSize !=3D 0) {- DEBUG ((DEBUG_ERROR, "Inst= all > Smbios Table at 0x%lx, length 0x%x\n", SystemTableInfo->SmbiosTableBase, > SystemTableInfo->SmbiosTableSize));- Status =3D gBS->InstallConfigurat= ionTable > (&gEfiSmbiosTableGuid, (VOID *)(UINTN)SystemTableInfo->SmbiosTableBase);- > ASSERT_EFI_ERROR (Status);+ DEBUG ((DEBUG_ERROR, "Install Smbios Table > at 0x%lx, length 0x%x\n",+ SystemTableInfo->SmbiosTableBase, > SystemTableInfo->SmbiosTableSize));++ if > (BlDxeInstallSMBIOStables(SystemTableInfo->SmbiosTableBase, > SystemTableInfo->SmbiosTableSize) !=3D EFI_SUCCESS) {+ Status =3D gB= S- > >InstallConfigurationTable (&gEfiSmbiosTableGuid, (VOID > *)(UINTN)SystemTableInfo->SmbiosTableBase);+ ASSERT_EFI_ERROR > (Status);+ } } //diff --git a/UefiPayloadPkg/BlSupportDxe/BlSuppo= rtDxe.h > b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h > index 512105fafd..a5216cd2e9 100644 > --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h > +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h > @@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include +#include + #include > #include > #include @@ -26,5 +28,6 @@ SPDX-License- > Identifier: BSD-2-Clause-Patent #include #incl= ude > +#include #endifdif= f - > -git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf > b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf > index cebc811355..d26a75248b 100644 > --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf > +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf > @@ -56,5 +56,8 @@ > gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress > gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize +[Protocols]+ > gEfiSmbiosProtocolGuid+ [Depex]- TRUE+ gEfiSmbiosProtocolGuid-- > 2.26.2