From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.55]) by mx.groups.io with SMTP id smtpd.web08.8693.1662994670335790294 for ; Mon, 12 Sep 2022 07:57:51 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=YVTzxb83; spf=pass (domain: arm.com, ip: 40.107.14.55, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=PZb6AnprLSbyQ8f6JQHLef2a8nUqm8Pn2wPjSvqa26PQy4QEWQ4Xn4wtEZUcOELe7d7guQzipo6J2IKO9qr8bOldy86zRxay+H1LXcaRLXRQzy7KYtZPjkxvTkb/IfKN9YFyWBRmrYTIFOI2SCt0uXorX2pG2drYQEvNOY9KbTZfxnmnrQFOhpOyNv3dQHJq9L8OBFKdxD1fhsia4YnobQivfspoF8V4oQibFBPJP/GoFRgmTK5jgU77MEzYje17GQvStPhPa+BOnxcP2AyKV9OCIzRw3tTDYOuc1pWfFz7JDGeH2c9ZKiElmVKp3ZhdWeDwEeMfq4L59mRhWSl6lQ== ARC-Message-Signature: i=2; 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=hBYaqsq9UkW14KwxOtF2odaLzQeOPcWpfaTXlgd0P0s=; b=ONwkZhBddF0fSOtKi8rVjqwS7qXCCfLPMUCgO0qDetY3nYnXJXFg7vgZ561tKiUGgc9lK8OXI2vk+pddCeLsZt8Ydd4haLHeZWD3DSgIt9V6SLpYi0j5AoNhAbCAGY7Fpw6f31zVJ8YgTPJ3+F5ITDAqwtvQ4/0knARMjY6TmvEYA1CtCaFubFtWtmgwqNDt8e0HAXkmArxKdK8QL3Rwcq6QfOVn1kYtp5d4dg+sRRwJ9558nLeVu/TmxXvRQ8wdQrOevvrnYwzeaNqDG22RzEZALaHBp3ZR/Bru+y9yvygV8TtFu1QqA0No8SMbgnfvQKGc6AuycJY/V3Udi5aNVQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=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=hBYaqsq9UkW14KwxOtF2odaLzQeOPcWpfaTXlgd0P0s=; b=YVTzxb83YmfJxgdLfGlWM2jEi/IaBgt6o5A7l0l+VI9eWHVtMCtquuibU4TNrC6XDH2XBLXpAmoyv070LJ1C1EsY1gfwIhpWPM2OYbxP/5eZsumjRHCBLL5kAGC4NDBNjziHq6osXqrMoIXqtQ9v900kqeR4BtHPAkv3Qy1d+LA= Received: from DB6PR1001CA0037.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::23) by GV2PR08MB9424.eurprd08.prod.outlook.com (2603:10a6:150:dd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Mon, 12 Sep 2022 14:57:42 +0000 Received: from DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:55:cafe::e0) by DB6PR1001CA0037.outlook.office365.com (2603:10a6:4:55::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14 via Frontend Transport; Mon, 12 Sep 2022 14:57:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass 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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT055.mail.protection.outlook.com (100.127.142.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.13 via Frontend Transport; Mon, 12 Sep 2022 14:57:41 +0000 Received: ("Tessian outbound 2af316122c7a:v123"); Mon, 12 Sep 2022 14:57:41 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4b6786c31941b21b X-CR-MTA-TID: 64aa7808 Received: from a62f8972eb13.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CA63AF56-EE63-4D65-AA2B-4AB6CF59CA1A.1; Mon, 12 Sep 2022 14:57:40 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a62f8972eb13.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 12 Sep 2022 14:57:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IBGofmJu6yTy/DP3R2acLU2ClH2WHFqmVSLGKE9vUyMy+gKJUNT+Qs5mCeJEtfZTDmIANWHmG4IwqkRt7t2HfPMBb4I6YP1AzLCY081ztxBqLYXa8yUo9NNzje71Ndo9yyAF4gFdhEJn3y7IH476tS/J4OgkMoEBGqiQ9QtOu1h2bG+jWJc++6PgIZUUmmYeaUQJQyLWXIzM/e9N7vMROGPuofkHR3jYZOIdZJWNO5U7RA9CjHt42qEe5OTH13nI9nwqDudt/nD/BtomWLDR3eX7eb7ZGnEIPFjz2GfolTCIYy5KR+h15b8sitCGt0gLbnaF5Gt9DWegf6w8wQfubg== 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=hBYaqsq9UkW14KwxOtF2odaLzQeOPcWpfaTXlgd0P0s=; b=YA2O/aseExKfhMCoaQ6cV6Lib50NvqxKUibUZk6JXpj1pWzyyduEPi6sUZ/0nPtnwL9aUXmS62Yvtz8nOAGPf2qZfPgJY6Ixvr+LPv1yr7iL8tXhZzkXj8l1o00gzMxj9n/EQFy66Dby/CpnzMFuMpK0vor10ev2okhEoRaFqBx88FKIu+G+4avQBgrnaYLdc3KNTQNjEMKjxS6KQCD/Xz9r3B+MQpo/eL+tLX6gPBT60iguh/cSW6cjkeipK9vh8YgCfsNvjgmkcvNmde9ruwFSoXmXcQBX3/daU0qOozbI7SRhs4Mzo881/o2goqD2fPYYrvOId3pyPMjl5JN4IQ== 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=hBYaqsq9UkW14KwxOtF2odaLzQeOPcWpfaTXlgd0P0s=; b=YVTzxb83YmfJxgdLfGlWM2jEi/IaBgt6o5A7l0l+VI9eWHVtMCtquuibU4TNrC6XDH2XBLXpAmoyv070LJ1C1EsY1gfwIhpWPM2OYbxP/5eZsumjRHCBLL5kAGC4NDBNjziHq6osXqrMoIXqtQ9v900kqeR4BtHPAkv3Qy1d+LA= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by DB9PR08MB8360.eurprd08.prod.outlook.com (2603:10a6:10:3d8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Mon, 12 Sep 2022 14:57:24 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::b480:677a:ac9b:8f24]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::b480:677a:ac9b:8f24%7]) with mapi id 15.20.5612.022; Mon, 12 Sep 2022 14:57:24 +0000 Message-ID: Date: Mon, 12 Sep 2022 15:57:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 From: "Sami Mujawar" Subject: Re: [PATCH 2/2] DynamicTablesPkg: Add Smbios Type17 Table generator To: Girish Mahadevan , devel@edk2.groups.io, Alexei Fedorov CC: Samer El-Haj-Mahmoud , Jeff Brasen , Ashish Singhal , Akanksha Jain , Matteo Carlini , Hemendra Dassanayake , Nick Ramirez , William Watson , Akanksha Jain , "nd@arm.com" References: <90bcdad9b53f1ca184a857da720aac1ab89882f7.1661534045.git.gmahadevan@nvidia.com> In-Reply-To: <90bcdad9b53f1ca184a857da720aac1ab89882f7.1661534045.git.gmahadevan@nvidia.com> X-ClientProxiedBy: LO4P265CA0172.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:312::15) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6806:EE_|DB9PR08MB8360:EE_|DBAEUR03FT055:EE_|GV2PR08MB9424:EE_ X-MS-Office365-Filtering-Correlation-Id: 86c9daa9-c4f4-49a3-6ccc-08da94cf2472 X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6DJZbKEDQD35OBK55DYZvYwt5w5tsl90zLkKyBWIgwCBnVxFqOdOYyCLRQy7EAPVEesoidxhWLEV5Wx5sFWkA4UlN5JWGwovRVnNd5zL1qpNY5QfCC594N85NUmTCezja54u+GSTZ6ClkVeEiVWdZRwsxAaIWI9gDBuE6/hZpe2Phz6/3KumVx3+EdP9Wg681mbsAU83FzlUjDTgO9kgauqgVuiPtIp7vddYDxVHOsgZFimD5mA1koYCIaL52B059/aO+Niyo3TQu188EBsoksDJpsIZy1JtRvLA6i2vaR5RusyVW2diXZck2rLgMii1JJHkYdLkd3GpDcNeGHKFtm47mjW1LtiRqYmnMJuZ34o96LAcOBt4M8TOoYJESx2RWokXhHhAEOAH3JS4BJETp6x5lWnc3eLRbKlkJyEfW/rCTlWHF9ij1SrPXq8TM1OqkaocXRaqWjDSzs0Dsdsts2H8ObWL8q2GhWdtcQ/4G/JzcTfcg0k4G6Vj65TxR+y71c1kWcRNi0Np0UReJjRWwTLbU+NZjDg17nDMBl4Ppqnh0q3OvqrWRzCPcKVuMmS2MrCfJiUGxltcsMwUQzzJ7SmYCeElCBMKKvVP0+ZJUD4o3ue8pXO7iSv4cHg+8AtVOYWnMwaKkitl1F1pgfxxfV8VZB048hILsdJoTWVsturr7nRQqa0C1vc1O5Mv6bchpqWrNYhq3ClcfvvfCu7HP9qi4+wME3l8thnFLl6L/x8B5dTpdp69gy8WlKPz0HNAb8ulxWQyYeobxgFzeSieIEzlgWHOc7IRcjj9CElcJ63Gl8vyy0nxvXKUMvBm02HXzd4IpK0vEOsS7wvnIloxkHnjI6hSFj5RLdkGmBFlDS6Q9tHov49BTFpXfRVpVlrXbV+J116shwaFC6Cl9O8A3w== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(366004)(346002)(136003)(376002)(39860400002)(110136005)(6636002)(41300700001)(83380400001)(36756003)(966005)(54906003)(31686004)(6506007)(53546011)(478600001)(6486002)(316002)(19627235002)(44832011)(5660300002)(2616005)(186003)(2906002)(30864003)(86362001)(31696002)(66476007)(66556008)(26005)(6512007)(4326008)(6666004)(66946007)(8936002)(8676002)(38100700002)(21314003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8360 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 09163893-7e54-40c2-e010-08da94cf19f2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f0NeMkyZHjMb89pN5SMEGYsMs4RaaJEU7KWdxLxvswVAmy7AQXwEHneFJho/6r90ko1hXAMSje4I3pJaP3tn2U49Gr9nev4F9L3lkPEgjW8ZWzOUj0g6e1ppWW0kF6AQJxvwsc0m/8fvkRUWv0tAEoCYsTHyZfPS11Cm5FDulyezzGaZqcHvlG6kxzo+3DT1qk2AST8Yf4Prqk92iGkdcIYcjuQCXMp6eQGYdFtG+WO7juoeymE0Fxam0y0NDMTRsJ9lhc8oEnp7WY5Yvpj7dT2l9FfQ5DI9M+fLAF+qCTH2gqHluUzc/EbnLfZDK/nziJOE91hZTuOGdJKthDWq/16ehDg6HomHjJF7Q7I17girbtnh+rcnl5K74D9r9FfJooagKM7amn2YVOcCiAU7L4hnz94ReNOI9ag6HQZLEWzxr1jUwzqzvHIJSY7j7fHEdJnxQWIXl4/QbE18v2hGMCklrPk0CCNZaa4h9HNYinvtgsLgs76fF/TKd+TVC34lshU+gVMBLDzfi/DQZZXtDfSNh/jtdYcU/9FGvwiikzxO71WGmNO9QvsUES3y3KYYgMFN1IysxsUNh7JJ8PTFGWMRYwHPdWmRT/9PVGBs5yuVGR8csxgaI2CXtikTnq10xtiaRYq/9VPltK2egtKeks+qH8ezlelbgZjismePOawXEclsJdN8z1c2XpdS8f5aB6U2VcIJkBfOdCwYsVTT6OAQWNU3LqpzxzdhgytDZ51dpIjg2kgRur/7+csFjOkvJ3Zc/vivJYw7HhIFn4Fsq/Zl8qHAqF2ulKou7wo+GsboCg8c7bLcHNj0bgCHswPkQN78SxD7HM9ur0xHY8bTLWJ0PNIi9qlE5S+TrxF4Zove3f0jodDPqJFbV9hErSYEQygZlIhBP0XKpQoe/WTA8w== 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;SFS:(13230016)(4636009)(39860400002)(346002)(396003)(136003)(376002)(36840700001)(40470700004)(46966006)(31696002)(40480700001)(82310400005)(81166007)(356005)(86362001)(40460700003)(82740400003)(41300700001)(8936002)(36860700001)(6506007)(53546011)(26005)(2906002)(30864003)(44832011)(6666004)(5660300002)(31686004)(54906003)(110136005)(6636002)(316002)(478600001)(8676002)(4326008)(6486002)(966005)(186003)(70206006)(19627235002)(83380400001)(336012)(70586007)(2616005)(6512007)(47076005)(36756003)(21314003)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2022 14:57:41.6966 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86c9daa9-c4f4-49a3-6ccc-08da94cf2472 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-AuthSource: DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB9424 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Girish, Thank you for this patch and for the effort for bringing forward dynamic=20 SMBIOS generation. Please find my feedback inline marked [SAMI]. Regards, Sami Mujawar On 26/08/2022 06:37 pm, Girish Mahadevan wrote: > Add a new CM object to describe memory devices and setup a new > Generator Library for SMBIOS Type17 table. > > Signed-off-by: Girish Mahadevan > --- > .../Include/ArmNameSpaceObjects.h | 59 +++ > .../SmbiosType17Lib/SmbiosType17Generator.c | 338 ++++++++++++++++++ > .../SmbiosType17Lib/SmbiosType17LibArm.inf | 32 ++ > 3 files changed, 429 insertions(+) > create mode 100644 DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/= SmbiosType17Generator.c > create mode 100644 DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/= SmbiosType17LibArm.inf > > diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTabl= esPkg/Include/ArmNameSpaceObjects.h > index 102e0f96be..199a19e997 100644 > --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h > +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h > @@ -63,6 +63,7 @@ typedef enum ArmObjectID { > EArmObjPciInterruptMapInfo, ///< 39 - Pci Interrupt Map Info > EArmObjRmr, ///< 40 - Reserved Memory Range = Node > EArmObjMemoryRangeDescriptor, ///< 41 - Memory Range Descripto= r > + EArmObjMemoryDeviceInfo, ///< 42 - Memory Device Informati= on > EArmObjMax > } EARM_OBJECT_ID; > =20 > @@ -1070,6 +1071,64 @@ typedef struct CmArmRmrDescriptor { > UINT64 Length; > } CM_ARM_MEMORY_RANGE_DESCRIPTOR; > =20 > +/** A structure that describes the physical memory device. > + > + The physical memory devices on the system are described by this object= . > + > + SMBIOS Specification v3.5.0 Type17 > + > + ID: EArmObjMemoryDeviceInfo, > +*/ > +typedef struct CmArmMemoryDeviceInfo { [SAMI] I think we may need a Token pointing to the Type 16 object so=20 that the Physical Memory Array Handle can be setup, see my comment below=20 about the HandleManager. > + /** Size of the device. > + Size of the device in bytes. > + */ > + UINT64 Size; > + > + /** Device Set */ > + UINT8 DeviceSet; > + > + /** Speed of the device > + Speed of the device in MegaTransfers/second. > + */ > + UINT32 Speed; > + > + /** Serial Number of device */ > + CHAR8 *SerialNum; > + > + /** AssetTag identifying the device */ > + CHAR8 *AssetTag; > + > + /** Device Locator String for the device. > + String that describes the slot or position of the device on the board= . > + */ > + CHAR8 *DeviceLocator; > + > + /** Bank locator string for the device. > + String that describes the bank where the device is located. > + */ > + CHAR8 *BankLocator; > + > + /** Firmware version of the memory device */ > + CHAR8 *FirmwareVersion; > + > + /** Manufacturer Id. > + 2 byte Manufacturer Id as per JEDEC Standard JEP106AV > + */ > + UINT16 ModuleManufacturerId; > + > + /** Manufacturer Product Id > + 2 byte Manufacturer Id as designated by Manufacturer. > + */ > + UINT16 ModuleProductId; > + > + /** Device Attributes */ > + UINT8 Attributes; > + > + /** Device Configured Voltage in millivolts */ > + UINT16 ConfiguredVoltage; [SAMI] This field does not appear to be used in the generator. If the=20 intention is to use this in the future, then it may be better to add=20 this at a later stage. > +} CM_ARM_MEMORY_DEVICE_INFO; > + > #pragma pack() > =20 > #endif // ARM_NAMESPACE_OBJECTS_H_ > diff --git a/DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/SmbiosTy= pe17Generator.c b/DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/Smbio= sType17Generator.c > new file mode 100644 > index 0000000000..5683ca570f > --- /dev/null > +++ b/DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/SmbiosType17Gen= erator.c > @@ -0,0 +1,338 @@ > +/** @file > + SMBIOS Type17 Table Generator. > + > + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > + Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include [SAMI] I could not find SmbiosType17FixupLib.h in this patch series. Can=20 you check, please? > + > +// Module specific include files. > +#include > +#include > +#include > +#include [SAMI] I think Protocol/Smbios.h may not be required in this file. Can=20 you check, please? > +#include > + > +/** This macro expands to a function that retrieves the Memory Device > + information from the Configuration Manager. > +*/ > +GET_OBJECT_LIST ( > + EObjNameSpaceArm, > + EArmObjMemoryDeviceInfo, > + CM_ARM_MEMORY_DEVICE_INFO > + ) > + > +// Default Values for Memory Device > +STATIC SMBIOS_TABLE_TYPE17 MemDeviceInfoTemplate =3D { > + { // Hdr > + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type > + sizeof (SMBIOS_TABLE_TYPE17), // Length > + 0 // Handle > + }, > + 0, // MemoryArrayHandle [SAMI] Do you have any thoughts on how the MemoryArrayHandle can be setup? The same applies for the following MemoryErrorInformationHandle field. I think we need some sort of a HandleManager in DynamicTablesFramework=20 that can keep track of the mappings between SMBIOS Objects and Table=20 Handles. e.g. Smbios - HandleManager +-------------------------------+-------------------------------+ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0 Object Token=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= | Table Handle=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | +-------------------------------+-------------------------------+ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | Type16Obj_token=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 | Type 16 Table handle=C2=A0=C2=A0=C2=A0 | +-------------------------------+-------------------------------+ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ... - The Type17Object i.e. CM_ARM_MEMORY_DEVICE_INFO can then hold a token=20 for the Type16Object. =C2=A0- If Type 17 table is to be installed, DynamicTablemanager shall=20 search the SMBIOS table list to see if a Type16 table is requested to be=20 installed. - If a Type16 table is present in the list of SMBIOS table to install,=20 the Type16 table shall be installed first and an entry is made in the=20 Smbios HandleManager to create a mapping of Type16Obj_token=C2=A0 <=3D=3D> = Type16=20 Table Handle. - The Type17 table can now be built and if a the Type16Object token is=20 provided in CM_ARM_MEMORY_DEVICE_INFO, the Smbios HandleManager shall be=20 searched (using Type16Obj_token) to retrieve the Type16 Table handle and=20 populate the Type 17 Physical Memory Array Handle field. I think we may have to experiment a bit before we arrive at the correct=20 design. However, please do let me know your thoughts on the above. [SAMI] > + 0, // MemoryErrorInformationHandle > + 0xFFFF, // TotalWidth > + 0xFFFF, // DataWIdth [SAMI] I need to find out how these fields should be populated, but the=20 Annex A, SMBIOS specification version 3.6.0 says the following: 4.8.4 Total Width is not 0FFFFh (Unknown) if the memory device is=20 installed. (Size is not 0.) 4.8.5 Data Width is not 0FFFFh (Unknown). Can you explain how this field is used, please? [/SAMI] > + 0x7FFF, // Size (always use Extended Si= ze) [SAMI] I think this field should be set based on the Size. The spec says "If the size is 32 GB-1 MB or greater, the field value is=20 7FFFh and the actual size is stored in the Extended Size field." I think it would be good to have a static function=C2=A0 that encodes the=20 size in wither the Size field or the Extended Size field. e.g. UpdateSmbiosTable17Size (SMBIOS_TABLE_TYPE17 *SmbiosRecord, UINTN=20 Size) { =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 if (Size > 32GB-1MB) { =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0 SmbiosRecord->Size =3D Enco= deSize (xxx); =C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0 } else { =C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SmbiosRecord->Extende= dSize =3D EncodeExtendedSize (xxx); =C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 } [/SAMI] > + MemoryTypeUnknown, // FormFactor > + 0xFF, // DeviceSet > + 1, // Device Locator > + 2, // Bank Locator > + MemoryTypeSdram, // MemoryType > + { // TypeDetail > + 0 > + }, > + 0xFFFF, // Speed (Use Extended Speed) [SAMI] Maybe we need a helper function (similar to=20 UpdateSmbiosTable17Size()) for this field as well. > + 0, // Manufacturer > + // (Unused Use ModuleManufactue= rId) > + 3, // SerialNumber > + 4, // AssetTag > + 0, // PartNumber > + // (Unused Use ModuleProductId) > + 0, // Attributes > + 0, // ExtendedSize > + 2000, // ConfiguredMemoryClockSpeed [SAMI] Should this be provided through CM_ARM_MEMORY_DEVICE_INFO? > + 0, // MinimumVoltage > + 0, // MaximumVoltage > + 0, // ConfiguredVoltage > + MemoryTechnologyDram, // MemoryTechnology [SAMI] Should this be provided through CM_ARM_MEMORY_DEVICE_INFO? > + { // MemoryOperatingModeCapabilit= y > + .Uint16 =3D 0x000 > + }, [SAMI] I think the above initialisation may not be portable. > + 5, // FirmwareVersion > + 0, // ModuleManufacturerId > + 0, // ModuleProductId > + 0, // MemorySubsystemContollerManuf= acturerId > + 0, // MemorySybsystemControllerProd= uctId > + 0, // NonVolatileSize > + 0, // VolatileSize > + 0, // CacheSize > + 0, // LogicalSize > + 0, // ExtendedSpeed > + 0, // ExtendedConfiguredMemorySpeed > +}; > + > +STATIC CHAR8 UnknownStr[] =3D "Unknown\0"; [SAMI] Would it be possible to add the CONST qualifier, please? > + > +STATIC > +EFI_STATUS > +EFIAPI > +FreeSmbiosType17TableEx ( > + IN CONST SMBIOS_TABLE_GENERATOR *CONST This, > + IN CONST CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST Smbio= sTableInfo, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMg= rProtocol, > + IN OUT SMBIOS_STRUCTURE ***CONST Table= , > + IN CONST UINTN Table= Count > + ) > +{ > + return EFI_SUCCESS; > +} > + > +/** Construct SMBIOS Type17 Table describing memory devices. > + > + If this function allocates any resources then they must be freed > + in the FreeXXXXTableResources function. > + > + @param [in] This Pointer to the SMBIOS table generator. > + @param [in] SmbiosTableInfo Pointer to the SMBIOS table information. > + @param [in] CfgMgrProtocol Pointer to the Configuration Manager > + Protocol interface. > + @param [out] Table Pointer to the SMBIOS table. > + > + @retval EFI_SUCCESS Table generated successfully. > + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration > + Manager is less than the Object size fo= r > + the requested object. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND Could not find information. > + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. > + @retval EFI_UNSUPPORTED Unsupported configuration. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +BuildSmbiosType17TableEx ( > + IN CONST SMBIOS_TABLE_GENERATOR *This, > + IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableIn= fo, > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtoco= l, > + OUT SMBIOS_STRUCTURE ***Table, > + OUT UINTN *CONST TableCount > + ) > +{ > + EFI_STATUS Status; > + UINT32 NumMemDevices; > + SMBIOS_STRUCTURE **TableList; > + CM_ARM_MEMORY_DEVICE_INFO *MemoryDevicesInfo; > + UINTN Index; > + UINTN SerialNumLen; > + CHAR8 *SerialNum; > + UINTN AssetTagLen; > + CHAR8 *AssetTag; > + UINTN DeviceLocatorLen; > + CHAR8 *DeviceLocator; > + UINTN BankLocatorLen; > + CHAR8 *BankLocator; > + UINTN FirmwareVersionLen; > + CHAR8 *FirmwareVersion; > + CHAR8 *OptionalStrings; > + SMBIOS_TABLE_TYPE17 *SmbiosRecord; > + > + ASSERT (This !=3D NULL); > + ASSERT (SmbiosTableInfo !=3D NULL); > + ASSERT (CfgMgrProtocol !=3D NULL); > + ASSERT (Table !=3D NULL); > + ASSERT (TableCount !=3D NULL); > + ASSERT (SmbiosTableInfo->TableGeneratorId =3D=3D This->GeneratorID); > + > + DEBUG ((DEBUG_ERROR, "%a : Start \n", __FUNCTION__)); > + *Table =3D NULL; > + Status =3D GetEArmObjMemoryDeviceInfo ( > + CfgMgrProtocol, > + CM_NULL_TOKEN, > + &MemoryDevicesInfo, > + &NumMemDevices > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "Failed to get Memory Devices CM Object %r\n", > + Status > + )); > + return Status; > + } > + > + TableList =3D (SMBIOS_STRUCTURE **)AllocateZeroPool (sizeof (SMBIOS_ST= RUCTURE *) * NumMemDevices); [SAMI] The memory allocated here should be freed in=20 FreeSmbiosType17TableEx. > + if (TableList =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "Failed to alloc memory for %u devices table\n"= )); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto exit; > + } > + > + for (Index =3D 0; Index < NumMemDevices; Index++) { > + if (MemoryDevicesInfo[Index].SerialNum !=3D NULL) { > + SerialNumLen =3D AsciiStrLen (MemoryDevicesInfo[Index].SerialNum); > + SerialNum =3D MemoryDevicesInfo[Index].SerialNum; > + } else { > + SerialNumLen =3D AsciiStrLen (UnknownStr); > + SerialNum =3D UnknownStr; [SAMI] If the serial number is not provided, then should the string=20 field be set to 0? See Section 6.1.3, SMBIOS Spec Version 3.6.0 which states "If a string field references no string, a null (0) is placed in that=20 string field." [/SAMI] > + } > + > + if (MemoryDevicesInfo[Index].AssetTag !=3D NULL) { > + AssetTagLen =3D AsciiStrLen (MemoryDevicesInfo[Index].AssetTag); > + AssetTag =3D MemoryDevicesInfo[Index].AssetTag; > + } else { > + AssetTagLen =3D AsciiStrLen (UnknownStr); > + AssetTag =3D UnknownStr; > + } > + > + if (MemoryDevicesInfo[Index].DeviceLocator !=3D NULL) { > + DeviceLocatorLen =3D AsciiStrLen (MemoryDevicesInfo[Index].DeviceL= ocator); > + DeviceLocator =3D MemoryDevicesInfo[Index].DeviceLocator; > + } else { > + DeviceLocatorLen =3D AsciiStrLen (UnknownStr); > + DeviceLocator =3D UnknownStr; > + } > + > + if (MemoryDevicesInfo[Index].BankLocator !=3D NULL) { > + BankLocatorLen =3D AsciiStrLen (MemoryDevicesInfo[Index].BankLocat= or); > + BankLocator =3D MemoryDevicesInfo[Index].BankLocator; > + } else { > + BankLocatorLen =3D AsciiStrLen (UnknownStr); > + BankLocator =3D UnknownStr; > + } > + > + if (MemoryDevicesInfo[Index].FirmwareVersion !=3D NULL) { > + FirmwareVersionLen =3D AsciiStrLen (MemoryDevicesInfo[Index].Firmw= areVersion); > + FirmwareVersion =3D MemoryDevicesInfo[Index].FirmwareVersion; > + } else { > + FirmwareVersionLen =3D AsciiStrLen (UnknownStr); > + FirmwareVersion =3D UnknownStr; > + } > + > + SmbiosRecord =3D (SMBIOS_TABLE_TYPE17 *)AllocateZeroPool ( > + sizeof (SMBIOS_TABLE_TYPE17)= + > + SerialNumLen + 1 + > + AssetTagLen + 1 + DeviceLoca= torLen + 1 + > + BankLocatorLen + 1 + Firmwar= eVersionLen + 1 + 1 > + ); [SAMI] The memory allocated here needs to be freed in=20 FreeSmbiosType17TableEx as=C2=A0 SmbiosProtocol->Add () makes a copy of the= =20 SmbiosTable, see=20 https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Smbios= Dxe/SmbiosDxe.c#L476=20 and=20 https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Smbios= Dxe/SmbiosDxe.c#L516.=20 > + if (SmbiosRecord =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto exit; > + } > + > + CopyMem (SmbiosRecord, &MemDeviceInfoTemplate, sizeof (SMBIOS_TABLE_= TYPE17)); > + SmbiosRecord->ExtendedSize =3D MemoryDevicesInfo[Index].Size= ; [SAMI] CM_ARM_MEMORY_DEVICE_INFO.Size is documented as size in bytes,=20 while looking at the SMBIOS specification, section 7.18.5 for the=20 Extended Size Bits 30:0 represent the size of the memory device in=20 megabytes. I think it will be useful to create UpdateSmbiosTable17Size() which does=20 the appropriate encoding and updation of the SMBIOS table fieds. [/SAMI] > + SmbiosRecord->DeviceSet =3D MemoryDevicesInfo[Index].Devi= ceSet; > + SmbiosRecord->ModuleManufacturerID =3D > + MemoryDevicesInfo[Index].ModuleManufacturerId; > + SmbiosRecord->ModuleProductID =3D > + MemoryDevicesInfo[Index].ModuleProductId; > + SmbiosRecord->Attributes =3D > + MemoryDevicesInfo[Index].Attributes; > + SmbiosRecord->ExtendedSpeed =3D MemoryDevicesInfo[Index].Speed; > + OptionalStrings =3D (CHAR8 *)(SmbiosRecord + 1); > + AsciiSPrint (OptionalStrings, DeviceLocatorLen + 1, DeviceLocator); [SAMI] I think we can simplify the publishing of the SMBIOS strings=20 using SmbiosStringTableLib. Please see the patch at=20 https://edk2.groups.io/g/devel/message/93651 > + OptionalStrings =3D OptionalStrings + DeviceLocatorLen + 1; > + AsciiSPrint (OptionalStrings, BankLocatorLen + 1, BankLocator); > + OptionalStrings =3D OptionalStrings + BankLocatorLen + 1; > + AsciiSPrint (OptionalStrings, SerialNumLen + 1, SerialNum); > + OptionalStrings =3D OptionalStrings + SerialNumLen + 1; > + AsciiSPrint (OptionalStrings, AssetTagLen + 1, AssetTag); > + OptionalStrings =3D OptionalStrings + AssetTagLen + 1; > + AsciiSPrint (OptionalStrings, FirmwareVersionLen + 1, FirmwareVersio= n); > + OptionalStrings =3D OptionalStrings + FirmwareVersionLen + 1; > + TableList[Index] =3D (SMBIOS_STRUCTURE *)SmbiosRecord; > + } > + > + *Table =3D TableList; > + *TableCount =3D NumMemDevices; > + > +exit: > + DEBUG ((DEBUG_ERROR, "%a : Done \n", __FUNCTION__)); > + return Status; > +} > + > +/** The interface for the SMBIOS Type17 Table Generator. > +*/ > +STATIC > +CONST > +SMBIOS_TABLE_GENERATOR SmbiosType17Generator =3D { > + // Generator ID > + CREATE_STD_SMBIOS_TABLE_GEN_ID (EStdSmbiosTableIdType17), > + // Generator Description > + L"SMBIOS.TYPE17.GENERATOR", > + // SMBIOS Table Type > + EFI_SMBIOS_TYPE_MEMORY_DEVICE, > + NULL, > + NULL, > + // Build table function Extended. > + BuildSmbiosType17TableEx, > + // Free function Extended. > + FreeSmbiosType17TableEx > +}; > + > +/** Register the Generator with the SMBIOS Table Factory. > + > + @param [in] ImageHandle The handle to the image. > + @param [in] SystemTable Pointer to the System Table. > + > + @retval EFI_SUCCESS The Generator is registered. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_ALREADY_STARTED The Generator for the Table ID > + is already registered. > +**/ > +EFI_STATUS > +EFIAPI > +SmbiosType17LibConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D RegisterSmbiosTableGenerator (&SmbiosType17Generator); > + DEBUG (( > + DEBUG_INFO, > + "SMBIOS Type 17: Register Generator. Status =3D %r\n", > + Status > + )); > + ASSERT_EFI_ERROR (Status); > + > + return Status; > +} > + > +/** Deregister the Generator from the SMBIOS Table Factory. > + > + @param [in] ImageHandle The handle to the image. > + @param [in] SystemTable Pointer to the System Table. > + > + @retval EFI_SUCCESS The Generator is deregistered. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND The Generator is not registered. > +**/ > +EFI_STATUS > +EFIAPI > +SmbiosType17LibDestructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D DeregisterSmbiosTableGenerator (&SmbiosType17Generator); > + DEBUG (( > + DEBUG_INFO, > + "SMBIOS Type17: Deregister Generator. Status =3D %r\n", > + Status > + )); > + ASSERT_EFI_ERROR (Status); > + return Status; > +} > diff --git a/DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/SmbiosTy= pe17LibArm.inf b/DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/Smbios= Type17LibArm.inf > new file mode 100644 > index 0000000000..78a80b75f0 > --- /dev/null > +++ b/DynamicTablesPkg/Library/Smbios/Arm/SmbiosType17Lib/SmbiosType17Lib= Arm.inf > @@ -0,0 +1,32 @@ > +## @file > +# SMBIOS Type17 Table Generator > +# > +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reser= ved. > +# Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +## > + > +[Defines] > + INF_VERSION =3D 0x0001001B > + BASE_NAME =3D SmbiosType17LibArm > + FILE_GUID =3D 1f063bac-f8f1-4e08-8ffd-9aae52c75497 > + VERSION_STRING =3D 1.0 > + MODULE_TYPE =3D DXE_DRIVER > + LIBRARY_CLASS =3D NULL|DXE_DRIVER > + CONSTRUCTOR =3D SmbiosType17LibConstructor > + DESTRUCTOR =3D SmbiosType17LibDestructor > + > +[Sources] > + SmbiosType17Generator.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + EmbeddedPkg/EmbeddedPkg.dec > + ArmPlatformPkg/ArmPlatformPkg.dec > + DynamicTablesPkg/DynamicTablesPkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib