Hello Girish,
Thanks for the latest PRs. Unfortunately the freeze window started,
so I won't be able to push them. [1]

In the meantime, I think we are still interested in the SMBIOS
generators for type 9, 38, 39, 41, 43.

Please let us know if we can help in some way.

Regards,
Pierre

[1] https://www.tianocore.org/tianocore-wiki.github.io/releases-history/planning-roadmaps/edk_ii_release_planning.html


On 6/29/26 05:13, Girish Mahadevan wrote:

Hello Sami,

I am hoping to have Type 1 PR setup this week.

Best Regards

Girish

*From:*Sami Mujawar <[email protected]>
*Sent:* Tuesday, June 23, 2026 4:09 AM
*To:* Girish Mahadevan <[email protected]>; [email protected]
*Cc:* Jeff Brasen <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected]; Pierre Gondois <[email protected]>; [email protected]; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]>; Varshit Pandya <[email protected]> *Subject:* Re: [edk2-devel] [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

*External email: Use caution opening links or attachments*

Hi Girish,

We are planning to send out the SMBIOS Type 27 generator sometime this week.

Also a gentle follow-up on the remaining SMBIOS generator PRs. We would be happy to help address any review feedback and progress the patches towards being merged upstream.

When you get a chance, could you please let us know when you expect to be ready to send out the PRs for the other SMBIOS generators on your side?

This will also help us plan the work at our end.

Warm regards,

Sami Mujawar

*From: *Girish Mahadevan <[email protected]>
*Date: *Tuesday, 9 June 2026 at 17:19
*To: *Sami Mujawar <[email protected]>; [email protected] <[email protected]> *Cc: *Jeff Brasen ([email protected]) <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected] <[email protected]>; Pierre Gondois <[email protected]>; [email protected] <[email protected]>; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]> *Subject: *RE: [edk2-devel] [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

Hello Sami,

Thank you/your team for the help to follow through all the changes.

/It would be great if you could start sending PRs for the other SMBIOS generators you have./

Sure ! I will start setting up the other PRs this week.

Best Regards

Girish

*From:* Sami Mujawar <[email protected]>
*Sent:* Monday, June 8, 2026 8:23 AM
*To:* [email protected]; Girish Mahadevan <[email protected]>
*Cc:* Jeff Brasen <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected]; Pierre Gondois <[email protected]>; [email protected]; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]> *Subject:* Re: [edk2-devel] [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

*External email: Use caution opening links or attachments*

Hi Girish,

Thank you for the Type 0, 16, 17, and 19 SMBIOS table generators. These have now been merged upstream into edk2.

It would be great if you could start sending PRs for the other SMBIOS generators you have.

We are planning to start work on the following SMBIOS table generators:

·Memory Device Mapped Address (Type 20)

·System Reset (Type 23)

·Voltage Probe (Type 26)

·Cooling Device (Type 27)

·Temperature Probe (Type 28)

·Electrical Current Probe (Type 29)

·Memory Channel (Type 37)

·Additional Information (Type 40)

·Management Controller Host Interface (Type 42)

·Processor Additional Information (Type 44)

These do not appear in the list of SMBIOS generators you had previously sent. However, please let me know if any of the above overlap with the SMBIOS generators you are already working on, so that we can avoid duplicating effort.

Warm regards,

Sami Mujawar

*From: *[email protected] <[email protected]> on behalf of Sami Mujawar via groups.io <[email protected]>
*Date: *Monday, 11 May 2026 at 21:12
*To: *Girish Mahadevan <[email protected]>
*Cc: *Jeff Brasen ([email protected]) <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected] <[email protected]>; Pierre Gondois <[email protected]>; [email protected] <[email protected]>; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]> *Subject: *Re: [edk2-devel] [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

Hi Girish,

Thanks for sharing this—this is great to see.

We haven’t started work on these tables yet, and we’d definitely welcome getting this support into the edk2 mainline.

Please feel free to start sending pull requests for these generators, and we can work together to get these reviewed and merged.

Warm regards,


Sami Mujawar

*From: *Girish Mahadevan <[email protected]>
*Date: *Monday, 11 May 2026 at 17:21
*To: *Sami Mujawar <[email protected]>
*Cc: *Jeff Brasen ([email protected]) <[email protected]>, Ashish Singhal <[email protected]>, Nick Ramirez <[email protected]>, [email protected] <[email protected]>, Pierre Gondois <[email protected]>, [email protected] <[email protected]>, Samer El-Haj-Mahmoud <[email protected]>, Jose Marinho <[email protected]>, Hemendra Dassanayake <[email protected]>, Bharath Subramanian <[email protected]>, nd <[email protected]> *Subject: *RE: [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

Hello Sami,

Thank you for your help with the generators for Type 0 and the memory related generators.

We’ve written up generators for more tables that we’d be happy to work with you to upstream.

Would you like me to start setting up PRs for these [wasn’t sure if someone was already working on these].

Let me know if you wanted us to start setting up PRs for one or more of these.

These are the generators we have written up:

  Type 1   System Info

  Type 2   Baseboard Info

  Type 3   System Enclosure / Chassis

  Type 8   Port Connector Info

  Type 9   System Slots

  Type 11   OEM Strings

  Type 13   BIOS Language Info

  Type 14   Group Associations

  Type 32   System Boot Info

  Type 38   IPMI Device Info

  Type 39   System Power Supply

  Type 41   Onboard Devices Extended Info

  Type 43   TPM Device

  Type 45   Firmware Inventory Info

Best Regards

Girish

*From:* Sami Mujawar <[email protected]>
*Sent:* Friday, April 17, 2026 1:43 AM
*To:* Girish Mahadevan <[email protected]>
*Cc:* Jeff Brasen <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected]; Pierre Gondois <[email protected]>; [email protected]; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]> *Subject:* Re: [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

*External email: Use caution opening links or attachments*

Hi Girish,

Thanks a lot for submitting the PR.

We will start reviewing the patches.

Regards,

Sami Mujawar

*From: *Girish Mahadevan <[email protected]>
*Date: *Friday, 17 April 2026 at 02:58
*To: *Sami Mujawar <[email protected]>
*Cc: *Jeff Brasen ([email protected]) <[email protected]>, Ashish Singhal <[email protected]>, Nick Ramirez <[email protected]>, [email protected] <[email protected]>, Pierre Gondois <[email protected]>, [email protected] <[email protected]>, Samer El-Haj-Mahmoud <[email protected]>, Jose Marinho <[email protected]>, Hemendra Dassanayake <[email protected]>, Bharath Subramanian <[email protected]>, nd <[email protected]> *Subject: *RE: [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

Hi Sami,

Smbios memory generators by gmahadevan · Pull Request #12474 · tianocore/edk2 <https://github.com/tianocore/edk2/pull/12474>

Best Regards

Girish

*From:* Sami Mujawar <[email protected]>
*Sent:* Tuesday, April 14, 2026 9:01 AM
*To:* Girish Mahadevan <[email protected]>
*Cc:* Jeff Brasen <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected]; Pierre Gondois <[email protected]>; [email protected]; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]> *Subject:* Re: [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

*External email: Use caution opening links or attachments*

Hi Girish,

Thank you for the update.

It would be great if you could push the updated patches by the end of this week.

I look forward to reviewing them.

Warm regards,


Sami Mujawar

*From: *Girish Mahadevan <[email protected]>
*Date: *Tuesday, 14 April 2026 at 15:44
*To: *Sami Mujawar <[email protected]>
*Cc: *Jeff Brasen ([email protected]) <[email protected]>, Ashish Singhal <[email protected]>, Nick Ramirez <[email protected]>, [email protected] <[email protected]>, Pierre Gondois <[email protected]>, [email protected] <[email protected]>, Samer El-Haj-Mahmoud <[email protected]>, Jose Marinho <[email protected]>, Hemendra Dassanayake <[email protected]>, Bharath Subramanian <[email protected]>, nd <[email protected]> *Subject: *RE: [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

Hi Sami,

We made some fixes [based on the spec] that I would like to push .

Give me a couple of days to do this.

Best Regards

Girish

*From:* Sami Mujawar <[email protected]>
*Sent:* Friday, April 10, 2026 9:03 AM
*To:* Girish Mahadevan <[email protected]>
*Cc:* Girish Mahadevan <[email protected]>; Jeff Brasen <[email protected]>; Ashish Singhal <[email protected]>; Nick Ramirez <[email protected]>; [email protected]; Pierre Gondois <[email protected]>; [email protected]; Samer El-Haj-Mahmoud <[email protected]>; Jose Marinho <[email protected]>; Hemendra Dassanayake <[email protected]>; Bharath Subramanian <[email protected]>; nd <[email protected]> *Subject:* Re: [staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

*External email: Use caution opening links or attachments*

Hi Girish,

I just noticed that you had previously posted the SMBIOS Type 16, 17, and 19 generators, but they were never merged.

Would it be okay if we pick up your patches and work towards getting them merged upstream, while preserving your authorship?

Regards,
Sami Mujawar

*From: *Girish Mahadevan <[email protected] <mailto:[email protected]>>
*Date: *Wednesday, 5 February 2025 at 22:09
*To: *Sami Mujawar <[email protected] <mailto:[email protected]>>, Alexei Fedorov <[email protected] <mailto:[email protected]>>, Pierre Gondois <[email protected] <mailto:[email protected]>>, [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>, Samer El-Haj-Mahmoud <[email protected] <mailto:[email protected]>>, Jose Marinho <[email protected] <mailto:[email protected]>> *Cc: *[email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>, Jeff Brasen ([email protected] <mailto:[email protected]>) <[email protected] <mailto:[email protected]>>, [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>, [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>>, [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> *Subject: *[staging/dynamictables-reorg PATCH v0 11/12] DynamicTablesPkg: Smbios Physical Memory Array (Type 16)

Add the Generator library for SMBIOS Table Type 16 - Physical
Memory Array.

Signed-off-by: Girish Mahadevan <[email protected] <mailto:[email protected]>>
Reviewed-by: Jeff Brasen <[email protected] <mailto:[email protected]>>
Reviewed-by: Nick Ramirez <[email protected] <mailto:[email protected]>>
---
 .../SmbiosTableBuilder.c |   3 -
 .../Include/SmbiosNameSpaceObjects.h |  19 +
 .../SmbiosType16Lib/SmbiosType16Generator.c | 361 ++++++++++++++++++
 .../SmbiosType16Lib/SmbiosType16Lib.inf |  35 ++
 4 files changed, 415 insertions(+), 3 deletions(-)
 create mode 100644 DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c  create mode 100644 DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Lib.inf

diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
index bf6e657bcf..f33213f061 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/SmbiosTableBuilder.c
@@ -311,7 +311,6 @@ exit_handler:
     }

   }



-  DEBUG ((DEBUG_ERROR, "%a: Returning %r\n", __FUNCTION__, Status));

   return Status;

 }



@@ -431,7 +430,6 @@ BuildAndInstallSmbiosTable (
       ));

   }



-  DEBUG ((DEBUG_ERROR, "%a: Returning %r\n", __FUNCTION__, Status));

   return Status;

 }



@@ -515,7 +513,6 @@ ProcessSmbiosTables (
       ));

   }



