From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by mx.groups.io with SMTP id smtpd.web11.41361.1595261723218869146 for ; Mon, 20 Jul 2020 09:15:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=x+rCBH7q; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.208.45, mailfrom: pete@akeo.ie) Received: by mail-ed1-f45.google.com with SMTP id z17so13208296edr.9 for ; Mon, 20 Jul 2020 09:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C8G+I6AjVvqJYhQYvFoIt0/46mIQvYY0ZgqFPqXPkPY=; b=x+rCBH7qWCauvUSmxgg7Nqsyfq8tYDTM1l8U0+JI8AnxNbDF+nWGDdI/MAfWXMs7QZ h0TX1V+VbA07A8UJLXqAMeqZlhVxK8D2YZF7y5QqMgWq86ZR+jeia8sXdAfAzeEcvVyR kIVs7pmD2N5B89D92u9xnWhGFFW1dhwUsfd+hayAClxT3vNtXwNJh4Og6OBstW4Vedxn NSqDqRnXFFrjkcKIh3E//AOa+rr2EYoayM30UjsZuE2TBq3OvVVFEQ9fQlz6dUJcarO8 EM3NSuCqBMvKQW6w2irRFQ/95yop7ZteOyGxavNlbjPFcnDHXfXCUY6yxRkmYiiltKbq 3Yog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=C8G+I6AjVvqJYhQYvFoIt0/46mIQvYY0ZgqFPqXPkPY=; b=if8AYlTv9/QB7oEja/pjYRjteXrBYB58WOG8mKJj+1zV1HIA/XKw9M9rv0RiCQfksP EfAWmVsUHHDP0zsvDjTXmnWRNGzGPSo7pZsrELe5Gcf4CQmNRjLNMJEkS78yykdhuEO0 5dV3hJXnbaWJoajziFL0jp28czrRVayvifKJ3vD8s6FhoqauNfhW5oBz8qsefe/BOyK6 rmrs28Z1PY//x58eHR+yVG2X5WakG+1v0ynuQ9OjD1p6Je5ycXXjuxsrR+Onu3iQwTv1 gKHzl3k8QL6q+wJnUThFKEYhiayEw3ro3HqUZB2WLLkpg75xtKc89FDZMk0l1icxXJgQ QFMg== X-Gm-Message-State: AOAM532lDkDJN5DrAkN8IVlreAzLS1jHr5nQDj0FW083yLDd8n7ALM+p aR7AwdGIVWwYsiX/nbfiZ9a5L6cgi+4d6g== X-Google-Smtp-Source: ABdhPJxmMVnNVCC6/lifshkxQlm/TRyOOJn31a5mLjNJosJFJYMbPoLLHeNTFxl7+dtNNWXZR2CGig== X-Received: by 2002:aa7:c24d:: with SMTP id y13mr23002209edo.123.1595261721396; Mon, 20 Jul 2020 09:15:21 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([84.203.89.184]) by smtp.gmail.com with ESMTPSA id s1sm15354181edy.1.2020.07.20.09.15.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2020 09:15:20 -0700 (PDT) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com Subject: [edk2-platforms][PATCH 1/1] Platforms/RaspberryPi: Fix BIOS Release Date and System Manufacturer Date: Mon, 20 Jul 2020 17:15:07 +0100 Message-Id: <20200720161507.14352-1-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/PlatformSmbiosDxe.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 = { CHAR8 mBiosVendor[128] = "EDK2"; CHAR8 mBiosVersion[128] = "EDK2-DEV"; +CHAR8 mBiosDate[12] = "00/00/0000"; CHAR8 *mBIOSInfoType0Strings[] = { 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[] = { - mSysInfoManufName, + "Raspberry Pi Foundation", mSysInfoProductName, mSysInfoVersionName, mSysInfoSerial, @@ -626,6 +627,28 @@ BIOSInfoUpdateSmbiosType0 ( INTN i; INTN State = 0; INTN Value[2]; + INTN Year = (__DATE__[7] == '?' ? 1900 \ + : (((__DATE__[7] - '0') * 1000 ) \ + + (__DATE__[8] - '0') * 100 \ + + (__DATE__[9] - '0') * 10 \ + + __DATE__[10] - '0')); + INTN Month = ( __DATE__ [2] == '?' ? 1 \ + : __DATE__ [2] == 'n' ? ( \ + __DATE__ [1] == 'a' ? 1 : 6) \ + : __DATE__ [2] == 'b' ? 2 \ + : __DATE__ [2] == 'r' ? ( \ + __DATE__ [0] == 'M' ? 3 : 4) \ + : __DATE__ [2] == 'y' ? 5 \ + : __DATE__ [2] == 'l' ? 7 \ + : __DATE__ [2] == 'g' ? 8 \ + : __DATE__ [2] == 'p' ? 9 \ + : __DATE__ [2] == 't' ? 10 \ + : __DATE__ [2] == 'v' ? 11 \ + : 12); + INTN Day = ( __DATE__[4] == '?' ? 1 \ + : ((__DATE__[4] == ' ' ? 0 : \ + ((__DATE__[4] - '0') * 10)) \ + + __DATE__[5] - '0')); // Populate the Firmware major and minor. Status = mFwProtocol->GetFirmwareRevision (&EpochSeconds); @@ -648,6 +671,10 @@ BIOSInfoUpdateSmbiosType0 ( mBiosVendor, sizeof (mBiosVendor)); UnicodeStrToAsciiStrS ((CHAR16*)PcdGetPtr (PcdFirmwareVersionString), mBiosVersion, sizeof (mBiosVersion)); + ASSERT (Year >= 0 && Year <= 9999); + ASSERT (Month >= 1 && Month <= 12); + ASSERT (Day >= 1 && Day <= 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