From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.54]) by mx.groups.io with SMTP id smtpd.web12.42014.1595263675685818113 for ; Mon, 20 Jul 2020 09:47:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=XPKNU8nW; spf=pass (domain: vmware.com, ip: 40.107.94.54, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjTXc3uxH01zjlgXLY1z0vmFS+QEs2L9KB3dIJuK67feloaZFalajP5vltKLaQ410SZUoXZ61mBcwPtd8FPLItwRN+3Mt8q0J+xaqp2YmbgcCsWwtStfNjNWbhQZ6uz/MjLFou9/+zrNazZSvjqf6tBmPTsMqG8tXUN3St9ivoufG0xW6yDbHg77cbVN1/7miDfMnPhDuEr2xlH4KLIMRZe9d5uHw4ai1MOL2TQfiYvtK4fVWeMddKNGk2UNVXXkP4BPVefbWqmBDXKMwdIS+IwiA38SBu++sxz+UwVUzeoS5C6SsW3xalesk22+NPdtIjeexf15UIrAjHs5A7m9bQ== 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=saIEJ/mCTsk6/TcCxN6Ux9Xg0uvWuqXs6hoI+2gRj0A=; b=bwTaexDqw45wYnUbKoMLMYZEuWbZ+p67vNoksyN+3mD4H1DR/fhpwCE0YY+ldi0CZUUtkxq9ENCxrtek2InJAgJD2yxjoUGD6CJpNkY3Mg6iP4mQZDMJLOwSSvFqOocLAS3xztTJqrLCJSpbqYnfR1uyKPn24t0Sg9FE8Z9Lh8tQ0qhJ5KtnFy2Wk0b5a6DBsdEAEbrd6UE9LJrkwR4Z9lTF0o6TsgWUPuIfCp0mV2BgzbBddokCnjzAUsPboaiMdgG/QZQnX5b/KkINIO9a7vI1BY3p7Ve55lRv2FqQfg0HjW9n+TiYrO6Z2Nk5QPxK3vLK9NLlDomvHpKAkzGggw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=saIEJ/mCTsk6/TcCxN6Ux9Xg0uvWuqXs6hoI+2gRj0A=; b=XPKNU8nWDOCCZhNAgMmwGDNzrTeZJXRLxfgzWBmzptp/bNBpraHSMRaQLGX+xoG5cJY/JjAHfy8NbtfPVw0wnG4mPZDFSN568Pka8t0VqDmexDQWMFJBX89pbMoD52Cz51JkdpOtMRf5CsEfj2fd1AMdcQEM37iMX7U7apWaur4= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN7PR05MB4548.namprd05.prod.outlook.com (2603:10b6:406:ef::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.17; Mon, 20 Jul 2020 16:47:53 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0%3]) with mapi id 15.20.3216.017; Mon, 20 Jul 2020 16:47:53 +0000 From: "Andrei Warkentin" To: Pete Batard , "devel@edk2.groups.io" CC: "ard.biesheuvel@arm.com" , "leif@nuviainc.com" , "samer.el-haj-mahmoud@arm.com" Subject: Re: [edk2-platforms][PATCH 1/1] Platforms/RaspberryPi: Fix BIOS Release Date and System Manufacturer Thread-Topic: [edk2-platforms][PATCH 1/1] Platforms/RaspberryPi: Fix BIOS Release Date and System Manufacturer Thread-Index: AQHWXrD6CPPJfDE2xU+4Z1S4JtqxvqkQrY6E Date: Mon, 20 Jul 2020 16:47:53 +0000 Message-ID: References: <20200720161507.14352-1-pete@akeo.ie> In-Reply-To: <20200720161507.14352-1-pete@akeo.ie> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: akeo.ie; dkim=none (message not signed) header.d=none;akeo.ie; dmarc=none action=none header.from=vmware.com; x-originating-ip: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 72576361-40c7-4419-87a8-08d82ccca588 x-ms-traffictypediagnostic: BN7PR05MB4548: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tnlYHcAzMYIJzo0wwPJqAJf+Zz129QOJWFnWheuMlUHPK+d6lSPZml6sNfwJIAVDV1HTfjzve7LuWM9KpEa/+lMKlYFbF3tLO9BQwCw5KuTYWAEjE7Vyn23z9XIErpXOrmgTKnZEWiXXTIqE/NJhT6OHN/z1Nmq+/Xp3JOr19D+Ws3MwRRii08v+6SA3Ts0PuvvT8hb2CPnCC0+rW9lansbfhn3nYP9b0nV2Vgr5/rYTCmuASEhSasJ0FQKCwmKr1CLn4FvYCSWhE5Yme15Reu5usJ/ZSb+5yQ4CZYBE4yqHavBuxPiju9ZqWTq7vm33wn4eMWVeM7l0w70KCnL0eA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(376002)(39860400002)(366004)(346002)(136003)(396003)(55016002)(9686003)(7696005)(19627235002)(52536014)(83380400001)(2906002)(19627405001)(33656002)(8676002)(71200400001)(478600001)(54906003)(110136005)(316002)(5660300002)(86362001)(8936002)(66946007)(66476007)(66446008)(53546011)(6506007)(4326008)(64756008)(76116006)(26005)(186003)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: a+MOIClEsA25c6EHaxj4NdBXD2ZFctqUF/WfXcHbozSdzreQpiHte/M3CxGBzSdGsF358Sk1H4oJxrNAu4+b2qS21V8bvtXOQvO7ICAo+rjaXIkZEw0wpDD1Y0eiem3CzlOL+YVYQ9l9nrRe4fe51rAlxMBXccyyYbwGgLk5EiI6WlQjZfbH4Jr2gZmeOqaRJXXmvHVQgkDYFyr682uK6wxUJXCoa+Meh5t00A1HIIMkUZyQnTKyAJfEMIih3nfa9OM5vwM4e4N3Ys5WSezOOm+uF5dy4Nqd+riqw5xubNkl0U3wUxFPGHlwYjxlVdYa3mAmfmeOpN+J+ltppjVdEV0u4uPiSACaaNw7ryTaJ3jaGtk59NW15Lr6n32rLZyuDhalDhF7chOG1xtzu2Y2MWXFvi+1pMd95hhNp2QjwM9kPT5U1rBk71UiImhKtrJaQNzWmEMBpPnqxDhR32H/IQNPrpPNNx6tD3M4YNKJQtEMni3cyNMIMKVt2TkTzhBE x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR05MB3411.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72576361-40c7-4419-87a8-08d82ccca588 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2020 16:47:53.3704 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2X5T0DnS4fKUCyen5PZvqA55h//W8wA0FNiUF801Negavvga556cfNMLYURY15WHJRHJQGYxZ22UpsnJCo6U0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR05MB4548 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB341173050D6557905FD7D6CBB97B0BN6PR05MB3411namp_" --_000_BN6PR05MB341173050D6557905FD7D6CBB97B0BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: Pete Batard Sent: Monday, July 20, 2020 11:15 AM To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com ; leif@nuviainc.com ; Andrei Warkentin ; samer.el-haj-mah= moud@arm.com Subject: [edk2-platforms][PATCH 1/1] Platforms/RaspberryPi: Fix BIOS Releas= e Date and System Manufacturer Per SMBIOS specs, The Type 0 BIOS Release Date is not a free form field but must be specified in a US middle-endian format (mm/dd/yyyy), so make sure we populate it accordingly by converting gcc's __DATE__ string. This is required for platforms like Windows, that fail to parse the date otherwise. Also, the system manufacturer should not be set to the same value as the board manufacturer for the Type 1 strings, as, on the Raspberry Pi, this is not representative of the actual manufacturer of the system, which is the Raspberry Pi Foundation always. It should be noted that we do not expect other compilers than ones using a __DATE__ format similar to gcc's to be used for the foreseeable future. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 31 ++= ++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index d5fb843d43ce..fb775d00feba 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -119,11 +119,12 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 =3D { CHAR8 mBiosVendor[128] =3D "EDK2"; CHAR8 mBiosVersion[128] =3D "EDK2-DEV"; +CHAR8 mBiosDate[12] =3D "00/00/0000"; CHAR8 *mBIOSInfoType0Strings[] =3D { mBiosVendor, // Vendor mBiosVersion, // Version - __DATE__ " " __TIME__, // Release Date + mBiosDate, // Release Date NULL }; @@ -149,7 +150,7 @@ CHAR8 mSysInfoSerial[sizeof (UINT64) * 2 + 1]; CHAR8 mSysInfoSKU[sizeof (UINT64) * 2 + 1]; CHAR8 *mSysInfoType1Strings[] =3D { - mSysInfoManufName, + "Raspberry Pi Foundation", mSysInfoProductName, mSysInfoVersionName, mSysInfoSerial, @@ -626,6 +627,28 @@ BIOSInfoUpdateSmbiosType0 ( INTN i; INTN State =3D 0; INTN Value[2]; + INTN Year =3D (__DATE__[7] =3D=3D '?' ? 1900 \ + : (((__DATE__[7] - '0') * 1000 ) \ + + (__DATE__[8] - '0') * 100 \ + + (__DATE__[9] - '0') * 10 \ + + __DATE__[10] - '0')); + INTN Month =3D ( __DATE__ [2] =3D=3D '?' ? 1 \ + : __DATE__ [2] =3D=3D 'n' ? ( \ + __DATE__ [1] =3D=3D 'a' ? 1 : 6) \ + : __DATE__ [2] =3D=3D 'b' ? 2 \ + : __DATE__ [2] =3D=3D 'r' ? ( \ + __DATE__ [0] =3D=3D 'M' ? 3 : 4) \ + : __DATE__ [2] =3D=3D 'y' ? 5 \ + : __DATE__ [2] =3D=3D 'l' ? 7 \ + : __DATE__ [2] =3D=3D 'g' ? 8 \ + : __DATE__ [2] =3D=3D 'p' ? 9 \ + : __DATE__ [2] =3D=3D 't' ? 10 \ + : __DATE__ [2] =3D=3D 'v' ? 11 \ + : 12); + INTN Day =3D ( __DATE__[4] =3D=3D '?' ? 1 \ + : ((__DATE__[4] =3D=3D ' ' ? 0 : \ + ((__DATE__[4] - '0') * 10)) \ + + __DATE__[5] - '0')); // Populate the Firmware major and minor. Status =3D mFwProtocol->GetFirmwareRevision (&EpochSeconds); @@ -648,6 +671,10 @@ BIOSInfoUpdateSmbiosType0 ( mBiosVendor, sizeof (mBiosVendor)); UnicodeStrToAsciiStrS ((CHAR16*)PcdGetPtr (PcdFirmwareVersionString), mBiosVersion, sizeof (mBiosVersion)); + ASSERT (Year >=3D 0 && Year <=3D 9999); + ASSERT (Month >=3D 1 && Month <=3D 12); + ASSERT (Day >=3D 1 && Day <=3D 31); + AsciiSPrint (mBiosDate, sizeof (mBiosDate), "%02d/%02d/%04d", Month, Day= , Year); // Look for a "x.y" numeric string anywhere in mBiosVersion and // try to parse it to populate the BIOS major and minor. -- 2.21.0.windows.1 --_000_BN6PR05MB341173050D6557905FD7D6CBB97B0BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warken= tin <awarkentin@vmware.com>

From: Pete Batard <pete@= akeo.ie>
Sent: Monday, July 20, 2020 11:15 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: ard.biesheuvel@arm.com <ard.biesheuvel@arm.com>; leif@nuvi= ainc.com <leif@nuviainc.com>; Andrei Warkentin <awarkentin@vmware.= com>; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@arm.com><= br> Subject: [edk2-platforms][PATCH 1/1] Platforms/RaspberryPi: Fix BIOS= Release Date and System Manufacturer
 
Per SMBIOS specs, The Type 0 BIOS Release Date is = not a free form field but
must be specified in a US middle-endian format (mm/dd/yyyy), so make sure we populate it accordingly by converting gcc's __DATE__ string. This is
required for platforms like Windows, that fail to parse the date otherwise.=

Also, the system manufacturer should not be set to the same value as the board manufacturer for the Type 1 strings, as, on the Raspberry Pi, this is=
not representative of the actual manufacturer of the system, which is the Raspberry Pi Foundation always.

It should be noted that we do not expect other compilers than ones using a __DATE__ format similar to gcc's to be used for the foreseeable future.
Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | = 31 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index d5fb843d43ce..fb775d00feba 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -119,11 +119,12 @@ SMBIOS_TABLE_TYPE0 mBIOSInfoType0 =3D {
 
 CHAR8 mBiosVendor[128]  =3D "EDK2";
 CHAR8 mBiosVersion[128] =3D "EDK2-DEV";
+CHAR8 mBiosDate[12]     =3D "00/00/0000";  
 CHAR8 *mBIOSInfoType0Strings[] =3D {
   mBiosVendor,        &n= bsp;     // Vendor
   mBiosVersion,        &= nbsp;    // Version
-  __DATE__ " " __TIME__,    // Release Date<= br> +  mBiosDate,         &nb= sp;      // Release Date
   NULL
 };
 
@@ -149,7 +150,7 @@ CHAR8 mSysInfoSerial[sizeof (UINT64) * 2 + 1];
 CHAR8 mSysInfoSKU[sizeof (UINT64) * 2 + 1];
 
 CHAR8 *mSysInfoType1Strings[] =3D {
-  mSysInfoManufName,
+  "Raspberry Pi Foundation",
   mSysInfoProductName,
   mSysInfoVersionName,
   mSysInfoSerial,
@@ -626,6 +627,28 @@ BIOSInfoUpdateSmbiosType0 (
   INTN   i;
   INTN   State =3D 0;
   INTN   Value[2];
+  INTN   Year =3D (__DATE__[7] =3D=3D '?' ? 1900  \ +           : (((__DATE__= [7] - '0') * 1000 ) \
+           + (__DATE__[8= ] - '0') * 100      \
+           + (__DATE__[9= ] - '0') * 10       \
+           + __DATE__[10= ] - '0'));
+  INTN   Month =3D ( __DATE__ [2] =3D=3D '?' ? 1  \ +           : __DATE__ [2= ] =3D=3D 'n' ? (        \
+             _= _DATE__ [1] =3D=3D 'a' ? 1 : 6)   \
+           : __DATE__ [2= ] =3D=3D 'b' ? 2        \
+           : __DATE__ [2= ] =3D=3D 'r' ? (        \
+             _= _DATE__ [0] =3D=3D 'M' ? 3 : 4)   \
+           : __DATE__ [2= ] =3D=3D 'y' ? 5        \
+           : __DATE__ [2= ] =3D=3D 'l' ? 7        \
+           : __DATE__ [2= ] =3D=3D 'g' ? 8        \
+           : __DATE__ [2= ] =3D=3D 'p' ? 9        \
+           : __DATE__ [2= ] =3D=3D 't' ? 10       \
+           : __DATE__ [2= ] =3D=3D 'v' ? 11       \
+           : 12);
+  INTN   Day =3D ( __DATE__[4] =3D=3D '?' ? 1  &n= bsp;  \
+           : ((__DATE__[= 4] =3D=3D ' ' ? 0 :     \
+             (= (__DATE__[4] - '0') * 10))    \
+           + __DATE__[5]= - '0'));
 
   // Populate the Firmware major and minor.
   Status =3D mFwProtocol->GetFirmwareRevision (&EpochSeco= nds);
@@ -648,6 +671,10 @@ BIOSInfoUpdateSmbiosType0 (
     mBiosVendor, sizeof (mBiosVendor));
   UnicodeStrToAsciiStrS ((CHAR16*)PcdGetPtr (PcdFirmwareVersionS= tring),
     mBiosVersion, sizeof (mBiosVersion));
+  ASSERT (Year >=3D 0 && Year <=3D 9999);
+  ASSERT (Month >=3D 1 && Month <=3D 12);
+  ASSERT (Day >=3D 1 && Day <=3D 31);
+  AsciiSPrint (mBiosDate, sizeof (mBiosDate), "%02d/%02d/%04d&qu= ot;, Month, Day, Year);
 
   // Look for a "x.y" numeric string anywhere in mBios= Version and
   // try to parse it to populate the BIOS major and minor.
--
2.21.0.windows.1

--_000_BN6PR05MB341173050D6557905FD7D6CBB97B0BN6PR05MB3411namp_--