-  DEBUG ((DEBUG_ERROR, "%a: Returning %r\n", __FUNCTION__, Status));

   return Status;

 }



diff --git a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
index e9bde2a712..7e883e1b89 100644
--- a/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/SmbiosNameSpaceObjects.h
@@ -132,6 +132,25 @@ typedef struct {
   SMBIOS_TABLE_GENERATOR_ID    GeneratorId;

 } CONTAINED_CM_OBJECTS;



+/** A structure that describes the Physical Memory Array.

+

+  SMBIOS Specification v3.6.0 Type 16

+

+  ID: ESmbiosObjPhysicalMemoryArray

+**/

+typedef struct CmSmbiosPhysicalMemoryArray {

+  UINT8              Use;

+  UINT8              Location;

+  UINT16             MemoryErrorCorrection;

+  UINT16 MemoryErrorInformationHandle;

+  UINT16             NumberOfMemoryDevices;

+  UINT8 MemoryErrorCorrectionType;

+  UINT64             Size;

+  UINT8              NumMemDevices;

+  CM_OBJECT_TOKEN    MemoryErrInfoToken;

+  CM_OBJECT_TOKEN    PhysMemArrayToken;

+} CM_SMBIOS_PHYSICAL_MEMORY_ARRAY;

+

 #pragma pack()



 #endif // SMBIOS_NAMESPACE_OBJECTS_H_

diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c
new file mode 100644
index 0000000000..37592ee560
--- /dev/null
+++ b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c
@@ -0,0 +1,361 @@
+/** @file

+  SMBIOS Type16 Table Generator.

+

+  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

+  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>

+

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+

+#include <Library/BaseLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/DebugLib.h>

+#include <Library/PrintLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/SmbiosStringTableLib.h>

+

+// Module specific include files.

+#include <ConfigurationManagerObject.h>

+#include <ConfigurationManagerHelper.h>

+#include <Protocol/ConfigurationManagerProtocol.h>

+#include <Protocol/DynamicTableFactoryProtocol.h>

+#include <Protocol/Smbios.h>

+#include <IndustryStandard/SmBios.h>

+

+/** This macro expands to a function that retrieves the Memory Device

+    information from the Configuration Manager.

+*/

+GET_OBJECT_LIST (

+  EObjNameSpaceSmbios,

+  ESmbiosObjPhysicalMemoryArray,

+  CM_SMBIOS_PHYSICAL_MEMORY_ARRAY

+  )

+

+#define EXTENDED_SIZE_THRESHOLD  (SIZE_2TB)

+

+/**

+ * Free any resources allocated when installing SMBIOS Type16 table.

+ *

+ * @param [in]  This                 Pointer to the SMBIOS table generator.

+ * @param [in]  TableFactoryProtocol Pointer to the SMBIOS Table Factory

+ Protocol interface.

+

+ * @param [in]  SmbiosTableInfo      Pointer to the SMBIOS table information.

+ * @param [in]  CfgMgrProtocol       Pointer to the Configuration Manager

+                                     Protocol interface.

+ * @param [in] Table                 Pointer to the SMBIOS table.

+ * @param [in] CmObjectToken         Pointer to the CM ObjectToken Array.

+ * @param [in] TableCount            Number of SMBIOS tables.

+

+ * @retval EFI_SUCCESS            Table generated successfully.

+ * @retval EFI_BAD_BUFFER_SIZE    The size returned by the Configuration

+                                  Manager is less than the Object size for

+                                  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

+FreeSmbiosType16TableEx (

+  IN      CONST SMBIOS_TABLE_GENERATOR *CONST   This,

+  IN      CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST   TableFactoryProtocol,

+  IN      CONST CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST   SmbiosTableInfo,

+  IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST   CfgMgrProtocol,

+  IN SMBIOS_STRUCTURE ***CONST  Table,

+  IN CM_OBJECT_TOKEN **CmObjectToken,

+  IN      CONST UINTN TableCount

+  )

+{

+  UINTN             Index;

+  SMBIOS_STRUCTURE  **TableList;

+

+  TableList = *Table;

+  for (Index = 0; Index < TableCount; Index++) {

+    if (TableList[Index] != NULL) {

+      FreePool (TableList[Index]);

+    }

+  }

+

+  if (*CmObjectToken != NULL) {

+    FreePool (*CmObjectToken);

+  }

+

+  if (TableList != NULL) {

+    FreePool (TableList);

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+ *  Update the Size encoding for Type 16.

+ *

+ *  @param [in]     SizeBytes    Size of the Memory device.

+ *  @param [out]    SmbiosRecord SMBIOS record to update.

+**/

