From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.2135.1670595337058582299 for ; Fri, 09 Dec 2022 06:15:37 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=gmYFKDT2; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: jiewen.yao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670595337; x=1702131337; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Uu046nqoTqvOMWngPYu+d6jUylWfj30OcLfJTJw3Ci8=; b=gmYFKDT2ODweSnD7cOR85kp3+BMoKVKalW5OP+FwmsjEzoWkBie83WPk 96FYWg/mwLDCd4kWj2SH/0pcvupnUUTB6W6khH4N1uJrjMKg4F6lr/vmp JkDr/Saf3hdTFgnYkG7nyrs+M8HiCeXzm9jkMk29f8mHzfejYldmYs5BU LVvwqgZvn/p98uDC+5s82po8QtaLli36iyZ729CHeUNH9gtEantffPwGb gaxd1oOeYlw5pgUr8iZWusXzYv+/8XJpCQh2vuAxQOhQfzBvPa77Y71ZZ NQSElWwDvP06DqR+4ZkAok0kxpHb0p7b9FL9Bpi1L4PswObhV7L6U69pM A==; X-IronPort-AV: E=McAfee;i="6500,9779,10556"; a="316171768" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="316171768" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 06:15:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10556"; a="736223212" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="736223212" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by FMSMGA003.fm.intel.com with ESMTP; 09 Dec 2022 06:15:35 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 9 Dec 2022 06:15:35 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.2507.16 via Frontend Transport; Fri, 9 Dec 2022 06:15:35 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Fri, 9 Dec 2022 06:15:34 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HO2KJl4zmQoJILwlnVQYmolRizmkoP8j0KLuouUgMRI1W2aNJ0FzWbu8yUfYkVp2Sy2vt9AV6YvPOsrmXVUXrVmuVgwcKgZfFWfAu2cawdgu5IrsZDw2inHV1l3PY9huX64iQSDYADv6dsh/OInGZxRmiQ88dksLFm61PKvLxTwa2Gfbd2BPZpSiqffAPu4mYCog3UAU6ijif06v92JwOU4T+0W3gZVfuFbQp3OcmlK4W7mi3mAWoUxGvcWMlT5m70mxFpajPQAwBXDCGoOOzS2hH2gLOxY5zI/t0ZnGL8V+Fw8fRRrYlA1epEehA5aX8AxKB60KpHCdvaXOQ5XAMw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2WjV+dNsFKeLTfKKhrTwoqBmOpSerkZNB95sjL1R4eU=; b=LWNVbzU2nxXkWikD2xttiRkU8M5QlDIDJzFY/cMhRBJ6RBVKVP0/O4A4j4mTIiTQQusx3p8PpsbTmG45uF0/6Lbd8ibdJ3q17A3v1MviQ4T847hODf0kCPJRiy3vVFg/oFERQyAJ9uJIpV4eNzDLbKz9vsh82m9YpptR+NMl3Z1JTjTK14+tUJWzIHqtOl5jCa6tZzcorXnsKSZlsixYgDMpFzqi4AI+sWpRXIZ8RC1prk68UdV/7fp4KqgPAvK011X7jENhbY3lh7wZJCyuJGWBxPQGwn+DeuC8wPbCNiwd4x7lXMgyJ0gizs7wWFAXm9IW/ieaMkZbBrx8DoQF4A== 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 Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by CY8PR11MB6939.namprd11.prod.outlook.com (2603:10b6:930:59::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.18; Fri, 9 Dec 2022 14:15:32 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::5f56:1bdc:2eae:c041]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::5f56:1bdc:2eae:c041%9]) with mapi id 15.20.5880.018; Fri, 9 Dec 2022 14:15:32 +0000 From: "Yao, Jiewen" To: Gerd Hoffmann , "devel@edk2.groups.io" CC: Pawel Polawski , Anthony Perard , "Justen, Jordan L" , "Gao, Liming" , Julien Grall , Oliver Steffen , "Wang, Jian J" , Ard Biesheuvel Subject: Re: [PATCH v3 1/1] OvmfPkg/SmbiosPlatformDxe: use PcdFirmware* Thread-Topic: [PATCH v3 1/1] OvmfPkg/SmbiosPlatformDxe: use PcdFirmware* Thread-Index: AQHZAuv0wv6evKM370e0Ph40JyY1X65lqz2w Date: Fri, 9 Dec 2022 14:15:32 +0000 Message-ID: References: <20221128054020.25531-1-kraxel@redhat.com> In-Reply-To: <20221128054020.25531-1-kraxel@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5872:EE_|CY8PR11MB6939:EE_ x-ms-office365-filtering-correlation-id: 9520f598-743a-4f13-dce9-08dad9efd50d x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GC9LFmY0xT2CzhxFmJYpIioMhY7iiXBO2x9YYLiP86PG8FzW0afESuJA253P9Ph03H9JKxdBZp4N8m62sCJIfJADGsbBHDd968KOIC2eye4lBAorov+4KtsK2fR0Y1lqRNUJMSsYbaM3kwHFELEiBS2Ay8Fzh0PhGtMeyZwq9LZh1OG449liLr6fGqMrP+29mTTWCwYhIyCkvfh7ix0en3b3sUQ2KKAIPM0ztzdfZ4/M2Mxm7UW1YUVQiicKsxZIXfNxqFaprJKEIETAZLk+4ZwmCHFQyiUEJN+YeePZeTWA0aIwViiivR1cE+kzNBPv9g5Mxtuv8B7AXLgVIxsJCnOnR/EtSYEBMW/+4rJHGhFuWgRuaz0jh6CiBYJHGXDrVjnFAhQ9AOaqwWiLU3c2dBjQ9COd9w2IlLhtnUp95zcl9XKYsL/dwNLXh2th/zI3NAcX1JYBXO5Y0xHwftpoMVoJqi0dr8b5LWGRRIb3JS2XCl4J0iV6WLHRIlcpkgRzfRx5on1JWbvXZ8BA/311rCD22gRTpiKwflYAGqucELo44+18qfJWyp3iP0TIp9y3Tc5jsyOyzoUO1jQjI815V8Uv9mx2gDbgrmW9R4QTTa3Geem0Nw522OTN/kGFXil6zL2tzj48mJr7nTeOhO4yGWeWRmyzssPdYY4CjucCFGHs3IPJ+19BaR5eS2yJ08dNVg31oF4V3UeOXGUegO/iMg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(39860400002)(346002)(396003)(451199015)(54906003)(71200400001)(316002)(110136005)(38100700002)(478600001)(186003)(26005)(83380400001)(41300700001)(82960400001)(9686003)(2906002)(64756008)(66476007)(4326008)(33656002)(66446008)(8676002)(66556008)(66946007)(76116006)(38070700005)(53546011)(5660300002)(7696005)(52536014)(55016003)(6506007)(8936002)(122000001)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ePazO568f/YL/T9H02MwKn3NJfXb3/IGFcsiWacEnTWJi209XhDA6CE9p90m?= =?us-ascii?Q?mqcSm8TovT1czpycIl2cbUD9NLIcuzx+XO9/cjcxhqrPFotn0eGS5syqNrdB?= =?us-ascii?Q?Azaw3nn17raX2ljxTQRAPcwESEeFMr6OBZYfpVjHOEUG67u+4daNstKVPr2U?= =?us-ascii?Q?caj9KI5vfAMmuqlzvSzEhUY/oKJxNcEVrHTSNCB/R0ONDYErzKEqrhHzUAIb?= =?us-ascii?Q?Kvaw2bWm5QGKhdRMUUjNNJ+c69EaCH/QjXrLMTxDN71cnqtA38qRo9i1dnxu?= =?us-ascii?Q?zNV9lJKD2j0sb500qRQFzd4hWwmminFGEfzDgiYnxhXBXz25xH8Ddu9qyKw4?= =?us-ascii?Q?prpHniWokEubAtX6sg7rUsNL90IILJSd4uzTVttFniCPVCoI2/ms//8lPG9m?= =?us-ascii?Q?2mS1AX7i/PCaLanHgeCf+YqqrZMgm45JhwvEE1pyuSG/13bOwI9XrCW1aZfL?= =?us-ascii?Q?TQj4I7Md6DNXo0E/3PXck5O03dCmCefHRfP5q21A29yV2SOx4VUktpNGWstG?= =?us-ascii?Q?mrFxMkL1YC7ErPHnEBOB1wDd0CSGH+d07o/eFIDIDryghcckuUbC68NRs+tt?= =?us-ascii?Q?k4QU6va+FiTgQaFpCeGf+8rPvHKILeFBpj2rSYlAthwpFQTQZ7bDPpCdsCdr?= =?us-ascii?Q?HnZVd7VovXmVeWJiTjqcI9o8qQsXEoChmV25e0z+9nERjmV3lG46Qu//9Xdh?= =?us-ascii?Q?+PJwi6N/3jrKh4ehGeABOBNFz+rM2qvVs8eF/NIKlHZqW6kMbnW3lZ8MF9nh?= =?us-ascii?Q?qbrRToMmmNriqUbgqfTYoLRr2bZ8ecnfjCwnptocnqkwfs43y8DB6ThVwb1Z?= =?us-ascii?Q?0eKAypleIhOoIGAabUU48ygzV9M+0ZhFeAxocTaYjWzccKPtm+cGZZrNQWxR?= =?us-ascii?Q?3/0jPpmc4nQKIUtKkziF6EZlFIhHhuBUHHOO2cogqKWK0Bc00SBgk8Gfu2qF?= =?us-ascii?Q?Cf/A1kU2yldvgqgD9Q+Hs0JgXAHITyiUANk9vXzMF86L5jBBPj62MkhYwb5f?= =?us-ascii?Q?htyiDyQ+eaY4uoURtfs41JJ/M5L4b+8EAZOUBILNp6ChKvBTedlwSa+kLhOZ?= =?us-ascii?Q?vjOZBdfI/7mzciLkVNreK2pwBosCinysA3ycjerm54cp8pIKtaFSvPaxHPf2?= =?us-ascii?Q?zGZoDvY49OznE2L4w3oghHdTmai/EQ18kk0Lg6YpWCBo683kqKMPkvp5ne8M?= =?us-ascii?Q?FgzYwuq8G3JBkFozOD/TrMmZ9i+yNpvf7W2ibdKkg7frplFBE2tyYDfahUBv?= =?us-ascii?Q?7uZIcK7C9+4U6m1hrGQC5N/i4hFlq0rJsyIlit6Dunu6kh4N6A/B6+8A97wS?= =?us-ascii?Q?0g7J5cy/lb9xZMCSUBA2+nbunSyvhaeDbRy6zBVbgGoMyEZExjI0+pRNzJKa?= =?us-ascii?Q?b3B3rnlgXybb03MEHR0i9JXm92wV+8Gv4QT0bKm9B2GAotO3k21SruHIZ1s9?= =?us-ascii?Q?WMllhJUehJg3PcKUwxBbnmfonsVvohFm1YjP3p7hHlqbd22mRdQQTk4kY5cw?= =?us-ascii?Q?ALMpb1yPlJVykF3F7WPoyigBLgWW9oJgrk3yIjs3H6W01Yz3uQMDWgxk7Sjt?= =?us-ascii?Q?lf98LqwVYzZxpw8BDGUeWUkDSaGk0mGXs6uLCpCY?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9520f598-743a-4f13-dce9-08dad9efd50d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2022 14:15:32.1057 (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: NZHrsD9J97rkrdm/msHji2PCzcohLsl3U6S79cutQsIKr4V8FhV2LFVCsiv8/mbdSF1eDUDh/bFgWQQiZT4frA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB6939 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me. Reviewed-by: Jiewen Yao Any further discussion? > -----Original Message----- > From: Gerd Hoffmann > Sent: Monday, November 28, 2022 1:40 PM > To: devel@edk2.groups.io > Cc: Pawel Polawski ; Anthony Perard > ; Justen, Jordan L = ; > Yao, Jiewen ; Gao, Liming > ; Julien Grall ; Oliver Steffen > ; Wang, Jian J ; Ard > Biesheuvel ; Gerd Hoffmann > > Subject: [PATCH v3 1/1] OvmfPkg/SmbiosPlatformDxe: use PcdFirmware* >=20 > Instead of using hard-coded strings ("0.0.0" for BiosVersion etc) > which is mostly useless read the PCDs (PcdFirmwareVendor, > PcdFirmwareVersionString and PcdFirmwareReleaseDateString) and > build the string table dynamuically at runtime. >=20 > Signed-off-by: Gerd Hoffmann > --- > .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 6 + > .../XenSmbiosPlatformDxe.inf | 9 +- > OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 115 +++++++++++--- > ---- > 3 files changed, 85 insertions(+), 45 deletions(-) >=20 > diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf > b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf > index 0066bbc9229c..52689c96e5af 100644 > --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf > +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf > @@ -32,9 +32,12 @@ [Sources] >=20 > [Packages] > MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > OvmfPkg/OvmfPkg.dec >=20 > [LibraryClasses] > + BaseLib > + BaseMemoryLib > DebugLib > MemoryAllocationLib > PcdLib > @@ -45,6 +48,9 @@ [LibraryClasses] > [Pcd] > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId > gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString >=20 > [Protocols] > gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED > diff --git a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf > b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf > index 7f4588e33d1e..e646c88741b6 100644 > --- a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf > +++ b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf > @@ -38,19 +38,26 @@ [Sources.ARM, Sources.AARCH64] >=20 > [Packages] > MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec >=20 > [Packages.IA32, Packages.X64] > OvmfPkg/OvmfPkg.dec >=20 > [LibraryClasses] > + BaseLib > + BaseMemoryLib > DebugLib > UefiBootServicesTableLib > UefiDriverEntryPoint >=20 > [LibraryClasses.IA32, LibraryClasses.X64] > - BaseLib > HobLib >=20 > +[Pcd] > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString > + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString > + > [Protocols] > gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED >=20 > diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c > b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c > index 94249d3ff1b0..dc1e6aed634f 100644 > --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c > +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c > @@ -9,57 +9,43 @@ > **/ >=20 > #include // SMBIOS_TABLE_TYPE0 > +#include > +#include > #include // ASSERT_EFI_ERROR() > +#include > +#include > #include // gBS > #include // EFI_SMBIOS_PROTOCOL >=20 > #include "SmbiosPlatformDxe.h" >=20 > -#define TYPE0_STRINGS \ > - "EFI Development Kit II / OVMF\0" /* Vendor */ \ > - "0.0.0\0" /* BiosVersion */ \ > - "02/06/2015\0" /* BiosReleaseDate */ > -// > -// Type definition and contents of the default Type 0 SMBIOS table. > -// > -#pragma pack(1) > -typedef struct { > - SMBIOS_TABLE_TYPE0 Base; > - UINT8 Strings[sizeof (TYPE0_STRINGS)]; > -} OVMF_TYPE0; > -#pragma pack() > - > -STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 =3D { > +STATIC CONST SMBIOS_TABLE_TYPE0 mOvmfDefaultType0 =3D { > + // SMBIOS_STRUCTURE Hdr > { > - // SMBIOS_STRUCTURE Hdr > - { > - EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type > - sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length > - }, > - 1, // SMBIOS_TABLE_STRING Vendor > - 2, // SMBIOS_TABLE_STRING BiosVersion > - 0xE800, // UINT16 BiosSegment > - 3, // SMBIOS_TABLE_STRING BiosReleaseDate > - 0, // UINT8 BiosSize > - { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics > - 0, // Reserved :2 > - 0, // Unknown :1 > - 1, // BiosCharacteristicsNotSupported :1 > - // Remaining BiosCharacteristics bits left unset :60 > - }, > - { // BIOSCharacteristicsExtensionBytes[2] > - 0, // BiosReserved > - 0x1C // SystemReserved =3D VirtualMachineSupported | > - // UefiSpecificationSupported | > - // TargetContentDistributionEnabled > - }, > - 0, // UINT8 SystemBiosMajorRelease > - 0, // UINT8 SystemBiosMinorRelease > - 0xFF, // UINT8 EmbeddedControllerFirmwareMajorR= elease > - 0xFF // UINT8 EmbeddedControllerFirmwareMinorR= elease > + EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type > + sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length > }, > - // Text strings (unformatted area) > - TYPE0_STRINGS > + 1, // SMBIOS_TABLE_STRING Vendor > + 2, // SMBIOS_TABLE_STRING BiosVersion > + 0xE800, // UINT16 BiosSegment > + 3, // SMBIOS_TABLE_STRING BiosReleaseDate > + 0, // UINT8 BiosSize > + { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics > + 0, // Reserved :2 > + 0, // Unknown :1 > + 1, // BiosCharacteristicsNotSupported :1 > + // Remaining BiosCharacteristics bits left unset :60 > + }, > + { // BIOSCharacteristicsExtensionBytes[2] > + 0, // BiosReserved > + 0x1C // SystemReserved =3D VirtualMachineSupported | > + // UefiSpecificationSupported | > + // TargetContentDistributionEnabled > + }, > + 0, // UINT8 SystemBiosMajorRelease > + 0, // UINT8 SystemBiosMinorRelease > + 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRel= ease > + 0xFF // UINT8 EmbeddedControllerFirmwareMinorRel= ease > }; >=20 > /** > @@ -153,14 +139,55 @@ InstallAllStructures ( > // > // Add OVMF default Type 0 (BIOS Information) table > // > + CHAR16 *VendStr, *VersStr, *DateStr; > + UINTN VendLen, VersLen, DateLen; > + CHAR8 *Type0; > + > + VendStr =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVendor); > + VendLen =3D StrLen (VendStr); > + if (VendLen < 3) { > + VendStr =3D L"unknown"; > + VendLen =3D StrLen (VendStr); > + } > + > + VersStr =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString); > + VersLen =3D StrLen (VersStr); > + if (VersLen < 3) { > + VersStr =3D L"unknown"; > + VersLen =3D StrLen (VersStr); > + } > + > + DateStr =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareReleaseDateString); > + DateLen =3D StrLen (DateStr); > + if (DateLen < 3) { > + DateStr =3D L"unknown"; > + DateLen =3D StrLen (DateStr); > + } > + > + DEBUG ((DEBUG_INFO, "FirmwareVendor: \"%s\" (%d chars)\n"= , > VendStr, VendLen)); > + DEBUG ((DEBUG_INFO, "FirmwareVersionString: \"%s\" (%d chars)\n"= , > VersStr, VersLen)); > + DEBUG ((DEBUG_INFO, "FirmwareReleaseDateString: \"%s\" (%d > chars)\n", DateStr, DateLen)); > + > + Type0 =3D AllocateZeroPool (sizeof (mOvmfDefaultType0) + VendLen + > VersLen + DateLen + 4); > + if (Type0 =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + CopyMem (Type0, &mOvmfDefaultType0, sizeof (mOvmfDefaultType0)); > + UnicodeStrToAsciiStrS (VendStr, Type0 + sizeof (mOvmfDefaultType0), > VendLen + 1); > + UnicodeStrToAsciiStrS (VersStr, Type0 + sizeof (mOvmfDefaultType0) + > VendLen + 1, VersLen + 1); > + UnicodeStrToAsciiStrS (DateStr, Type0 + sizeof (mOvmfDefaultType0) + > VendLen + VersLen + 2, DateLen + 1); > + > SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; > Status =3D Smbios->Add ( > Smbios, > NULL, > &SmbiosHandle, > - (EFI_SMBIOS_TABLE_HEADER *)&mOvmfDefaultTyp= e0 > + (EFI_SMBIOS_TABLE_HEADER *)Type0 > ); > ASSERT_EFI_ERROR (Status); > + > + FreePool (Type0); > } >=20 > return EFI_SUCCESS; > -- > 2.38.1