From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.53]) by mx.groups.io with SMTP id smtpd.web10.33177.1591631571721938435 for ; Mon, 08 Jun 2020 08:52:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=sjcaRqrm; spf=pass (domain: vmware.com, ip: 40.107.93.53, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZu8/wCTec369AJX1GbwnC2zxlqHST7ZO2NsSuHlKrCyeQkk4jJNJrPSoabam4TR3W8DMxEMWsAWMtqNcHQgBX+8c2dGD5ihOizXEU+/TyfiQa/Lg23q7C6Xng+ZxeqbW39K3JZdjj2qEyirgegGPsCD0M/fZh2pbAkQxu57cEZT9TvD+rVzXdmu0JyQULEFEHUzJkTsmiR7uiQEZCcpzBgsy2xBveW7vN8C2D0Zecbjjqt8jaUSh69sydxaTXZt9o5aYv4L+Mq7ADbwOgG6EYCvk3p6ZPHznoQMle5OJm2jaE90/XYdkzzGnh6v20dOoeXGMu7MnJ6cyI/Fm4NaOQ== 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=KS+GS0xukEQInMU9WQuWXo4V2gHoC8jYmzs0rTR2zoY=; b=Rl0uChe1hTzydSNk9/kIy4n+Gl7irl9WjxN3TKE7bRveqfRmcFvqFGUMyBS2PDRW1R48mtKnLju2cy2Q0rCW4t+XAtMsY3SiJ4CyXKJSf9convrnqZxXjfcvbru1hrcowpxXDuyLAvCgzBv0oyptrhUYvrW5iO/B28/gGyvc8QP3twKM39K1x+UXik30uf83LN/eAFfHN5wMHjv7scl5D4uXsNBkjlrWWd4Pn2Qi1hId2yCV6gUdGLlH2C0ZurjQ19p9mKMqdhVsT12Ld0Fplrqo/7AzTVqkIgl78Y/ZgrKRT2Moqjlgs3807c7zuAAJN98jqPAbyDnZo1mulqM0ig== 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=KS+GS0xukEQInMU9WQuWXo4V2gHoC8jYmzs0rTR2zoY=; b=sjcaRqrmCbxmiBxN4fsnTDfnQOW5tk8JgqOx5ew7vaQJEiakd0gTYlHq39vFoRijM+HGZex3S0IxnB+BfaHN1uSRxdeKZwgB5InUEOd7FP4M+2eUXq3qIbpzO1CIpFB5Cgi5p9SjuFq985lAcD6JEzmsBNmV6hdwfrHQc8Ex9/A= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN6PR05MB3250.namprd05.prod.outlook.com (2603:10b6:404:bb::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.11; Mon, 8 Jun 2020 15:52:49 +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.3088.017; Mon, 8 Jun 2020 15:52:49 +0000 From: "Andrei Warkentin" To: Samer El-Haj-Mahmoud , "devel@edk2.groups.io" CC: Leif Lindholm , Ard Biesheuvel , Pete Batard , Rui Lopes Subject: Re: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: Add Asset Tag support Thread-Topic: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: Add Asset Tag support Thread-Index: AQHWOmt1wocf5Gnf+Ua2Q0DvuYrN7qjO5FM4 Date: Mon, 8 Jun 2020 15:52:49 +0000 Message-ID: References: <20200604122702.11263-1-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200604122702.11263-1-Samer.El-Haj-Mahmoud@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; 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: 5cfae32e-07fb-45ba-7d99-08d80bc3ff0d x-ms-traffictypediagnostic: BN6PR05MB3250: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3968; x-forefront-prvs: 042857DBB5 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ke4G1WMKPhXshi94NTILzigbRvZHiVv6PoVwIDBDkVCwxukCdXW2xRjCAzf934ueFo2hBCKUaFeesFr14U6YRGbabpLb1JQqA4OPmI6F4UVHjbMYl7T264LKWdZaEuoI/vSNalou2ryL9QIICfhN2ECp/ODj4O8eAx0vX19WtXql8z2JEZTKliKIrd0L4kQOhdon5we7ItYcpumPdGNF5ugfEcYNSTU5Ux7F/MUKwyMn8Y/F54RoSZ8afaXpvEFbRUBYAwxE7WNVgnUWeMSEzRVMqjQ4hiGnk2mcMGifSrFWh0BLjXfD4X9p5T+utCDlTpu9jBmEYb8ERdKwbNhMwR1Qf/Z3bfuKsE6AWqBA2v/ffHx+DgJcyOnBjHSdA96iczQzgqefann6hC9JxlsJrA== 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)(396003)(346002)(376002)(136003)(39860400002)(366004)(83380400001)(19627235002)(8676002)(64756008)(166002)(19627405001)(71200400001)(66446008)(4326008)(66476007)(66556008)(33656002)(66946007)(316002)(76116006)(8936002)(55016002)(86362001)(7696005)(26005)(966005)(52536014)(9686003)(110136005)(53546011)(6506007)(2906002)(5660300002)(45080400002)(478600001)(186003)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: FqmrUGxJW+IncdVgxTaHxHGjfXNP7xfYCQCNBgW27YTRCi2bt5bVJ0bf5lU9PpArKG4mBGYmPV7WAHgnqhgtA+EA4etXwF+y46uT1rgwI9dZ14xVGKN+JkKaBY4TDqpcSwa6/lJMKRk/i1/oRthDkBf8BphbkTwRroTgPhEV8tgNpKmEzkAbsUl7VmE1KliGBs9rFrqvSoaBCH+dM3X9q2PkkGQf/sVjrPhTeoMszUHlgh1Zc6fmCoqxMJEa9iJ/QuWBKfEuI6vsjTv8v/Fwh8+dt1gHebLuCr8d/Hojznl5bZB+DS01YrAlDyNMi5Wxyc+4bwpnCpyEp8A7qzMZb+1wLdQKoIIEXHUYZOY0pVchXqBcVdGSaEoylq4x8d1MgeSd0Vy1RNEG6OMSKlczYT642rnEWlndZgJXFOic89j1vTXuZADKHCaQ775y+mJ3uxKAAnkHB91fzvhSFKnUfL54j83w0THbspYdo2k8+L4= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cfae32e-07fb-45ba-7d99-08d80bc3ff0d X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2020 15:52:49.4969 (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: 4qBI/T0D0ceBZM2N39QDYi6URetNOc4bK69Rg2CSNubvDlCkkFQbqAigKAZjU1NrzMOnvaCXgPENJGxahkw8ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR05MB3250 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB3411D24C0235D7DF867CC498B9850BN6PR05MB3411namp_" --_000_BN6PR05MB3411D24C0235D7DF867CC498B9850BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me aside from minor typos in commit message. Also, note that = this applies to Pi 3 as well. Would it be possible to have a follow-up change to amend the readmes for RP= i3/RPi4 with this setvar example to set AssetTag? Reviewed-by: Andrei Warkentin ________________________________ From: Samer El-Haj-Mahmoud Sent: Thursday, June 4, 2020 7:27 AM To: devel@edk2.groups.io Cc: Leif Lindholm ; Ard Biesheuvel ; Pete Batard ; Andrei Warkentin ; = Rui Lopes Subject: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: Add Asse= t Tag support Add suppot for configuring the Chassis AssetTag in the UI as well as UEFI Shell, and carry the confiugured value as the Asset Tag string in SMBIOS Types 2 and 3. To configure using the UEFI Shell, use 'setvar' comnmand to read/write the UEFI variable with GUID =3D gConfigDxeFormSetGuid and Name=3D"AssetTag"= . For example: Shell> setvar AssetTag -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 -bs -rt -nv =3DL"ABC123" =3D0x0000 This resolves this Github issue: https://nam04.safelinks.protection.outlook= .com/?url=3Dhttps%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F54&data= =3D02%7C01%7Cawarkentin%40vmware.com%7C8d843c5163b24fe547d308d8088296c5%7Cb= 39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637268704259127440&sdata=3DLe= 7LTzcWXvSNZlOGqqBsl0qiU7cUw1473yDYZ7Bvk%2FI%3D&reserved=3D0 Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Pete Batard Cc: Andrei Warkentin Cc: Rui Lopes Signed-off-by: Samer El-Haj-Mahmoud --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf | 2 = ++ Platform/RaspberryPi/Include/ConfigVars.h | 7 = ++++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 14 = +++++++++++ Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 23 = ++++++++++++++--- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 26 = ++++++++++++++++++-- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 4 = +++ 6 files changed, 71 insertions(+), 5 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.i= nf index 1ed6338c69cb..59b2fefdf0fd 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf @@ -43,7 +43,9 @@ [LibraryClasses] [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED gRaspberryPiFirmwareProtocolGuid ## CONSUMES + [Guids] + gConfigDxeFormSetGuid [Depex] gEfiSmbiosProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h index cefddbafcd8f..9e5a69c7a657 100644 --- a/Platform/RaspberryPi/Include/ConfigVars.h +++ b/Platform/RaspberryPi/Include/ConfigVars.h @@ -1,6 +1,7 @@ /** @file * * Copyright (c) 2020, Andrei Warkentin + * Copyright (c) 2020, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -82,6 +83,12 @@ typedef struct { UINT32 Mode; } SYSTEM_TABLE_MODE_VARSTORE_DATA; +#define ASSET_TAG_STR_MAX_LEN 32 +#define ASSET_TAG_STR_STORAGE_SIZE 33 +typedef struct { + CHAR16 AssetTag[ASSET_TAG_STR_STORAGE_SIZE]; +} ADVANCED_ASSET_TAG_VARSTORE_DATA; + typedef struct { /* * 0 - uSD slot routed to Broadcom SDHOST on Pi 3 or eMMC2 on Pi 4. diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr index 72cc90ae0bec..b4b2a3a7abde 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -1,6 +1,7 @@ /** @file * * Copyright (c) 2018 Andrei Warkentin + * Copyright (c) 2020, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -49,6 +50,11 @@ formset name =3D SystemTableMode, guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore ADVANCED_ASSET_TAG_VARSTORE_DATA, + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, + name =3D AssetTag, + guid =3D CONFIGDXE_FORM_SET_GUID; + efivarstore MMC_SD_VARSTORE_DATA, attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME= _ACCESS | EFI_VARIABLE_NON_VOLATILE, name =3D SdIsArasan, @@ -172,6 +178,14 @@ formset option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), value = =3D SYSTEM_TABLE_MODE_BOTH, flags =3D DEFAULT; option text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value = =3D SYSTEM_TABLE_MODE_DT, flags =3D DEFAULT; endoneof; + + string varid =3D AssetTag.AssetTag, + prompt =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT), + help =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_HELP), + flags =3D INTERACTIVE | RESET_REQUIRED, + minsize =3D 0, + maxsize =3D ASSET_TAG_STR_MAX_LEN, + endstring; endform; form formid =3D 0x1003, diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 583f07c9b8bf..77a0b37529ea 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -186,9 +186,10 @@ SetupVariables ( VOID ) { - UINTN Size; - UINT8 Var8; - UINT32 Var32; + UINTN Size; + UINT8 Var8; + UINT32 Var32; + CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] =3D L""; EFI_STATUS Status; /* @@ -238,6 +239,22 @@ SetupVariables ( PcdSet32 (PcdSystemTableMode, PcdGet32 (PcdSystemTableMode)); } + Size =3D sizeof(AssetTagVar); + + Status =3D gRT->GetVariable(L"AssetTag", + &gConfigDxeFormSetGuid, + NULL, &Size, AssetTagVar); + + if (EFI_ERROR (Status)) { + Status =3D gRT->SetVariable ( + L"AssetTag", + &gConfigDxeFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof(AssetTagVar), + AssetTagVar + ); + } + Size =3D sizeof (UINT32); Status =3D gRT->GetVariable (L"SdIsArasan", &gConfigDxeFormSetGuid, diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 3351fea2ec32..7b86e76a1248 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -20,6 +20,7 @@ * Copyright (c) 2013, Linaro.org * Copyright (c) 2012, Apple Inc. All rights reserved.
* Copyright (c) Microsoft Corporation. All rights reserved. + * Copyright (c) 2020, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -40,7 +41,9 @@ #include #include #include +#include #include +#include #define SMB_IS_DIGIT(c) (((c) >=3D '0') && ((c) <=3D '9')) @@ -164,7 +167,7 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 =3D { 2, // ProductName String 3, // Version String 4, // SerialNumber String - 0, // AssetTag String + 5, // AssetTag String { // FeatureFlag 1, // Motherboard :1; 0, // RequiresDaughterCard :1; @@ -179,11 +182,15 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 =3D { 0, // NumberOfContainedObjectHandles; { 0 } // ContainedObjectHandles[1]; }; + +CHAR8 mChassisAssetTag[128]; + CHAR8 *mBoardInfoType2Strings[] =3D { mSysInfoManufName, mSysInfoProductName, mSysInfoVersionName, mSysInfoSerial, + mChassisAssetTag, NULL }; @@ -196,7 +203,7 @@ SMBIOS_TABLE_TYPE3 mEnclosureInfoType3 =3D { MiscChassisEmbeddedPc, // Type; 2, // Version String 3, // SerialNumber String - 0, // AssetTag String + 4, // AssetTag String ChassisStateSafe, // BootupState; ChassisStateSafe, // PowerSupplyState; ChassisStateSafe, // ThermalState; @@ -212,6 +219,7 @@ CHAR8 *mEnclosureInfoType3Strings[] =3D { mSysInfoManufName, mSysInfoProductName, mSysInfoSerial, + mChassisAssetTag, NULL }; @@ -760,6 +768,20 @@ BoardInfoUpdateSmbiosType2 ( VOID ) { + UINTN Size; + CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] =3D L""; + EFI_STATUS Status; + + Size =3D sizeof(AssetTagVar); + Status =3D gRT->GetVariable(L"AssetTag", + &gConfigDxeFormSetGuid, + NULL, &Size, AssetTagVar); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag: %r\n", Status)); + } + UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mChassisAsse= tTag)); + DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag)); + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoTyp= e2Strings, NULL); } diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni index 7195e497f986..2a468760c6a9 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -1,6 +1,7 @@ /** @file * * Copyright (c) 2018, Andrei Warkentin + * Copyright (c) 2020, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -47,6 +48,9 @@ #string STR_ADVANCED_SYSTAB_BOTH #language en-US "ACPI + Devicetree" #string STR_ADVANCED_SYSTAB_DT #language en-US "Devicetree" +#string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag" +#string STR_ADVANCED_ASSET_TAG_HELP #language en-US "Set the system Asse= t Tag" + /* * MMC/SD configuration. */ -- 2.17.1 --_000_BN6PR05MB3411D24C0235D7DF867CC498B9850BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Looks good to me aside from minor typos in commit message. Also, note that = this applies to Pi 3 as well.

Would it be possible to have a follow-up change to amend the readmes for RP= i3/RPi4 with this setvar example to set AssetTag?

Reviewed-by:  Andrei Warkentin <andrey.warkentin@gmail.com>=

From: Samer El-Haj-Mahmoud = <Samer.El-Haj-Mahmoud@arm.com>
Sent: Thursday, June 4, 2020 7:27 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel <ard.= biesheuvel@arm.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin = <awarkentin@vmware.com>; Rui Lopes <rgl@ruilopes.com>
Subject: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: A= dd Asset Tag support
 
Add suppot for configuring the Chassis AssetTag in= the UI as well as
UEFI Shell, and carry the confiugured value as the Asset Tag string
in SMBIOS Types 2 and 3.

To configure using the UEFI Shell, use 'setvar' comnmand to read/write
the UEFI variable with GUID =3D gConfigDxeFormSetGuid and Name=3D"Asse= tTag".
For example:

Shell> setvar AssetTag -guid CD7CC258-31DB-22E6-9F22-63B0B8EED6B5 -bs -rt -nv =3DL"ABC123" =3D0x0000

This resolves this Github issue: https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.= com%2Fpftf%2FRPi4%2Fissues%2F54&amp;data=3D02%7C01%7Cawarkentin%40vmwar= e.com%7C8d843c5163b24fe547d308d8088296c5%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0= %7C0%7C1%7C637268704259127440&amp;sdata=3DLe7LTzcWXvSNZlOGqqBsl0qiU7cUw= 1473yDYZ7Bvk%2FI%3D&amp;reserved=3D0

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Rui Lopes <rgl@ruilopes.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> ---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf = |  2 ++
 Platform/RaspberryPi/Include/ConfigVars.h    &nbs= p;            &= nbsp;          |  7 += +++++
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr  &n= bsp;           | 14 += ++++++++++
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c   &= nbsp;           &nbs= p;   | 23 +++++++++++= +++---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c&nb= sp;  | 26 ++++++++++++= ++++++--
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni  &n= bsp;           |  4 = +++
 6 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.i= nf
index 1ed6338c69cb..59b2fefdf0fd 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf<= br> +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSm= biosDxe.inf
@@ -43,7 +43,9 @@ [LibraryClasses]
 [Protocols]
   gEfiSmbiosProtocolGuid      &nbs= p;    # PROTOCOL SOMETIMES_CONSUMED
   gRaspberryPiFirmwareProtocolGuid ## CONSUMES
+
 [Guids]
+  gConfigDxeFormSetGuid
 
 [Depex]
   gEfiSmbiosProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberry= Pi/Include/ConfigVars.h
index cefddbafcd8f..9e5a69c7a657 100644
--- a/Platform/RaspberryPi/Include/ConfigVars.h
+++ b/Platform/RaspberryPi/Include/ConfigVars.h
@@ -1,6 +1,7 @@
 /** @file
  *
  *  Copyright (c) 2020, Andrei Warkentin <andrey.warkentin@gm= ail.com>
+ *  Copyright (c) 2020, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -82,6 +83,12 @@ typedef struct {
   UINT32 Mode;
 } SYSTEM_TABLE_MODE_VARSTORE_DATA;
 
+#define ASSET_TAG_STR_MAX_LEN       32 +#define ASSET_TAG_STR_STORAGE_SIZE  33
+typedef struct {
+  CHAR16 AssetTag[ASSET_TAG_STR_STORAGE_SIZE];
+} ADVANCED_ASSET_TAG_VARSTORE_DATA;
+
 typedef struct {
   /*
    * 0 - uSD slot routed to Broadcom SDHOST on Pi 3 or eMMC= 2 on Pi 4.
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
index 72cc90ae0bec..b4b2a3a7abde 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr @@ -1,6 +1,7 @@
 /** @file
  *
  *  Copyright (c) 2018 Andrei Warkentin <andrey.warkentin@gma= il.com>
+ *  Copyright (c) 2020, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -49,6 +50,11 @@ formset
       name  =3D SystemTableMode,
       guid  =3D CONFIGDXE_FORM_SET_GUID= ;
 
+    efivarstore ADVANCED_ASSET_TAG_VARSTORE_DATA,
+      attribute =3D EFI_VARIABLE_BOOTSERVICE_= ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+      name  =3D AssetTag,
+      guid  =3D CONFIGDXE_FORM_SET_GUID;=
+
     efivarstore MMC_SD_VARSTORE_DATA,
       attribute =3D EFI_VARIABLE_BOOTSERVICE= _ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
       name  =3D SdIsArasan,
@@ -172,6 +178,14 @@ formset
             op= tion text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), value =3D SYSTEM_TABL= E_MODE_BOTH, flags =3D DEFAULT;
             op= tion text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value =3D SYSTEM_TABLE_= MODE_DT, flags =3D DEFAULT;
         endoneof;
+
+        string varid =3D AssetTag.A= ssetTag,
+            pro= mpt  =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT),
+            hel= p    =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_HELP),
+            fla= gs   =3D INTERACTIVE | RESET_REQUIRED,
+            min= size =3D 0,
+            max= size =3D ASSET_TAG_STR_MAX_LEN,
+        endstring;
     endform;
 
     form formid =3D 0x1003,
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 583f07c9b8bf..77a0b37529ea 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -186,9 +186,10 @@ SetupVariables (
   VOID
   )
 {
-  UINTN Size;
-  UINT8 Var8;
-  UINT32 Var32;
+  UINTN      Size;
+  UINT8      Var8;
+  UINT32     Var32;
+  CHAR16     AssetTagVar[ASSET_TAG_STR_STORAG= E_SIZE] =3D L"";
   EFI_STATUS Status;
 
   /*
@@ -238,6 +239,22 @@ SetupVariables (
     PcdSet32 (PcdSystemTableMode, PcdGet32 (PcdSystemT= ableMode));
   }
 
+  Size =3D sizeof(AssetTagVar);
+
+  Status =3D gRT->GetVariable(L"AssetTag",
+           &nbs= p;      &gConfigDxeFormSetGuid,
+           &nbs= p;      NULL, &Size, AssetTagVar);
+
+  if (EFI_ERROR (Status)) {
+    Status =3D gRT->SetVariable (
+           &nbs= p;        L"AssetTag",
+           &nbs= p;        &gConfigDxeFormSetGuid, +           &nbs= p;        EFI_VARIABLE_NON_VOLATILE | EF= I_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+           &nbs= p;        sizeof(AssetTagVar),
+           &nbs= p;        AssetTagVar
+           &nbs= p;        );
+  }
+
   Size =3D sizeof (UINT32);
   Status =3D gRT->GetVariable (L"SdIsArasan",
            &nb= sp;      &gConfigDxeFormSetGuid,
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 3351fea2ec32..7b86e76a1248 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSm= biosDxe.c
@@ -20,6 +20,7 @@
  *  Copyright (c) 2013, Linaro.org
  *  Copyright (c) 2012, Apple Inc. All rights reserved.<BR>= ;
  *  Copyright (c) Microsoft Corporation. All rights reserved. + *  Copyright (c) 2020, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -40,7 +41,9 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/TimeBaseLib.h>
 #include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
 #include <Library/PrintLib.h>
+#include <ConfigVars.h>
 
 #define SMB_IS_DIGIT(c)  (((c) >=3D '0') && ((c) <= =3D '9'))
 
@@ -164,7 +167,7 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 =3D {
   2,    // ProductName String
   3,    // Version String
   4,    // SerialNumber String
-  0,    // AssetTag String
+  5,    // AssetTag String
   {     // FeatureFlag
     1,    //  Motherboard &nb= sp;         :1;
     0,    //  RequiresDaughterCard=   :1;
@@ -179,11 +182,15 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 =3D {
   0,          =             &nb= sp; // NumberOfContainedObjectHandles;
   { 0 }         &nb= sp;           // Containe= dObjectHandles[1];
 };
+
+CHAR8 mChassisAssetTag[128];
+
 CHAR8 *mBoardInfoType2Strings[] =3D {
   mSysInfoManufName,
   mSysInfoProductName,
   mSysInfoVersionName,
   mSysInfoSerial,
+  mChassisAssetTag,
   NULL
 };
 
@@ -196,7 +203,7 @@ SMBIOS_TABLE_TYPE3 mEnclosureInfoType3 =3D {
   MiscChassisEmbeddedPc,    // Type;
   2,          =             &nb= sp; // Version String
   3,          =             &nb= sp; // SerialNumber String
-  0,           = ;             /= / AssetTag String
+  4,          &= nbsp;           &nbs= p; // AssetTag String
   ChassisStateSafe,       &nb= sp; // BootupState;
   ChassisStateSafe,       &nb= sp; // PowerSupplyState;
   ChassisStateSafe,       &nb= sp; // ThermalState;
@@ -212,6 +219,7 @@ CHAR8 *mEnclosureInfoType3Strings[] =3D {
   mSysInfoManufName,
   mSysInfoProductName,
   mSysInfoSerial,
+  mChassisAssetTag,
   NULL
 };
 
@@ -760,6 +768,20 @@ BoardInfoUpdateSmbiosType2 (
   VOID
   )
 {
+  UINTN      Size;
+  CHAR16     AssetTagVar[ASSET_TAG_STR_STORAG= E_SIZE] =3D L"";
+  EFI_STATUS Status;
+
+  Size =3D sizeof(AssetTagVar);
+  Status =3D gRT->GetVariable(L"AssetTag",
+           &nbs= p;      &gConfigDxeFormSetGuid,
+           &nbs= p;      NULL, &Size, AssetTagVar);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag:= %r\n", Status));
+  }
+  UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mCh= assisAssetTag));
+  DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChass= isAssetTag));
+
   LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2,= mBoardInfoType2Strings, NULL);
 }
 
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
index 7195e497f986..2a468760c6a9 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni @@ -1,6 +1,7 @@
 /** @file
  *
  *  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gm= ail.com>
+ *  Copyright (c) 2020, ARM Limited. All rights reserved.
  *
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
@@ -47,6 +48,9 @@
 #string STR_ADVANCED_SYSTAB_BOTH     #language en= -US "ACPI + Devicetree"
 #string STR_ADVANCED_SYSTAB_DT       #l= anguage en-US "Devicetree"
 
+#string STR_ADVANCED_ASSET_TAG_PROMPT #language en-US "Asset Tag&= quot;
+#string STR_ADVANCED_ASSET_TAG_HELP   #language en-US "= Set the system Asset Tag"
+
 /*
  * MMC/SD configuration.
  */
--
2.17.1

--_000_BN6PR05MB3411D24C0235D7DF867CC498B9850BN6PR05MB3411namp_--