+STATIC

+VOID

+UpdateSmbiosType16Size (

+  IN     UINT64               SizeBytes,

+  IN OUT SMBIOS_TABLE_TYPE16  *SmbiosRecord

+  )

+{

+  UINT64  SizeKb = SizeBytes / SIZE_1KB;

+

+  if (SizeBytes < EXTENDED_SIZE_THRESHOLD) {

+    SmbiosRecord->MaximumCapacity = SizeKb;

+  } else {

+    SmbiosRecord->MaximumCapacity = 0x80000000;

+    SmbiosRecord->ExtendedMaximumCapacity = SizeKb;

+  }

+}

+

+/**

+ *  Add the SMBIOS table handle reference to the Error Tables.

+ *

+ *  @param [in]     TableFactoryProtocol Pointer to the SMBIOS Table Factory.

+ *  @param [in]     CmObjToken             CM Token to lookup..

+ *  @param [out]    SmbiosRecord SMBIOS record to update.

+**/

+STATIC

+VOID

+AddMemErrDeviceHandle (

+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL   *CONST TableFactoryProtocol,

+  IN CM_OBJECT_TOKEN CmObjToken,

+  OUT SMBIOS_TABLE_TYPE16 *SmbiosRecord

+  )

+{

+  EFI_SMBIOS_HANDLE  Handle;

+  SMBIOS_HANDLE_MAP  *HandleMap;

+

+  HandleMap = TableFactoryProtocol->GetSmbiosHandle (CmObjToken);

+  if (HandleMap == NULL) {

+    DEBUG ((DEBUG_ERROR, "%a:Failed to get SMBIOS Handle\n", __FUNCTION__));

+    Handle = 0xFFFF;

+  } else {

+    Handle = HandleMap->SmbiosTblHandle;

+  }

+

+ SmbiosRecord->MemoryErrorInformationHandle = Handle;

+}

