Hello Abdul,

On 3/4/24 16:43, Abdul Lateef Attar wrote:
From: Abdul Lateef Attar <abdullateef.at...@amd.com>

Adds generic ACPI WSMT table generator library.
Register/Deregister WSMT table.
Update the WSMT table during boot as per specification.

Cc: Sami Mujawar <sami.muja...@arm.com>
Cc: Pierre Gondois <pierre.gond...@arm.com>
Signed-off-by: Abdul Lateef Attar <abdullateef.at...@amd.com>
---
  DynamicTablesPkg/DynamicTables.dsc.inc        |   2 +
  DynamicTablesPkg/Include/AcpiTableGenerator.h |   1 +
  .../Include/ArchNameSpaceObjects.h            |  10 +
  .../Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf  |  30 +++
  .../Library/Acpi/AcpiWsmtLib/WsmtGenerator.c  | 230 ++++++++++++++++++
  5 files changed, 273 insertions(+)
  create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf
  create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/WsmtGenerator.c


[snip]

+STATIC
+EFI_STATUS
+BuildWsmtTable (
+  IN  CONST ACPI_TABLE_GENERATOR                  *CONST  This,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO            *CONST  AcpiTableInfo,
+  IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  *CONST  CfgMgrProtocol,
+  OUT       EFI_ACPI_DESCRIPTION_HEADER          **CONST  Table
+  )
+{
+  EFI_STATUS                     Status;
+  CM_ARCH_WSMT_PROTECTION_FLAGS  *ProtectionFlags;
+
+  ASSERT (This != NULL);
+  ASSERT (AcpiTableInfo != NULL);
+  ASSERT (CfgMgrProtocol != NULL);
+  ASSERT (Table != NULL);
+  ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
+  ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
+
+  if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
+      (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
+  {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: WSMT: Requested table revision = %d, is not supported."
+      "Supported table revision: Minimum = %d, Maximum = %d\n",
+      AcpiTableInfo->AcpiTableRevision,
+      This->MinAcpiTableRevision,
+      This->AcpiTableRevision
+      ));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  *Table = NULL;
+
+  Status = AddAcpiHeader (
+             CfgMgrProtocol,
+             This,
+             (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt,
+             AcpiTableInfo,
+             sizeof (EFI_ACPI_WSMT_TABLE)
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: WSMT: Failed to add ACPI header. Status = %r\n",
+      Status
+      ));
+    return Status;
+  }
+
+  Status = GetEArchObjWsmtProtectionFlags (
+             CfgMgrProtocol,
+             CM_NULL_TOKEN,
+             &ProtectionFlags,
+             NULL
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: WSMT: Failed to get protection flags information." \
+      " Status = %r\n",
+      Status
+      ));
+  } else {
+    mAcpiWsmt.ProtectionFlags = ProtectionFlags->ProtectionFlags;
+  }

It seems that EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION
bit can only be set if EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS
is set. Maybe this should be checked here.

+
+  *Table = (EFI_ACPI_DESCRIPTION_HEADER *)&mAcpiWsmt;
+
+  return Status;
+}
+

Regards,
Pierre


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116633): https://edk2.groups.io/g/devel/message/116633
Mute This Topic: https://groups.io/mt/104724520/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to