[edk2-devel] [PATCH] IntelSiliconPkg/VTd: Add DMAR SIDP Table dumpping

Sheng Wei posted 1 patch 1 year, 8 months ago
Failed in applying to current master (apply log)
.../Feature/VTd/IntelVTdDxe/DmarAcpiTable.c   | 72 +++++++++++++++++++
1 file changed, 72 insertions(+)
[edk2-devel] [PATCH] IntelSiliconPkg/VTd: Add DMAR SIDP Table dumpping
Posted by Sheng Wei 1 year, 8 months ago
VT-d spec 4.0 has added a new structure called SIDP which is more
generic to describe special properties of integrated devices.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Jenny Huang <jenny.huang@intel.com>
Cc: Robert Kowalewski <robert.kowalewski@intel.com>
Signed-off-by: Sheng Wei <w.sheng@intel.com>
---
 .../Feature/VTd/IntelVTdDxe/DmarAcpiTable.c   | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c
index 75fbd53ed..42e1b1449 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c
@@ -93,6 +93,10 @@ DumpDmarDeviceScopeEntry (
     "      Length ............................................. 0x%02x\n",
     DmarDeviceScopeEntry->Length
     ));
+  DEBUG ((DEBUG_INFO,
+    "      Flags .............................................. 0x%02x\n",
+    DmarDeviceScopeEntry->Flags
+    ));
   DEBUG ((DEBUG_INFO,
     "      Enumeration ID ..................................... 0x%02x\n",
     DmarDeviceScopeEntry->EnumerationId
@@ -122,6 +126,66 @@ DumpDmarDeviceScopeEntry (
   return;
 }
 
+/**
+  Dump DMAR SIDP table.
+
+  @param[in]  Sidp  DMAR SIDP table
+**/
+VOID
+DumpDmarSidp (
+  IN EFI_ACPI_DMAR_SIDP_HEADER *Sidp
+  )
+{
+  EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER   *DmarDeviceScopeEntry;
+  INTN                                          SidpLen;
+
+  if (Sidp == NULL) {
+    return;
+  }
+
+  DEBUG ((DEBUG_INFO,
+    "  ***************************************************************************\n"
+    ));
+  DEBUG ((DEBUG_INFO,
+    "  *       SoC Integrated Device Property Reporting Structure                *\n"
+    ));
+  DEBUG ((DEBUG_INFO,
+    "  ***************************************************************************\n"
+    ));
+  DEBUG ((DEBUG_INFO,
+    (sizeof(UINTN) == sizeof(UINT64)) ?
+    "  SIDP address ........................................... 0x%016lx\n" :
+    "  SIDP address ........................................... 0x%08x\n",
+    Sidp
+    ));
+  DEBUG ((DEBUG_INFO,
+    "    Type ................................................. 0x%04x\n",
+    Sidp->Header.Type
+    ));
+  DEBUG ((DEBUG_INFO,
+    "    Length ............................................... 0x%04x\n",
+    Sidp->Header.Length
+    ));
+  DEBUG ((DEBUG_INFO,
+    "    Segment Number ....................................... 0x%04x\n",
+    Sidp->SegmentNumber
+    ));
+
+  SidpLen  = Sidp->Header.Length - sizeof(EFI_ACPI_DMAR_SIDP_HEADER);
+  DmarDeviceScopeEntry = (EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER *)(Sidp + 1);
+  while (SidpLen > 0) {
+    DumpDmarDeviceScopeEntry (DmarDeviceScopeEntry);
+    SidpLen -= DmarDeviceScopeEntry->Length;
+    DmarDeviceScopeEntry = (EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER *)((UINTN)DmarDeviceScopeEntry + DmarDeviceScopeEntry->Length);
+  }
+
+  DEBUG ((DEBUG_INFO,
+    "  ***************************************************************************\n\n"
+    ));
+
+  return;
+}
+
 /**
   Dump DMAR SATC table.
 
@@ -472,6 +536,10 @@ DumpDmarDrhd (
     "    Flags ................................................ 0x%02x\n",
     Drhd->Flags
     ));
+  DEBUG ((DEBUG_INFO,
+    "    Size ................................................. 0x%02x\n",
+    Drhd->Size
+    ));
   DEBUG ((DEBUG_INFO,
     "      INCLUDE_PCI_ALL .................................... 0x%02x\n",
     Drhd->Flags & EFI_ACPI_DMAR_DRHD_FLAGS_INCLUDE_PCI_ALL
@@ -583,7 +651,11 @@ DumpAcpiDMAR (
     case EFI_ACPI_DMAR_TYPE_SATC:
       DumpDmarSatc ((EFI_ACPI_DMAR_SATC_HEADER *)DmarHeader);
       break;
+    case EFI_ACPI_DMAR_TYPE_SIDP:
+      DumpDmarSidp ((EFI_ACPI_DMAR_SIDP_HEADER *)DmarHeader);
+      break;
     default:
+      DEBUG ((DEBUG_INFO, "Unknown DMAR Table Type : %d\n", DmarHeader->Type));
       break;
     }
     DmarLen -= DmarHeader->Length;
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92501): https://edk2.groups.io/g/devel/message/92501
Mute This Topic: https://groups.io/mt/93075708/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] IntelSiliconPkg/VTd: Add DMAR SIDP Table dumpping
Posted by Robert Kowalewski 1 year, 8 months ago
Reviewed-by: Robert Kowalewski <robert.kowalewski@intel.com>

-----Original Message-----
From: Sheng, W <w.sheng@intel.com> 
Sent: Wednesday, August 17, 2022 8:20 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Kowalewski, Robert <robert.kowalewski@intel.com>
Subject: [PATCH] IntelSiliconPkg/VTd: Add DMAR SIDP Table dumpping

VT-d spec 4.0 has added a new structure called SIDP which is more generic to describe special properties of integrated devices.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Jenny Huang <jenny.huang@intel.com>
Cc: Robert Kowalewski <robert.kowalewski@intel.com>
Signed-off-by: Sheng Wei <w.sheng@intel.com>
---
 .../Feature/VTd/IntelVTdDxe/DmarAcpiTable.c   | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c
index 75fbd53ed..42e1b1449 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTabl
+++ e.c
@@ -93,6 +93,10 @@ DumpDmarDeviceScopeEntry (
     "      Length ............................................. 0x%02x\n",     DmarDeviceScopeEntry->Length     ));+  DEBUG ((DEBUG_INFO,+    "      Flags .............................................. 0x%02x\n",+    DmarDeviceScopeEntry->Flags+    ));   DEBUG ((DEBUG_INFO,     "      Enumeration ID ..................................... 0x%02x\n",     DmarDeviceScopeEntry->EnumerationId@@ -122,6 +126,66 @@ DumpDmarDeviceScopeEntry (
   return; } +/**+  Dump DMAR SIDP table.++  @param[in]  Sidp  DMAR SIDP table+**/+VOID+DumpDmarSidp (+  IN EFI_ACPI_DMAR_SIDP_HEADER *Sidp+  )+{+  EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER   *DmarDeviceScopeEntry;+  INTN                                          SidpLen;++  if (Sidp == NULL) {+    return;+  }++  DEBUG ((DEBUG_INFO,+    "  ***************************************************************************\n"+    ));+  DEBUG ((DEBUG_INFO,+    "  *       SoC Integrated Device Property Reporting Structure                *\n"+    ));+  DEBUG ((DEBUG_INFO,+    "  ***************************************************************************\n"+    ));+  DEBUG ((DEBUG_INFO,+    (sizeof(UINTN) == sizeof(UINT64)) ?+    "  SIDP address ........................................... 0x%016lx\n" :+    "  SIDP address ........................................... 0x%08x\n",+    Sidp+    ));+  DEBUG ((DEBUG_INFO,+    "    Type ................................................. 0x%04x\n",+    Sidp->Header.Type+    ));+  DEBUG ((DEBUG_INFO,+    "    Length ............................................... 0x%04x\n",+    Sidp->Header.Length+    ));+  DEBUG ((DEBUG_INFO,+    "    Segment Number ....................................... 0x%04x\n",+    Sidp->SegmentNumber+    ));++  SidpLen  = Sidp->Header.Length - sizeof(EFI_ACPI_DMAR_SIDP_HEADER);+  DmarDeviceScopeEntry = (EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER *)(Sidp + 1);+  while (SidpLen > 0) {+    DumpDmarDeviceScopeEntry (DmarDeviceScopeEntry);+    SidpLen -= DmarDeviceScopeEntry->Length;+    DmarDeviceScopeEntry = (EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER *)((UINTN)DmarDeviceScopeEntry + DmarDeviceScopeEntry->Length);+  }++  DEBUG ((DEBUG_INFO,+    "  ***************************************************************************\n\n"+    ));++  return;+}+ /**   Dump DMAR SATC table. @@ -472,6 +536,10 @@ DumpDmarDrhd (
     "    Flags ................................................ 0x%02x\n",     Drhd->Flags     ));+  DEBUG ((DEBUG_INFO,+    "    Size ................................................. 0x%02x\n",+    Drhd->Size+    ));   DEBUG ((DEBUG_INFO,     "      INCLUDE_PCI_ALL .................................... 0x%02x\n",     Drhd->Flags & EFI_ACPI_DMAR_DRHD_FLAGS_INCLUDE_PCI_ALL@@ -583,7 +651,11 @@ DumpAcpiDMAR (
     case EFI_ACPI_DMAR_TYPE_SATC:       DumpDmarSatc ((EFI_ACPI_DMAR_SATC_HEADER *)DmarHeader);       break;+    case EFI_ACPI_DMAR_TYPE_SIDP:+      DumpDmarSidp ((EFI_ACPI_DMAR_SIDP_HEADER *)DmarHeader);+      break;     default:+      DEBUG ((DEBUG_INFO, "Unknown DMAR Table Type : %d\n", DmarHeader->Type));       break;     }     DmarLen -= DmarHeader->Length;-- 
2.26.2.windows.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92539): https://edk2.groups.io/g/devel/message/92539
Mute This Topic: https://groups.io/mt/93075708/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-