+

+/** Construct SMBIOS Type16 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]  TableFactoryProtocol Pointer to the SMBIOS Table Factory

+ *                                   Protocol interface.

+ * @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.

+ * @param [out] CmObjectToken        Pointer to the CM Object Token Array.

+ * @param [out] TableCount           Number of tables installed.

+

+ * @retval EFI_SUCCESS            Table generated successfully.

+ * @retval EFI_BAD_BUFFER_SIZE    The size returned by the Configuration

+ *                                Manager is less than the Object size for

+ *                                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

+BuildSmbiosType16TableEx (

+  IN  CONST SMBIOS_TABLE_GENERATOR *This,

+  IN  CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL   *CONST TableFactoryProtocol,

+  IN CM_STD_OBJ_SMBIOS_TABLE_INFO           *CONST SmbiosTableInfo,

+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL   *CONST CfgMgrProtocol,

+  OUT SMBIOS_STRUCTURE ***Table,

+  OUT CM_OBJECT_TOKEN **CmObjectToken,

+  OUT UINTN                                  *CONST TableCount

+  )

+{

+  EFI_STATUS                       Status;

+  SMBIOS_STRUCTURE **TableList;

+  SMBIOS_TABLE_TYPE16 *SmbiosRecord;

+  CM_OBJECT_TOKEN *CmObjectList;

+  CM_SMBIOS_PHYSICAL_MEMORY_ARRAY *PhysMemoryArray;

+  UINT32                           NumObj;

+  UINTN                            Index;

+

+  ASSERT (This != NULL);

+  ASSERT (SmbiosTableInfo != NULL);

+  ASSERT (CfgMgrProtocol != NULL);

+  ASSERT (Table != NULL);

+  ASSERT (TableCount != NULL);

+  ASSERT (SmbiosTableInfo->TableGeneratorId == This->GeneratorID);

+

+  if ((This == NULL) || (SmbiosTableInfo == NULL) || (CfgMgrProtocol == NULL) ||

+      (Table == NULL) || (TableCount == NULL) ||

+      (SmbiosTableInfo->TableGeneratorId != This->GeneratorID))

+  {

+    DEBUG ((DEBUG_ERROR, "%a:Invalid Paramater\n ", __FUNCTION__));

+    return EFI_INVALID_PARAMETER;

+  }

+

+  *Table = NULL;

+  Status = GetESmbiosObjPhysicalMemoryArray (

+             CfgMgrProtocol,

+             CM_NULL_TOKEN,

+             &PhysMemoryArray,

+             &NumObj

+             );

+  if (EFI_ERROR (Status)) {

+    DEBUG ((

+      DEBUG_ERROR,

+      "%a: Failed to get Memory Devices CM Object %r\n",

+      __FUNCTION__,

+      Status

+      ));

+    return Status;

+  }

+

+  TableList = (SMBIOS_STRUCTURE **)AllocateZeroPool (sizeof (SMBIOS_STRUCTURE *) * NumObj);

+  if (TableList == NULL) {

+    DEBUG ((

+      DEBUG_ERROR,

+      "%a: Failed to alloc memory for %u devices table\n",

+      __FUNCTION__,

+      NumObj

+      ));

+    Status = EFI_OUT_OF_RESOURCES;

+    goto exitBuildSmbiosType16Table;

+  }

+

+  CmObjectList = (CM_OBJECT_TOKEN *)AllocateZeroPool (sizeof (CM_OBJECT_TOKEN *) * NumObj);

+  if (CmObjectList == NULL) {

+    DEBUG ((

+      DEBUG_ERROR,

+      "%a: Failed to alloc memory for %u CM Objects.\n",

+      __FUNCTION__,

+      NumObj

+      ));

+    Status = EFI_OUT_OF_RESOURCES;

+    goto exitBuildSmbiosType16Table;

+  }

+

+  for (Index = 0; Index < NumObj; Index++) {

+    /**

+     * Per Spec each structure is terminated by a double-NULL if there are no

+     * strings.

+     */

+    SmbiosRecord = (SMBIOS_TABLE_TYPE16 *)AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE16) + 1 + 1);

+    if (SmbiosRecord == NULL) {

+      Status = EFI_OUT_OF_RESOURCES;

+      goto exitBuildSmbiosType16Table;

+    }

