From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.49]) by mx.groups.io with SMTP id smtpd.web11.5.1591648895003297080 for ; Mon, 08 Jun 2020 13:41:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=URLX1UGS; spf=pass (domain: arm.com, ip: 40.107.0.49, mailfrom: samer.el-haj-mahmoud@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Erv3B6lLunzknxxmtk1GzkUyYjW2Ux+vorZBDVsOqoE=; b=URLX1UGSqRg36F+wGPiipg9NhS36KCjkHQOPtnsFuJ/QfkoXW+HekJ1Wvz08mRyaCn9pK6zunf4M98JJIaG86QPWkqwv/64vfwibRFUhQzcPymC3rrb0Xhh3pMO9e/mY1zH8yrwFfdalbrMc/rmSBE0Lt/APjMklE3f7JsqILAY= Received: from DB3PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:8::16) by AM6PR08MB4198.eurprd08.prod.outlook.com (2603:10a6:20b:a7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Mon, 8 Jun 2020 20:41:32 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:0:cafe::aa) by DB3PR08CA0003.outlook.office365.com (2603:10a6:8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Mon, 8 Jun 2020 20:41:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Mon, 8 Jun 2020 20:41:32 +0000 Received: ("Tessian outbound 8bb15bb571b3:v59"); Mon, 08 Jun 2020 20:41:32 +0000 X-CR-MTA-TID: 64aa7808 Received: from ba7829617a5e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1BF3C2C5-6947-4B3D-B18D-29F09AC6B12F.1; Mon, 08 Jun 2020 20:41:27 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ba7829617a5e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 08 Jun 2020 20:41:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LP3MBEFd7DDZruEg8d2gwYK8dfptkEdlvBisDJAAm8CHZGT0Y/rpr90a6josnPYEk1G9H01w9UWol6dYCITtK16aGV30e8FP3h+2CQA/AKMxPI6cCBbXPE2QCa2l1hXt9yBst2NaAPJt/EZSRj34yMrEHPHepRjAn5jD7a/mn3Qy2HwSVzCWujY83vsW2fICOqgNNokWKBj3I0EfhDZnnXaiqtitGZn7bDpEwZzrq6zKIRXrLb7stvGaT1aoJnU9za0Q8gQzJsDJqEWfwter+RXuPPlkOc6JPUt+qpWVNdE4tOGnotXRkOeR7ygQ6/5+450QgTRSa0Pg/ZQnM+dNsA== 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=Erv3B6lLunzknxxmtk1GzkUyYjW2Ux+vorZBDVsOqoE=; b=lruO9qFxmLyrWiUa89hTx4dVypwsKw2jGr8XKAS3yvU/Utd5OgPDWtr04Z5pA6FKOobBGcCvu9FgHjvBoc+cunZ9MONSsPOH1BfK5XYSgWbzavwF7tqsQzeVmmj9SBajpNVmsJQz/a6iKFLW1oeI6NNIxpyEijs8Mjse1cZ5YAbRDhVmNcOcPymOPG9PsdahQ8aMW6JTDWm2DJmCzy8pEDMUjCzEcJ1j5qw5iZRiwwVV9N3reP2kKiNSicdvn5r0RQftHPNHiFxAEIs62Ufq5j2P+I1PpOZyA53xLc1clHJb1O+fV/4I5uYlzCbtG9xJ4bWZ8dCQgp7mbo/cP3JdCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Erv3B6lLunzknxxmtk1GzkUyYjW2Ux+vorZBDVsOqoE=; b=URLX1UGSqRg36F+wGPiipg9NhS36KCjkHQOPtnsFuJ/QfkoXW+HekJ1Wvz08mRyaCn9pK6zunf4M98JJIaG86QPWkqwv/64vfwibRFUhQzcPymC3rrb0Xhh3pMO9e/mY1zH8yrwFfdalbrMc/rmSBE0Lt/APjMklE3f7JsqILAY= Received: from DB7PR08MB3260.eurprd08.prod.outlook.com (2603:10a6:5:21::23) by DB7PR08MB3674.eurprd08.prod.outlook.com (2603:10a6:10:4a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.20; Mon, 8 Jun 2020 20:41:24 +0000 Received: from DB7PR08MB3260.eurprd08.prod.outlook.com ([fe80::990e:ed79:bec0:9dac]) by DB7PR08MB3260.eurprd08.prod.outlook.com ([fe80::990e:ed79:bec0:9dac%7]) with mapi id 15.20.3066.023; Mon, 8 Jun 2020 20:41:24 +0000 From: "Samer El-Haj-Mahmoud" To: "devel@edk2.groups.io" , "Andrei Warkentin (awarkentin@vmware.com)" CC: Leif Lindholm , Ard Biesheuvel , Pete Batard , Rui Lopes Subject: Re: [edk2-devel] [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: Add Asset Tag support Thread-Topic: [edk2-devel] [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: Add Asset Tag support Thread-Index: AQHWOmt1wocf5Gnf+Ua2Q0DvuYrN7qjO5FM4gABOlSA= Date: Mon, 8 Jun 2020 20:41:24 +0000 Message-ID: References: <20200604122702.11263-1-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: df357dab-1450-44a0-9bbe-b855769de690.1 x-checkrecipientchecked: true Authentication-Results-Original: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=arm.com; x-originating-ip: [99.132.126.10] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bf0c95c7-d5ad-442a-a9f5-08d80bec5404 x-ms-traffictypediagnostic: DB7PR08MB3674:|AM6PR08MB4198: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:4714;OLM:10000; x-forefront-prvs: 042857DBB5 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lxv3x5HqwiVGCEukXM0mq8hun3GWlS01eKfE4oAvcYa2x7Se3J+1P5FBxcixve5+iTodjIhAaXFGwxshL5HImeh42BsgHc/Hz0l94Ql72RabxvEZGUsQ2wzk4rplkPTBWlYt7LbVWFrz7o2YpJTZqTKecnppZftqm4wmz+YMOS2LNBCyWHxCdR3KWVvq4+yYk8IGv5h9B8ubnDkcnOT1cKg7YIIZMYsaY0irtFxKTlonmXh6JTcnGFe/sOq6wSP9c5sw7E/s+MSrvmiDYtZF/w/EN3ZZF/p3XznKSNcq2DYy8FPyxYEw9FCA636QMOZCfPdbW2u9nK/2ZSRhQmiqKZSuu9LMzSrwDBE17Uvw1xRahjxYon/uRa3i2n5mAExKEPtzd5IHcabBv5D/utSOeA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR08MB3260.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(136003)(39860400002)(376002)(396003)(346002)(5660300002)(33656002)(76236002)(7696005)(2906002)(316002)(8936002)(52536014)(110136005)(30864003)(8676002)(86362001)(54906003)(45080400002)(26005)(186003)(4326008)(66556008)(6506007)(53546011)(64756008)(966005)(66946007)(66446008)(66476007)(76116006)(83380400001)(55016002)(166002)(71200400001)(19627235002)(478600001)(9686003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: s0NUZTyCf+8OH3FmNgJJJ9idJiRzGHS/3qPXEFuor1Vuyb+vLu7u3IjNGWQTqYAK68hVxvqWzFrYvoqz6M5h3BbdPOVnUfAAZwqF+YYD8UX3NGUUHCQbGsUsa4QVMkUm/4wo7LW9OxZcYx/K273FWNCTk2d19U5izXmUbmUkEqE4gwvVI2H9K6OENcWkAC91j+LaoihdAih9WOLXUI549PjCAeNWKAJmYoMaIN8KRTjm5h8oOXj18mB+s33I+bJJYdOfqGtHSa+M//CDsn2/7SeykmdQY6LH0476w9SAophg32tc3psIE8gUQifKxSVYgJ/cUwpVfq6Z+9zImO6WOpu/XXeWTXKc/EapHaTweNOBjBFV3ZU2KCXdTCTzk5xfpNcDYx/E/mGmFHMo2G8e7n6gzV62lTQwATFdReUpuG/X8/RXf+d+/ysjGg5fe9UN4+WdEhz3qFgQanjzPwOUJ93G5d8SLZRFDUDbL9xiZRviesc4ukIIeBv4gdW+yPHa MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3674 Original-Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=arm.com; Return-Path: Samer.El-Haj-Mahmoud@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFTY:;SFS:(4636009)(396003)(136003)(376002)(39860400002)(346002)(46966005)(966005)(8936002)(316002)(8676002)(52536014)(4326008)(478600001)(336012)(7696005)(9686003)(55016002)(166002)(30864003)(110136005)(45080400002)(107886003)(82310400002)(5660300002)(19627235002)(54906003)(47076004)(82740400003)(186003)(70586007)(26005)(81166007)(83380400001)(33656002)(356005)(70206006)(86362001)(6506007)(76236002)(2906002)(53546011);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 29dceb71-71c0-46b7-4fcf-08d80bec4f9a X-Forefront-PRVS: 042857DBB5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Xee04wgLnHTZ7KRsl86kpoxSz5RG1e/tedgebmDSSQtamEjAYA0000eqv16unus0/QQ+SpVyivbKD7wgxCs6nCOjcoP/wZjE6jLHmwMvLgHrhyoPeR+TWVaHqFpSi08ovzixTnf3r0mx54fAkvLCdIC9yleksySomMvQpdOxv6eSYAEOEbFAMzo8EOd+qT695rfpP5mTYVq5IgAMQa1v+BwnUzrC+OGFHvLnspGY+tnj3UJNanZkxoGXc7w+2Uot73pRfpOdWER4VLVY9LahAmhyHWSIh/jJOaT4jq0F81XcmQdrLs3Txjk5t8eoRxdef3J88skVcNSAM49v5zh2VRhRCT0VvaVvzS0dJO8saQlA+gojEbU7r6Fj0lmJS1+0ddCL5OUSUyC1SnObYLDytoLsZ59nknRPjcEkd4zK9XTMniRs+jf/zrCHOrW/LRiLRCPsBYN3UwbqkHcggosvZ3yJCsVh0TfDMg/Cy7VpOU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2020 20:41:32.2624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf0c95c7-d5ad-442a-a9f5-08d80bec5404 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4198 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DB7PR08MB326061A3813FDFAEB9907D6690850DB7PR08MB3260eurp_" --_000_DB7PR08MB326061A3813FDFAEB9907D6690850DB7PR08MB3260eurp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Andrei. I submitted a v2 with the commit message changes. I will als= o send a follow-up patch to add examples for RPi3/4 config scripting using = the Shell From: devel@edk2.groups.io On Behalf Of Andrei Wark= entin via groups.io Sent: Monday, June 8, 2020 11:53 AM To: Samer El-Haj-Mahmoud ; devel@edk2.groups= .io Cc: Leif Lindholm ; Ard Biesheuvel ; Pete Batard ; Rui Lopes Subject: Re: [edk2-devel] [edk2-platform][PATCH v1 1/1] Platforms/Raspberr= yPi/RPi4: Add Asset Tag support 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 R= Pi3/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 Biesh= euvel >; Pete Batard = >; Andrei Warkentin >; Rui Lopes > Subject: [edk2-platform][PATCH v1 1/1] Platforms/RaspberryPi/RPi4: Add Ass= et 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.outloo= k.com/?url=3Dhttps%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F54&data= =3D02%7C01%7Cawarkentin%40vmware.com%7C8d843c5163b24fe547d308d8088296c5%7C= b39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637268704259127440&sdata=3DL= e7LTzcWXvSNZlOGqqBsl0qiU7cUw1473yDYZ7Bvk%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/PlatformSmbios= Dxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.= inf 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/Raspberr= yPi/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/Pla= tform/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_RUNTIM= E_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_RUNTIM= E_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_= ACCESS | 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/PlatformSmbios= Dxe.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(mChassisAss= etTag)); + DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag)); + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoTy= pe2Strings, NULL); } diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Pla= tform/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 Ass= et Tag" + /* * MMC/SD configuration. */ -- 2.17.1 IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in= any medium. Thank you. --_000_DB7PR08MB326061A3813FDFAEB9907D6690850DB7PR08MB3260eurp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Thanks Andrei. I submitted a v2 with the commit mes= sage changes. I will also send a follow-up patch to add examples for RPi3/4= config scripting using the Shell

 

From: devel@edk2.groups.io <devel@edk2.gr= oups.io> On Behalf Of Andrei Warkentin via groups.io
Sent: Monday, June 8, 2020 11:53 AM
To: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; deve= l@edk2.groups.io
Cc: Leif Lindholm <leif@nuviainc.com>; Ard Biesheuvel <Ard= .Biesheuvel@arm.com>; Pete Batard <pete@akeo.ie>; Rui Lopes <rg= l@ruilopes.com>
Subject: Re: [edk2-devel] [edk2-platform][PATCH v1 1/1] Platforms/R= aspberryPi/RPi4: Add Asset Tag support

 

Looks good to me aside from minor typos in commit message. A= lso, note that this applies to Pi 3 as well.

 

Would it be possible to have a follow-up change to amend the= readmes for RPi3/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><= br> Cc: Leif Lindholm <leif@nuv= iainc.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: = Add Asset Tag support

 

Add suppot for confi= guring 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"Ass= etTag".
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%40vmwa= re.com%7C8d843c5163b24fe547d308d8088296c5%7Cb39138ca3cee4b4aa4d6cd83d9dd62f= 0%7C0%7C1%7C637268704259127440&amp;sdata=3DLe7LTzcWXvSNZlOGqqBsl0qiU7cU= w1473yDYZ7Bvk%2FI%3D&amp;reserved=3D0

Cc: Leif Lindholm <leif@nuviainc.c= om>
Cc: Ard Biesheuvel <ard.biesh= euvel@arm.com>
Cc: Pete Batard <pete@akeo.ie> Cc: Andrei Warkentin <awarkent= in@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    &nb= sp;            =            |  7 += ;+++++
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr  &= nbsp;           | 14 += ;++++++++++
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c   =             &nb= sp;   | 23 +++++++++++= ;+++---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c&n= bsp;  | 26 ++++++++++++= ;++++++--
 Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni  &= nbsp;           |  4= +++
 6 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbios= Dxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.= inf
index 1ed6338c69cb..59b2fefdf0fd 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf=
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformS= mbiosDxe.inf
@@ -43,7 +43,9 @@ [LibraryClasses]
 [Protocols]
   gEfiSmbiosProtocolGuid      &nb= sp;    # PROTOCOL SOMETIMES_CONSUMED
   gRaspberryPiFirmwareProtocolGuid ## CONSUMES
+
 [Guids]
+  gConfigDxeFormSetGuid
 
 [Depex]
   gEfiSmbiosProtocolGuid AND gRaspberryPiFirmwareProtocolGuid diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspberr= yPi/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@gmail.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<= br> +#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 eMM= C2 on Pi 4.
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Pla= tform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
index 72cc90ae0bec..b4b2a3a7abde 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr<= br> @@ -1,6 +1,7 @@
 /** @file
  *
  *  Copyright (c) 2018 Andrei Warkentin <andrey.warkentin@gmail.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_GUI= D;
 
+    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_BOOTSERVIC= E_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
       name  =3D SdIsArasan,
@@ -172,6 +178,14 @@ formset
             o= ption text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_BOTH), value =3D SYSTEM_TAB= LE_MODE_BOTH, flags =3D DEFAULT;
             o= ption text =3D STRING_TOKEN(STR_ADVANCED_SYSTAB_DT), value =3D SYSTEM_TABLE= _MODE_DT, flags =3D DEFAULT;
         endoneof;
+
+        string varid =3D AssetTag.= AssetTag,
+            pr= ompt  =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_PROMPT),
+            he= lp    =3D STRING_TOKEN(STR_ADVANCED_ASSET_TAG_HELP),
+            fl= ags   =3D INTERACTIVE | RESET_REQUIRED,
+            mi= nsize =3D 0,
+            ma= xsize =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_STORA= GE_SIZE] =3D L"";
   EFI_STATUS Status;
 
   /*
@@ -238,6 +239,22 @@ SetupVariables (
     PcdSet32 (PcdSystemTableMode, PcdGet32 (PcdSystem= TableMode));
   }
 
+  Size =3D sizeof(AssetTagVar);
+
+  Status =3D gRT->GetVariable(L"AssetTag",
+           &nb= sp;      &gConfigDxeFormSetGuid,
+           &nb= sp;      NULL, &Size, AssetTagVar);
+
+  if (EFI_ERROR (Status)) {
+    Status =3D gRT->SetVariable (
+           &nb= sp;        L"AssetTag",
+           &nb= sp;        &gConfigDxeFormSetGuid, +           &nb= sp;        EFI_VARIABLE_NON_VOLATILE | E= FI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+           &nb= sp;        sizeof(AssetTagVar),
+           &nb= sp;        AssetTagVar
+           &nb= sp;        );
+  }
+
   Size =3D sizeof (UINT32);
   Status =3D gRT->GetVariable (L"SdIsArasan",
            &n= bsp;      &gConfigDxeFormSetGuid,
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbios= Dxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c<= br> index 3351fea2ec32..7b86e76a1248 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformS= mbiosDxe.c
@@ -20,6 +20,7 @@
  *  Copyright (c) 2013, Linaro.org
  *  Copyright (c) 2012, Apple Inc. All rights reserved.<BR&g= t;
  *  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 &n= bsp;         :1;
     0,    //  RequiresDaughterCar= d  :1;
@@ -179,11 +182,15 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 =3D {
   0,          = ;            &n= bsp; // NumberOfContainedObjectHandles;
   { 0 }         &n= bsp;           // Contain= edObjectHandles[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,          = ;            &n= bsp; // Version String
   3,          = ;            &n= bsp; // SerialNumber String
-  0,          &nbs= p;             = // AssetTag String
+  4,          =             &nb= sp; // AssetTag String
   ChassisStateSafe,       &n= bsp; // BootupState;
   ChassisStateSafe,       &n= bsp; // PowerSupplyState;
   ChassisStateSafe,       &n= bsp; // 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_STORA= GE_SIZE] =3D L"";
+  EFI_STATUS Status;
+
+  Size =3D sizeof(AssetTagVar);
+  Status =3D gRT->GetVariable(L"AssetTag",
+           &nb= sp;      &gConfigDxeFormSetGuid,
+           &nb= sp;      NULL, &Size, AssetTagVar);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed to get Asset Tag= : %r\n", Status));
+  }
+  UnicodeStrToAsciiStrS(AssetTagVar, mChassisAssetTag, sizeof(mC= hassisAssetTag));
+  DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChas= sisAssetTag));
+
   LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2= , mBoardInfoType2Strings, NULL);
 }
 
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Pla= tform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
index 7195e497f986..2a468760c6a9 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni<= br> @@ -1,6 +1,7 @@
 /** @file
  *
  *  Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.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 e= n-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 Asset Tag"
+
 /*
  * MMC/SD configuration.
  */
--
2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in any medium. Thank you. --_000_DB7PR08MB326061A3813FDFAEB9907D6690850DB7PR08MB3260eurp_--