+

+    UpdateSmbiosType16Size (PhysMemoryArray->Size, SmbiosRecord);

+    SmbiosRecord->Location              = PhysMemoryArray[Index].Location;

+    SmbiosRecord->Use                   = PhysMemoryArray[Index].Use;

+    SmbiosRecord->MemoryErrorCorrection = PhysMemoryArray[Index].MemoryErrorCorrectionType;

+    SmbiosRecord->NumberOfMemoryDevices = PhysMemoryArray->NumMemDevices;

+    if (PhysMemoryArray[Index].MemoryErrInfoToken != CM_NULL_TOKEN) {

+      AddMemErrDeviceHandle (

+        TableFactoryProtocol,

+ PhysMemoryArray[Index].MemoryErrInfoToken,

+        SmbiosRecord

+        );

+    } else {

+ SmbiosRecord->MemoryErrorInformationHandle = 0xFFFF;

+    }

+

+    // Setup the header

+    SmbiosRecord->Hdr.Type   = EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY;

+    SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE16);

+

+    TableList[Index]    = (SMBIOS_STRUCTURE *)SmbiosRecord;

+    CmObjectList[Index] = PhysMemoryArray[Index].PhysMemArrayToken;

+  }

+

+  *Table         = TableList;

+  *CmObjectToken = CmObjectList;

+  *TableCount    = NumObj;

+exitBuildSmbiosType16Table:

+  return Status;

+}

+

+/** The interface for the SMBIOS Type16 Table Generator.

+*/

+STATIC

+CONST

+SMBIOS_TABLE_GENERATOR  SmbiosType16Generator = {

+  // Generator ID

+  CREATE_STD_SMBIOS_TABLE_GEN_ID (EStdSmbiosTableIdType16),

+  // Generator Description

+  L"SMBIOS.TYPE16.GENERATOR",

+  // SMBIOS Table Type

+  EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY,

+  NULL,

+  NULL,

+  // Build table function.

+  BuildSmbiosType16TableEx,

+  // Free function.

+  FreeSmbiosType16TableEx,

+};

+

+/** 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

+SmbiosType16LibConstructor (

+  IN  EFI_HANDLE        ImageHandle,

+  IN  EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  EFI_STATUS  Status;

+

+  Status = RegisterSmbiosTableGenerator (&SmbiosType16Generator);

+  DEBUG ((

+    DEBUG_INFO,

+    "SMBIOS Type 16: Register Generator. Status = %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

+SmbiosType16LibDestructor (

+  IN  EFI_HANDLE        ImageHandle,

+  IN  EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  EFI_STATUS  Status;

+

+  Status = DeregisterSmbiosTableGenerator (&SmbiosType16Generator);

+  DEBUG ((

+    DEBUG_INFO,

+    "SMBIOS Type16: Deregister Generator. Status = %r\n",

+    Status

+    ));

+  ASSERT_EFI_ERROR (Status);

+  return Status;

+}

diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Lib.inf b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Lib.inf
new file mode 100644
index 0000000000..4d85c88d7f
--- /dev/null
+++ b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Lib.inf
@@ -0,0 +1,35 @@
+## @file

+#  SMBIOS Type16 Table Generator

+#

+#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

+#  Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>

+#

+#  SPDX-License-Identifier: BSD-2-Clause-Patent

+##

+

+[Defines]

+  INF_VERSION    = 0x0001001B

+  BASE_NAME      = SmbiosType16LibArm

+  FILE_GUID      = a256956a-de0b-4aa7-8eac-5ce13bbfbb1f

+  VERSION_STRING = 1.0

+  MODULE_TYPE    = DXE_DRIVER

+  LIBRARY_CLASS  = NULL|DXE_DRIVER

+  CONSTRUCTOR    = SmbiosType16LibConstructor

+  DESTRUCTOR     = SmbiosType16LibDestructor

+

+[Sources]

+  SmbiosType16Generator.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  EmbeddedPkg/EmbeddedPkg.dec

+  ArmPlatformPkg/ArmPlatformPkg.dec

+  DynamicTablesPkg/DynamicTablesPkg.dec

+

+[Protocols]

+ gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED

+

+[LibraryClasses]

+  BaseLib

+  DebugLib

--
2.25.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#122064): https://edk2.groups.io/g/devel/message/122064
Mute This Topic: https://groups.io/mt/111022014/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to