public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guo, Gua" <gua.guo@intel.com>
To: "Hsu, VictorX" <victorx.hsu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Chan, Laura" <laura.chan@intel.com>,
	"Prakashan,
	Krishnadas Veliyathuparambil"
	<krishnadas.veliyathuparambil.prakashan@intel.com>,
	"K N, Karthik" <karthik.k.n@intel.com>
Subject: Re: [PATCH 2/4] MdeModulePkg: Add TraceHubDebugLibSysT library
Date: Tue, 31 Jan 2023 03:17:23 +0000	[thread overview]
Message-ID: <BN9PR11MB5483A8B9777656C966555DDEEFD09@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <e1a28181233a1b83ead2355c8a4dec617a1fbbee.1675131785.git.victorx.hsu@intel.com>

Reviewed-by: Gua Guo <gua.guo@intel.com>

-----Original Message-----
From: Hsu, VictorX <victorx.hsu@intel.com> 
Sent: Tuesday, January 31, 2023 10:49 AM
To: devel@edk2.groups.io
Cc: Hsu, VictorX <victorx.hsu@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Guo, Gua <gua.guo@intel.com>; Chan, Laura <laura.chan@intel.com>; Prakashan, Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com>; K N, Karthik <karthik.k.n@intel.com>
Subject: [PATCH 2/4] MdeModulePkg: Add TraceHubDebugLibSysT library

From: VictorX Hsu <victorx.hsu@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144

This Library provide Trace Hub API which consume MipiSysTLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guo Gua <gua.guo@intel.com>
Cc: Chan Laura <laura.chan@intel.com>
Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com>
Cc: K N Karthik <karthik.k.n@intel.com>
Signed-off-by: VictorX Hsu <victorx.hsu@intel.com>
---
 .../UniversalPayload/TraceHubDebugInfo.h      |  31 ++
 .../BaseTraceHubDebugLibSyst.inf              |  44 ++
 .../BaseTraceHubDebugSystLib.c                | 386 +++++++++++++++
 .../DxeSmmTraceHubDebugLibSyst.inf            |  49 ++
 .../DxeSmmTraceHubDebugSystLib.c              | 462 ++++++++++++++++++
 .../PeiTraceHubDebugLibSyst.inf               |  49 ++
 .../PeiTraceHubDebugSystLib.c                 | 446 +++++++++++++++++
 .../TraceHubDebugLibSysT/TraceHubApiCommon.c  |  81 +++
 .../TraceHubDebugLibSysT/TraceHubApiCommon.h  |  64 +++
 .../TraceHubApiInternal.h                     |  92 ++++
 MdeModulePkg/MdeModulePkg.dec                 |  21 +
 MdeModulePkg/MdeModulePkg.dsc                 |   6 +
 MdeModulePkg/MdeModulePkg.uni                 |  18 +
 13 files changed, 1749 insertions(+)
 create mode 100644 MdeModulePkg/Include/UniversalPayload/TraceHubDebugInfo.h
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugSystLib.c
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugSystLib.c
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugLibSyst.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugSystLib.c
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.c
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.h
 create mode 100644 MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiInternal.h

diff --git a/MdeModulePkg/Include/UniversalPayload/TraceHubDebugInfo.h b/MdeModulePkg/Include/UniversalPayload/TraceHubDebugInfo.h
new file mode 100644
index 0000000000..6c95a85451
--- /dev/null
+++ b/MdeModulePkg/Include/UniversalPayload/TraceHubDebugInfo.h
@@ -0,0 +1,31 @@
+/** @file

+ Define the structure for the Universal Payload TraceHub Debug Info.

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

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

+

+  @par Revision Reference:

+    - Universal Payload Specification 0.9 (https://universalpayload.github.io/documentation/)

+**/

+

+#ifndef UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO_H_

+#define UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO_H_

+

+#include <UniversalPayload/UniversalPayload.h>

+

+typedef struct {

+  BOOLEAN    Flag;         // Flag to enable or disable Trace Hub debug message.

+  UINT8      DebugLevel;   // Debug level for Trace Hub.

+  UINTN      TraceAddress; // MMIO address where Trace Hub debug message output to.

+} TRACEHUB_DEBUG_CONTEXT;

+

+typedef struct {

+  UNIVERSAL_PAYLOAD_GENERIC_HEADER    Header;

+  TRACEHUB_DEBUG_CONTEXT              DebugContext;

+} UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO;

+

+#define UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO_REVISION  1

+

+extern EFI_GUID  gUniversalPayloadTraceHubDebugInfoGuid;

+

+#endif // UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO_H_

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf b/MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf
new file mode 100644
index 0000000000..96ecf9147a
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf
@@ -0,0 +1,44 @@
+## @file

+#  Debug library to output Trace Hub message.

+#  Support SEC/PEI/DXE/SMM phase TraceHub debug message based on fixed settings.

+#

+#  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+#

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

+#

+##

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = BaseTraceHubDebugLibSyst

+  FILE_GUID                      = 336DA571-AD65-423C-9A43-E0056E5B2D8D

+  MODULE_TYPE                    = BASE

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = TraceHubDebugLib

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+# VALID_ARCHITECTURES = IA32 X64

+#

+

+[LibraryClasses]

+  BaseLib

+  PcdLib

+  BaseMemoryLib

+  MipiSysTLib

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+

+[Sources]

+  BaseTraceHubDebugSystLib.c

+  TraceHubApiCommon.c

+  TraceHubApiCommon.h

+  TraceHubApiInternal.h

+

+[Pcd]

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugLevel

+  gEfiMdeModulePkgTokenSpaceGuid.PcdEnableTraceHubDebugMsg

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugAddress

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugSystLib.c b/MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugSystLib.c
new file mode 100644
index 0000000000..b0e99c69a3
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugSystLib.c
@@ -0,0 +1,386 @@
+/** @file

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+

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

+

+**/

+

+#include <Uefi.h>

+#include <Library/BaseLib.h>

+#include <Library/PcdLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/TraceHubDebugLib.h>

+#include <Library/MipiSysTLib.h>

+#include "TraceHubApiCommon.h"

+#include "TraceHubApiInternal.h"

+

+/**

+  Write debug string to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]  Buffer           A pointer to the data buffer.

+  @param[in]  NumberOfBytes    Number of bytes to be written.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubDebugWrite (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT8                    *Buffer,

+  IN UINTN                    NumberOfBytes

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  EFI_STATUS        Status;

+  UINT32            DbgInstCount;

+  UINT16            Index;

+

+  DbgInstCount = 0;

+

+  if ((NumberOfBytes == 0) || (Buffer == NULL)) {

+    //

+    // No data need to be written to Trace Hub

+    //

+    return EFI_ABORTED;

+  }

+

+  Status = MigrateTraceHubHobData ();

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               NULL,

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubDebugType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteDebug (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 (UINT16)NumberOfBytes,

+                 (CHAR8 *)Buffer

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Write catalog status code message to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]  Id               Catalog ID.

+  @param[in]  Guid             Driver Guid.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubWriteCataLog64StatusCode (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT64                   Id,

+  IN EFI_GUID                 *Guid

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  EFI_STATUS        Status;

+  UINT32            DbgInstCount;

+  UINT16            Index;

+

+  DbgInstCount = 0;

+

+  if (Guid == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status = MigrateTraceHubHobData ();

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  //

+  // Convert little endian to big endian.

+  //

+  Status = LittleEndianToBigEndian (Guid);

+  CopyMem (&MipiSystHandle.systh_guid, Guid, sizeof (EFI_GUID));

+  MipiSystHandle.systh_tag.et_guid = 1;

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               NULL,

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubCatalogType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteCatalog (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 Id

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Write catalog message to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType   An error level to decide whether to enable Trace Hub data.

+  @param[in]  Id             Catalog ID.

+  @param[in]  NumberOfParams Number of parameters in argument list.

+  @param[in]  ...            Argument list that pass to Trace Hub.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubWriteCataLog64 (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT64                   Id,

+  IN UINTN                    NumberOfParams,

+  ...

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  VA_LIST           Args;

+  UINTN             Index;

+  EFI_STATUS        Status;

+  UINT32            DbgInstCount;

+

+  DbgInstCount = 0;

+

+  if (NumberOfParams > 6) {

+    //

+    // Message with more than 6 parameter is illegal.

+    //

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status = MigrateTraceHubHobData ();

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle.systh_param_count = (UINT32)NumberOfParams;

+  VA_START (Args, NumberOfParams);

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

+    MipiSystHandle.systh_param[Index] = VA_ARG (Args, UINT32);

+  }

+

+  VA_END (Args);

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               NULL,

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubCatalogType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteCatalog (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 Id

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Get Trace Hub MMIO Address.

+

+  @param[in]      DgbContext        Always NULL.

+  @param[in, out] TraceAddress      Trace Hub MMIO Address.

+

+  @retval EFI_SUCCESS               Get MMIO address successfully.

+  @retval EFI_INVALID_PARAMETER     TraceAddress is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMmioAddress (

+  IN     UINT8  *DgbContext,

+  IN OUT UINTN  *TraceAddress

+  )

+{

+  if (TraceAddress == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  *TraceAddress = FixedPcdGet64 (PcdTraceHubDebugAddress);

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Get visibility of Trace Hub Msg.

+

+  @param[in]      DgbContext      Always NULL.

+  @param[in, out] Flag            Flag to enable or disable Trace Hub message.

+  @param[in, out] DbgLevel        Debug Level of Trace Hub.

+

+  @retval EFI_SUCCESS             Get visibility of Trace Hub Msg successfully.

+  @retval EFI_INVALID_PARAMETER   On entry, Flag or DbgLevel is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMsgVisibility (

+  IN     UINT8    *DgbContext,

+  IN OUT BOOLEAN  *Flag,

+  IN OUT UINT8    *DbgLevel

+  )

+{

+  if ((DbgLevel == NULL) || (Flag == NULL)) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  *DbgLevel = FixedPcdGet8 (PcdTraceHubDebugLevel);

+  *Flag     = FixedPcdGetBool (PcdEnableTraceHubDebugMsg);

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Collect the number of available Trace Hub debug instance.

+

+  @param[in, out]  DbgInstCount   The number of available Trace Hub debug instance.

+

+  @retval EFI_SUCCESS      Collect the number of available Trace Hub debug instance successfully.

+  @retval Other            Failed to collect the number of available Trace Hub debug instance.

+**/

+STATIC

+EFI_STATUS

+CountDebugInstance (

+  IN OUT UINT32  *DbgInstCount

+  )

+{

+  if (DbgInstCount == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  //

+  // 1 for fixed PCD.

+  //

+  *DbgInstCount = 1;

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Allocate boot time pool memory to store Trace Hub HOB data.

+

+  @retval  EFI_SUCCESS   Migration process is successful.

+  @retval  Other         Migration process is unsuccessful

+**/

+STATIC

+EFI_STATUS

+MigrateTraceHubHobData (

+  VOID

+  )

+{

+  return EFI_UNSUPPORTED;

+}

+

+/**

+  Check whether to output Tracr Hub message.

+

+  @param[in, out]  MipiSystHandle   A pointer to MIPI_SYST_HANDLE structure.

+  @param[in, out]  DgbContext       Always NULL.

+  @param[in]       SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]       PrintType        Either catalog print or debug print.

+

+  @retval EFI_SUCCESS      Current Trace Hub message need to be processed.

+  @retval Other            Current Trace Hub message no need to be processed.

+**/

+STATIC

+EFI_STATUS

+CheckWhetherToOutputMsg (

+  IN OUT MIPI_SYST_HANDLE         *MipiSystHandle,

+  IN OUT UINT8                    *DgbContext,

+  IN     TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN     TRACEHUB_PRINTTYPE       PrintType

+  )

+{

+  EFI_STATUS  Status;

+  UINTN       Addr;

+  UINT8       DbgLevel;

+  BOOLEAN     Flag;

+

+  if (MipiSystHandle == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (PrintType == TraceHubDebugType) {

+    Status = GetTraceHubMsgVisibility (NULL, &Flag, &DbgLevel);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    if (!EnableTraceHubData (Flag, DbgLevel, SeverityType)) {

+      return EFI_ABORTED;

+    }

+  }

+

+  Status = GetTraceHubMmioAddress (NULL, &Addr);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr = Addr;

+  if (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr == 0) {

+    return EFI_ABORTED;

+  }

+

+  return EFI_SUCCESS;

+}

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf b/MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf
new file mode 100644
index 0000000000..d5bc316083
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf
@@ -0,0 +1,49 @@
+## @file

+#  Debug library to output Trace Hub message.

+#  Support DXE/SMM phase TraceHub debug message based on dynamic settings.

+#

+#  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+#

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

+#

+##

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = DxeSmmTraceHubDebugLibSyst

+  FILE_GUID                      = A9B7B825-7902-4616-8556-085DA4DFEC72

+  MODULE_TYPE                    = DXE_DRIVER

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = TraceHubDebugLib|DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER DXE_DRIVER DXE_CORE UEFI_DRIVER UEFI_APPLICATION

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+# VALID_ARCHITECTURES = IA32 X64

+#

+

+[LibraryClasses]

+  BaseLib

+  PcdLib

+  HobLib

+  BaseMemoryLib

+  MemoryAllocationLib

+  MipiSysTLib

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+

+[Sources]

+  DxeSmmTraceHubDebugSystLib.c

+  TraceHubApiCommon.c

+  TraceHubApiCommon.h

+  TraceHubApiInternal.h

+

+[Guids]

+  gUniversalPayloadTraceHubDebugInfoGuid

+

+[Pcd]

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugLevel

+  gEfiMdeModulePkgTokenSpaceGuid.PcdEnableTraceHubDebugMsg

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugAddress

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugSystLib.c b/MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugSystLib.c
new file mode 100644
index 0000000000..d81abd2c97
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugSystLib.c
@@ -0,0 +1,462 @@
+/** @file

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+

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

+

+**/

+

+#include <Uefi.h>

+#include <Library/BaseLib.h>

+#include <Library/PcdLib.h>

+#include <Library/HobLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/TraceHubDebugLib.h>

+#include <Library/MipiSysTLib.h>

+#include <UniversalPayload/TraceHubDebugInfo.h>

+#include "TraceHubApiCommon.h"

+#include "TraceHubApiInternal.h"

+

+GLOBAL_REMOVE_IF_UNREFERENCED UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO  *mThDebugInstArray = NULL;

+GLOBAL_REMOVE_IF_UNREFERENCED UINT32                                 mDbgInstCount      = 0;

+

+/**

+  Write debug string to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]  Buffer           A pointer to the data buffer.

+  @param[in]  NumberOfBytes    Number of bytes to be written.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubDebugWrite (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT8                    *Buffer,

+  IN UINTN                    NumberOfBytes

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  EFI_STATUS        Status;

+  UINT16            Index;

+  UINT32            DbgInstCount;

+

+  DbgInstCount = 0;

+

+  if ((NumberOfBytes == 0) || (Buffer == NULL)) {

+    //

+    // No data need to be written to Trace Hub

+    //

+    return EFI_ABORTED;

+  }

+

+  Status = MigrateTraceHubHobData ();

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               (UINT8 *)&mThDebugInstArray[Index],

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubDebugType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteDebug (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 (UINT16)NumberOfBytes,

+                 (CHAR8 *)Buffer

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Write catalog status code message to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]  Id               Catalog ID.

+  @param[in]  Guid             Driver Guid.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubWriteCataLog64StatusCode (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT64                   Id,

+  IN EFI_GUID                 *Guid

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  UINTN             Index;

+  EFI_STATUS        Status;

+  UINT32            DbgInstCount;

+

+  DbgInstCount = 0;

+

+  Status = MigrateTraceHubHobData ();

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (Guid != NULL) {

+    //

+    // Convert little endian to big endian.

+    //

+    Status = LittleEndianToBigEndian (Guid);

+    CopyMem (&MipiSystHandle.systh_guid, Guid, sizeof (EFI_GUID));

+    MipiSystHandle.systh_tag.et_guid = 1;

+  } else {

+    MipiSystHandle.systh_tag.et_modunit = 2;

+    MipiSystHandle.systh_tag.et_guid    = 0;

+  }

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               (UINT8 *)&mThDebugInstArray[Index],

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubCatalogType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteCatalog (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 Id

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Write catalog message to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType   An error level to decide whether to enable Trace Hub data.

+  @param[in]  Id             Catalog ID.

+  @param[in]  NumberOfParams Number of parameters in argument list.

+  @param[in]  ...            Argument list that pass to Trace Hub.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubWriteCataLog64 (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT64                   Id,

+  IN UINTN                    NumberOfParams,

+  ...

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  VA_LIST           Args;

+  UINTN             Index;

+  EFI_STATUS        Status;

+  UINT32            DbgInstCount;

+

+  DbgInstCount = 0;

+

+  if (NumberOfParams > 6) {

+    //

+    // Message with more than 6 parameter is illegal.

+    //

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status = MigrateTraceHubHobData ();

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle.systh_param_count = (UINT32)NumberOfParams;

+  VA_START (Args, NumberOfParams);

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

+    MipiSystHandle.systh_param[Index] = VA_ARG (Args, UINT32);

+  }

+

+  VA_END (Args);

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               (UINT8 *)&mThDebugInstArray[Index],

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubCatalogType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteCatalog (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 Id

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Collect the number of available Trace Hub debug instance.

+

+  @param[in, out]  DbgInstCount   The number of available Trace Hub debug instance.

+

+  @retval EFI_SUCCESS      Collect the number of available Trace Hub debug instance successfully.

+  @retval Other            Failed to collect the number of available Trace Hub debug instance.

+**/

+STATIC

+EFI_STATUS

+CountDebugInstance (

+  IN OUT UINT32  *DbgInstCount

+  )

+{

+  UINT8  *DgbContext;

+

+  if (DbgInstCount == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (mThDebugInstArray == NULL) {

+    DgbContext = (UINT8 *)GetFirstGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid);

+    if (DgbContext != NULL) {

+      while (DgbContext != NULL) {

+        (*DbgInstCount)++;

+        DgbContext = (UINT8 *)GetNextGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid, GET_NEXT_HOB (DgbContext));

+      }

+    } else {

+      //

+      // Trace Hub debug instance for PCD

+      //

+      (*DbgInstCount)++;

+    }

+  } else {

+    *DbgInstCount = mDbgInstCount;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Check whether to output Tracr Hub message.

+

+  @param[in, out]  MipiSystHandle   A pointer to MIPI_SYST_HANDLE structure.

+  @param[in, out]  DgbContext       A pointer to Trace Hub debug instance.

+  @param[in]       SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]       PrintType        Either catalog print or debug print.

+

+  @retval EFI_SUCCESS      Current Trace Hub message need to be processed.

+  @retval Other            Current Trace Hub message no need to be processed.

+**/

+STATIC

+EFI_STATUS

+CheckWhetherToOutputMsg (

+  IN OUT MIPI_SYST_HANDLE         *MipiSystHandle,

+  IN OUT UINT8                    *DgbContext,

+  IN     TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN     TRACEHUB_PRINTTYPE       PrintType

+  )

+{

+  UINT8       DbgLevel;

+  BOOLEAN     Flag;

+  UINTN       Addr;

+  EFI_STATUS  Status;

+

+  if ((MipiSystHandle == NULL) || (DgbContext == NULL)) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (PrintType == TraceHubDebugType) {

+    Status = GetTraceHubMsgVisibility (DgbContext, &Flag, &DbgLevel);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    if (!EnableTraceHubData (Flag, DbgLevel, SeverityType)) {

+      return EFI_ABORTED;

+    }

+  }

+

+  Status = GetTraceHubMmioAddress (DgbContext, &Addr);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr = Addr;

+  if (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr == 0) {

+    return EFI_ABORTED;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Get Trace Hub MMIO Address.

+

+  @param[in]      DgbContext        A pointer to Trace Hub debug instance.

+  @param[in, out] TraceAddress      Trace Hub MMIO Address.

+

+  @retval EFI_SUCCESS               Get MMIO address successfully.

+  @retval EFI_INVALID_PARAMETER     TraceAddress or DgbContext is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMmioAddress (

+  IN     UINT8  *DgbContext,

+  IN OUT UINTN  *TraceAddress

+  )

+{

+  UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO  *ThDbgContext;

+

+  if ((DgbContext == NULL) || (TraceAddress == NULL)) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  ThDbgContext  = (UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO *)DgbContext;

+  *TraceAddress = ThDbgContext->DebugContext.TraceAddress;

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Get visibility of Trace Hub Msg.

+

+  @param[in]      DgbContext      A pointer to Trace Hub debug instance.

+  @param[in, out] Flag            Flag to enable or disable Trace Hub message.

+  @param[in, out] DbgLevel        Debug Level of Trace Hub.

+

+  @retval EFI_SUCCESS             Get visibility of Trace Hub Msg successfully.

+  @retval EFI_INVALID_PARAMETER   On entry, DgbContext or Flag or DbgLevel is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMsgVisibility (

+  IN     UINT8    *DgbContext,

+  IN OUT BOOLEAN  *Flag,

+  IN OUT UINT8    *DbgLevel

+  )

+{

+  UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO  *ThDbgContext;

+

+  if ((DgbContext == NULL) || (Flag == NULL) || (DbgLevel == NULL)) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  ThDbgContext = (UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO *)DgbContext;

+  *Flag        = ThDbgContext->DebugContext.Flag;

+  *DbgLevel    = ThDbgContext->DebugContext.DebugLevel;

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Allocate boot time pool memory to store Trace Hub HOB data.

+

+  @retval  EFI_SUCCESS   Migration process is successful.

+  @retval  Other         Migration process is unsuccessful

+**/

+STATIC

+EFI_STATUS

+MigrateTraceHubHobData (

+  VOID

+  )

+{

+  UINT8       *DgbContext;

+  UINT16      Index;

+  UINT32      DbgInstCount;

+  EFI_STATUS  Status;

+

+  Index        = 0;

+  DgbContext   = NULL;

+  DbgInstCount = 0;

+

+  if (mThDebugInstArray == NULL) {

+    Status = CountDebugInstance (&DbgInstCount);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    mDbgInstCount = DbgInstCount;

+    if (mDbgInstCount != 0) {

+      mThDebugInstArray = AllocateZeroPool (sizeof (UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO) * mDbgInstCount);

+      if (mThDebugInstArray == NULL) {

+        return EFI_OUT_OF_RESOURCES;

+      }

+

+      DgbContext = GetFirstGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid);

+      if (DgbContext != NULL) {

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

+          CopyMem (&mThDebugInstArray[Index], GET_GUID_HOB_DATA (DgbContext), sizeof (UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO));

+          DgbContext = GetNextGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid, GET_NEXT_HOB (DgbContext));

+        }

+      } else {

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

+          mThDebugInstArray[Index].DebugContext.TraceAddress = FixedPcdGet64 (PcdTraceHubDebugAddress);

+          mThDebugInstArray[Index].DebugContext.Flag         = FixedPcdGetBool (PcdEnableTraceHubDebugMsg);

+          mThDebugInstArray[Index].DebugContext.DebugLevel   = FixedPcdGet8 (PcdTraceHubDebugLevel);

+        }

+      }

+    } else {

+      return EFI_ABORTED;

+    }

+  }

+

+  return EFI_SUCCESS;

+}

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugLibSyst.inf b/MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugLibSyst.inf
new file mode 100644
index 0000000000..4f4bfb695b
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugLibSyst.inf
@@ -0,0 +1,49 @@
+## @file

+#  Debug library to output Trace Hub message.

+#  Support PEI phase TraceHub debug message based on dynamic settings

+#

+#  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+#

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

+#

+##

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = PeiTraceHubDebugLibSyst

+  FILE_GUID                      = C61E8C2E-0935-4E3D-BCBB-5ED84AFD9FD1

+  MODULE_TYPE                    = PEIM

+  VERSION_STRING                 = 1.0

+  LIBRARY_CLASS                  = TraceHubDebugLib|PEI_CORE PEIM

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+# VALID_ARCHITECTURES = IA32 X64

+#

+

+[LibraryClasses]

+  BaseLib

+  PcdLib

+  HobLib

+  BaseMemoryLib

+  MemoryAllocationLib

+  MipiSysTLib

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+

+[Sources]

+  PeiTraceHubDebugSystLib.c

+  TraceHubApiCommon.c

+  TraceHubApiCommon.h

+  TraceHubApiInternal.h

+

+[Guids]

+  gUniversalPayloadTraceHubDebugInfoGuid

+

+[Pcd]

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugLevel

+  gEfiMdeModulePkgTokenSpaceGuid.PcdEnableTraceHubDebugMsg

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugAddress

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugSystLib.c b/MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugSystLib.c
new file mode 100644
index 0000000000..10bde71fd3
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugSystLib.c
@@ -0,0 +1,446 @@
+/** @file

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+

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

+

+**/

+

+#include <Uefi.h>

+#include <Library/BaseLib.h>

+#include <Library/PcdLib.h>

+#include <Library/HobLib.h>

+#include <Library/BaseMemoryLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <Library/TraceHubDebugLib.h>

+#include <Library/MipiSysTLib.h>

+#include <UniversalPayload/TraceHubDebugInfo.h>

+#include "TraceHubApiCommon.h"

+#include "TraceHubApiInternal.h"

+

+/**

+  Write debug string to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]  Buffer           A pointer to the data buffer.

+  @param[in]  NumberOfBytes    Number of bytes to be written.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubDebugWrite (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT8                    *Buffer,

+  IN UINTN                    NumberOfBytes

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  EFI_STATUS        Status;

+  UINT8             *DgbContext;

+  UINTN             Index;

+  UINT32            DbgInstCount;

+

+  DbgInstCount = 0;

+

+  if ((NumberOfBytes == 0) || (Buffer == NULL)) {

+    //

+    // No data need to be written to Trace Hub

+    //

+    return EFI_ABORTED;

+  }

+

+  Status = MigrateTraceHubHobData ();

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  DgbContext = (UINT8 *)GetFirstGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid);

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               DgbContext,

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubDebugType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteDebug (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 (UINT16)NumberOfBytes,

+                 (CHAR8 *)Buffer

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+

+    if (DgbContext != NULL) {

+      DgbContext = (UINT8 *)GetNextGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid, GET_NEXT_HOB (DgbContext));

+      if (DgbContext == NULL) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Write catalog status code message to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]  Id               Catalog ID.

+  @param[in]  Guid             Driver Guid.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubWriteCataLog64StatusCode (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT64                   Id,

+  IN EFI_GUID                 *Guid

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  UINT32            DbgInstCount;

+  UINT8             *DgbContext;

+  EFI_STATUS        Status;

+  UINTN             Index;

+

+  DbgInstCount = 0;

+

+  Status = MigrateTraceHubHobData ();

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  if (Guid != NULL) {

+    //

+    // Convert little endian to big endian.

+    //

+    Status = LittleEndianToBigEndian (Guid);

+    CopyMem (&MipiSystHandle.systh_guid, Guid, sizeof (EFI_GUID));

+    MipiSystHandle.systh_tag.et_guid = 1;

+  } else {

+    MipiSystHandle.systh_tag.et_modunit = 2;

+    MipiSystHandle.systh_tag.et_guid    = 0;

+  }

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  DgbContext = (UINT8 *)GetFirstGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid);

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               DgbContext,

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubCatalogType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteCatalog (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 Id

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+

+    if (DgbContext != NULL) {

+      DgbContext = (UINT8 *)GetNextGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid, GET_NEXT_HOB (DgbContext));

+      if (DgbContext == NULL) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Write catalog message to specified Trace Hub MMIO address.

+

+  @param[in]  SeverityType   An error level to decide whether to enable Trace Hub data.

+  @param[in]  Id             Catalog ID.

+  @param[in]  NumberOfParams Number of parameters in argument list.

+  @param[in]  ...            Argument list that pass to Trace Hub.

+

+  @retval EFI_SUCCESS      Data was written to Trace Hub.

+  @retval Other            Failed to output Trace Hub message.

+**/

+EFI_STATUS

+EFIAPI

+TraceHubWriteCataLog64 (

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN UINT64                   Id,

+  IN UINTN                    NumberOfParams,

+  ...

+  )

+{

+  MIPI_SYST_HANDLE  MipiSystHandle;

+  MIPI_SYST_HEADER  MipiSystHeader;

+  VA_LIST           Args;

+  UINTN             Index;

+  UINT32            DbgInstCount;

+  UINT8             *DgbContext;

+  EFI_STATUS        Status;

+

+  DbgInstCount = 0;

+

+  if (NumberOfParams > 6) {

+    //

+    // Message with more than 6 parameter is illegal.

+    //

+    return EFI_INVALID_PARAMETER;

+  }

+

+  Status = MigrateTraceHubHobData ();

+

+  MipiSystHandle.systh_header = &MipiSystHeader;

+

+  Status = InitMipiSystHandle (&MipiSystHandle);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle.systh_param_count = (UINT32)NumberOfParams;

+  VA_START (Args, NumberOfParams);

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

+    MipiSystHandle.systh_param[Index] = VA_ARG (Args, UINT32);

+  }

+

+  VA_END (Args);

+

+  Status = CountDebugInstance (&DbgInstCount);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  DgbContext = (UINT8 *)GetFirstGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid);

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

+    Status = CheckWhetherToOutputMsg (

+               &MipiSystHandle,

+               DgbContext,

+               (MIPI_SYST_SEVERITY)SeverityType,

+               TraceHubCatalogType

+               );

+    if (!EFI_ERROR (Status)) {

+      Status = MipiSystWriteCatalog (

+                 &MipiSystHandle,

+                 (MIPI_SYST_SEVERITY)SeverityType,

+                 Id

+                 );

+      if (EFI_ERROR (Status)) {

+        break;

+      }

+    }

+

+    if (DgbContext != NULL) {

+      DgbContext = (UINT8 *)GetNextGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid, GET_NEXT_HOB (DgbContext));

+      if (DgbContext == NULL) {

+        break;

+      }

+    }

+  }

+

+  return Status;

+}

+

+/**

+  Collect the number of available Trace Hub debug instance.

+

+  @param[in, out]  DbgInstCount   The number of available Trace Hub debug instance.

+

+  @retval EFI_SUCCESS      Collect the number of available Trace Hub debug instance successfully.

+  @retval Other            Failed to collect the number of available Trace Hub debug instance.

+**/

+STATIC

+EFI_STATUS

+CountDebugInstance (

+  IN OUT UINT32  *DbgInstCount

+  )

+{

+  UINT8  *DgbContext;

+

+  if (DbgInstCount == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  DgbContext = (UINT8 *)GetFirstGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid);

+  if (DgbContext != NULL) {

+    while (DgbContext != NULL) {

+      (*DbgInstCount)++;

+      DgbContext = (UINT8 *)GetNextGuidHob (&gUniversalPayloadTraceHubDebugInfoGuid, GET_NEXT_HOB (DgbContext));

+    }

+  } else {

+    //

+    // Trace Hub debug instance for PCD

+    //

+    (*DbgInstCount)++;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Check whether to output Tracr Hub message.

+

+  @param[in, out]  MipiSystHandle   A pointer to MIPI_SYST_HANDLE structure.

+  @param[in, out]  DgbContext       A pointer to Trace Hub debug instance. NULL is acceptable.

+  @param[in]       SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]       PrintType        Either catalog print or debug print.

+

+  @retval EFI_SUCCESS      Current Trace Hub message need to be processed.

+  @retval Other            Current Trace Hub message no need to be processed.

+**/

+STATIC

+EFI_STATUS

+CheckWhetherToOutputMsg (

+  IN OUT MIPI_SYST_HANDLE         *MipiSystHandle,

+  IN OUT UINT8                    *DgbContext,

+  IN     TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN     TRACEHUB_PRINTTYPE       PrintType

+  )

+{

+  EFI_STATUS  Status;

+  UINTN       Addr;

+  UINT8       DbgLevel;

+  BOOLEAN     Flag;

+

+  if (MipiSystHandle == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (PrintType == TraceHubDebugType) {

+    Status = GetTraceHubMsgVisibility (DgbContext, &Flag, &DbgLevel);

+    if (EFI_ERROR (Status)) {

+      return Status;

+    }

+

+    if (!EnableTraceHubData (Flag, DbgLevel, SeverityType)) {

+      return EFI_ABORTED;

+    }

+  }

+

+  Status = GetTraceHubMmioAddress (DgbContext, &Addr);

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr = Addr;

+  if (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr == 0) {

+    return EFI_ABORTED;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Get Trace Hub MMIO Address.

+

+  @param[in]      DgbContext        A pointer to Trace Hub debug instance. NULL is acceptable.

+  @param[in, out] TraceAddress      Trace Hub MMIO Address.

+

+  @retval EFI_SUCCESS               Get MMIO address successfully.

+  @retval EFI_INVALID_PARAMETER     TraceAddress is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMmioAddress (

+  IN     UINT8  *DgbContext,

+  IN OUT UINTN  *TraceAddress

+  )

+{

+  UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO  *ThDebugInfo;

+

+  ThDebugInfo = NULL;

+

+  if (TraceAddress == NULL) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (DgbContext != NULL) {

+    ThDebugInfo   = GET_GUID_HOB_DATA (DgbContext);

+    *TraceAddress = ThDebugInfo->DebugContext.TraceAddress;

+  } else {

+    *TraceAddress = FixedPcdGet64 (PcdTraceHubDebugAddress);

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Get visibility of Trace Hub Msg.

+

+  @param[in]      DgbContext      A pointer to Trace Hub debug instance. NULL is acceptable.

+  @param[in, out] Flag            Flag to enable or disable Trace Hub message.

+  @param[in, out] DbgLevel        Debug Level of Trace Hub.

+

+  @retval EFI_SUCCESS             Get visibility of Trace Hub Msg successfully.

+  @retval EFI_INVALID_PARAMETER   On entry, Flag or DbgLevel is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMsgVisibility (

+  IN     UINT8    *DgbContext,

+  IN OUT BOOLEAN  *Flag,

+  IN OUT UINT8    *DbgLevel

+  )

+{

+  UNIVERSAL_PAYLOAD_TRACEHUB_DEBUG_INFO  *ThDebugInfo;

+

+  ThDebugInfo = NULL;

+

+  if ((DbgLevel == NULL) || (Flag == NULL)) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (DgbContext != NULL) {

+    ThDebugInfo = GET_GUID_HOB_DATA (DgbContext);

+    *DbgLevel   = ThDebugInfo->DebugContext.DebugLevel;

+    *Flag       = ThDebugInfo->DebugContext.Flag;

+  } else {

+    *DbgLevel = FixedPcdGet8 (PcdTraceHubDebugLevel);

+    *Flag     = FixedPcdGetBool (PcdEnableTraceHubDebugMsg);

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Allocate boot time pool memory to store Trace Hub HOB data.

+

+  @retval  EFI_SUCCESS   Migration process is successful.

+  @retval  Other         Migration process is unsuccessful

+**/

+STATIC

+EFI_STATUS

+MigrateTraceHubHobData (

+  VOID

+  )

+{

+  return EFI_UNSUPPORTED;

+}

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.c b/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.c
new file mode 100644
index 0000000000..0e7a09c95e
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.c
@@ -0,0 +1,81 @@
+/** @file

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+

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

+

+**/

+

+#include <Uefi.h>

+#include <Library/BaseLib.h>

+#include <Library/BaseMemoryLib.h>

+#include "TraceHubApiCommon.h"

+

+/**

+  Determine whether to enable Trace Hub message.

+

+  @param[in]  Flag            Flag to enable or disable Trace Hub message.

+  @param[in]  DbgLevel        Debug Level of Trace Hub.

+  @param[in]  SeverityType    Severity type of input message.

+

+  @retval TRUE            Enable trace hub message.

+  @retval FALSE           Disable trace hub message.

+**/

+BOOLEAN

+EFIAPI

+EnableTraceHubData (

+  IN BOOLEAN                  Flag,

+  IN UINT8                    DbgLevel,

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType

+  )

+{

+  if (Flag == TraceHubRoutingDisable) {

+    return FALSE;

+  }

+

+  if (DbgLevel == TraceHubDebugLevelError) {

+    if (((SeverityType == SeverityFatal) || (SeverityType == SeverityError))) {

+      return TRUE;

+    }

+  } else if (DbgLevel == TraceHubDebugLevelErrorWarning) {

+    if (((SeverityType == SeverityFatal) || (SeverityType == SeverityError) || (SeverityType == SeverityWarning))) {

+      return TRUE;

+    }

+  } else if (DbgLevel == TraceHubDebugLevelErrorWarningInfo) {

+    if (((SeverityType == SeverityFatal) || (SeverityType == SeverityError) || (SeverityType == SeverityWarning) || (SeverityType == SeverityNormal))) {

+      return TRUE;

+    }

+  } else if (DbgLevel == TraceHubDebugLevelErrorWarningInfoVerbose) {

+    return TRUE;

+  }

+

+  return FALSE;

+}

+

+/**

+  Convert GUID from little endian to big endian.

+

+  @param[in, out]  Guid   GUID in little endian format on entry. GUID in big endian format on exit.

+

+  @retval EFI_SUCCESS      Convert GUID successfully.

+**/

+EFI_STATUS

+EFIAPI

+LittleEndianToBigEndian (

+  IN OUT EFI_GUID  *Guid

+  )

+{

+  EFI_GUID  TempGuid;

+  UINT64    GuidData4;

+

+  ZeroMem (&TempGuid, sizeof (EFI_GUID));

+  TempGuid.Data1 = SwapBytes32 (Guid->Data1);

+  TempGuid.Data2 = SwapBytes16 (Guid->Data2);

+  TempGuid.Data3 = SwapBytes16 (Guid->Data3);

+  CopyMem (&GuidData4, Guid->Data4, sizeof (Guid->Data4));

+  GuidData4 = SwapBytes64 (GuidData4);

+  CopyMem (TempGuid.Data4, &GuidData4, sizeof (GuidData4));

+  CopyMem (Guid, &TempGuid, sizeof (EFI_GUID));

+

+  return EFI_SUCCESS;

+}

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.h b/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.h
new file mode 100644
index 0000000000..f2f3cda8b7
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiCommon.h
@@ -0,0 +1,64 @@
+/** @file

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+

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

+

+**/

+

+#ifndef TRACE_HUB_API_COMMON_H_

+#define TRACE_HUB_API_COMMON_H_

+

+#include <Library/TraceHubDebugLib.h>

+

+typedef enum {

+  TraceHubDebugType = 0,

+  TraceHubCatalogType

+} TRACEHUB_PRINTTYPE;

+

+typedef enum {

+  TraceHubRoutingDisable = 0,

+  TraceHubRoutingEnable,

+  TraceHubRoutingMax

+} TRACE_HUB_ROUTING;

+

+typedef enum {

+  TraceHubDebugLevelError = 0,

+  TraceHubDebugLevelErrorWarning,

+  TraceHubDebugLevelErrorWarningInfo,

+  TraceHubDebugLevelErrorWarningInfoVerbose,

+  TraceHubDebugLevelMax

+} TRACE_HUB_DEBUG_LEVEL;

+

+/**

+  Determine whether to enable Trace Hub message.

+

+  @param[in]  Flag            Flag to enable or disable Trace Hub message.

+  @param[in]  DbgLevel        Debug Level of Trace Hub.

+  @param[in]  SeverityType    Severity type of input message.

+

+  @retval TRUE            Enable trace hub message.

+  @retval FALSE           Disable trace hub message.

+**/

+BOOLEAN

+EFIAPI

+EnableTraceHubData (

+  IN BOOLEAN                  Flag,

+  IN UINT8                    DbgLevel,

+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType

+  );

+

+/**

+  Convert GUID from little endian to big endian.

+

+  @param[in, out]  Guid   GUID in little endian format on entry. GUID in big endian format on exit.

+

+  @retval EFI_SUCCESS      Convert GUID successfully.

+**/

+EFI_STATUS

+EFIAPI

+LittleEndianToBigEndian (

+  IN OUT EFI_GUID  *Guid

+  );

+

+#endif // TRACE_HUB_API_COMMON_H_

diff --git a/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiInternal.h b/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiInternal.h
new file mode 100644
index 0000000000..23a9879316
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugLibSysT/TraceHubApiInternal.h
@@ -0,0 +1,92 @@
+/** @file

+

+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>

+

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

+

+**/

+

+#ifndef TRACE_HUB_API_INTERNAL_H_

+#define TRACE_HUB_API_INTERNAL_H_

+

+/**

+  Collect the number of available Trace Hub debug instance.

+

+  @param[in, out]  DbgInstCount   The number of available Trace Hub debug instance.

+

+  @retval EFI_SUCCESS      Collect the number of available Trace Hub debug instance successfully.

+  @retval Other            Failed to collect the number of available Trace Hub debug instance.

+**/

+STATIC

+EFI_STATUS

+CountDebugInstance (

+  IN OUT UINT32  *DbgInstCount

+  );

+

+/**

+  Check whether to output Tracr Hub message.

+

+  @param[in, out]  MipiSystHandle   A pointer to MIPI_SYST_HANDLE structure.

+  @param[in, out]  DgbContext       A pointer to Trace Hub debug instance.

+  @param[in]       SeverityType     An error level to decide whether to enable Trace Hub data.

+  @param[in]       PrintType        Either catalog print or debug print.

+

+  @retval EFI_SUCCESS      Current Trace Hub message need to be processed.

+  @retval Other            Current Trace Hub message no need to be processed.

+**/

+STATIC

+EFI_STATUS

+CheckWhetherToOutputMsg (

+  IN OUT MIPI_SYST_HANDLE         *MipiSystHandle,

+  IN OUT UINT8                    *DgbContext,

+  IN     TRACE_HUB_SEVERITY_TYPE  SeverityType,

+  IN     TRACEHUB_PRINTTYPE       PrintType

+  );

+

+/**

+  Get visibility of Trace Hub Msg.

+

+  @param[in]      DgbContext      A pointer to Trace Hub debug instance.

+  @param[in, out] Flag            Flag to enable or disable Trace Hub message.

+  @param[in, out] DbgLevel        Debug Level of Trace Hub.

+

+  @retval EFI_SUCCESS             Get visibility of Trace Hub Msg successfully.

+  @retval EFI_INVALID_PARAMETER   On entry, Flag or DbgLevel is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMsgVisibility (

+  IN     UINT8    *DgbContext,

+  IN OUT BOOLEAN  *Flag,

+  IN OUT UINT8    *DbgLevel

+  );

+

+/**

+  Get Trace Hub MMIO Address.

+

+  @param[in]      DgbContext        A pointer to Trace Hub debug instance.

+  @param[in, out] TraceAddress      Trace Hub MMIO Address.

+

+  @retval EFI_SUCCESS               Get MMIO address successfully.

+  @retval EFI_INVALID_PARAMETER     TraceAddress is a NULL pointer.

+**/

+STATIC

+EFI_STATUS

+GetTraceHubMmioAddress (

+  IN     UINT8  *DgbContext,

+  IN OUT UINTN  *TraceAddress

+  );

+

+/**

+  Allocate boot time pool memory to store Trace Hub HOB data.

+

+  @retval  EFI_SUCCESS   Migration process is successful.

+  @retval  Other         Migration process is unsuccessful

+**/

+STATIC

+EFI_STATUS

+MigrateTraceHubHobData (

+  VOID

+  );

+

+#endif // TRACE_HUB_API_INTERNAL_H_

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 9605c617b7..8300c88141 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -438,6 +438,9 @@
   ## Include/UniversalPayload/SerialPortInfo.h

   gUniversalPayloadSerialPortInfoGuid = { 0xaa7e190d, 0xbe21, 0x4409, { 0x8e, 0x67, 0xa2, 0xcd, 0xf, 0x61, 0xe1, 0x70 } }

 

+  ## Include/UniversalPayload/TraceHubDebugInfo.h

+  gUniversalPayloadTraceHubDebugInfoGuid = { 0xf88c9c23, 0x646c, 0x4f6c, { 0x8e, 0x3d, 0x36, 0xa9, 0x43, 0xc1, 0x08, 0x35 } }

+

   ## GUID used for Boot Discovery Policy FormSet guid and related variables.

   gBootDiscoveryPolicyMgrFormsetGuid = { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } }

 

@@ -1093,6 +1096,24 @@
   # @Prompt Enable UEFI Stack Guard.

   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055

 

+  ## Indicate debug level of Trace Hub.

+  #   0x0 - TraceHubDebugLevelError.<BR>

+  #   0x1 - TraceHubDebugLevelErrorWarning.<BR>

+  #   0x2 - TraceHubDebugLevelErrorWarningInfo.<BR>

+  #   0x3 - TraceHubDebugLevelErrorWarningInfoVerbose.<BR>

+  # @Prompt Debug level of Trace Hub.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugLevel|0|UINT8|0x30001056

+

+  ## Flag to enable or disable Trace Hub message.

+  #   FALSE - Disable Trace Hub debug message.<BR>

+  #   TRUE  - Enable Trace Hub debug message.<BR>

+  # @Prompt Enable or Disable Trace Hub message.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdEnableTraceHubDebugMsg|0|BOOLEAN|0x30001057

+

+  ## Indicate MMIO address where Trace Hub message output to.

+  # @Prompt Output MMIO address of Trace Hub message.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugAddress|0|UINT64|0x30001058

+

 [PcdsFixedAtBuild, PcdsPatchableInModule]

   ## Dynamic type PCD can be registered callback function for Pcd setting action.

   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 1014598f31..a11f26572a 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -106,6 +106,9 @@
   MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf

   VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf

   IpmiCommandLib|MdeModulePkg/Library/BaseIpmiCommandLibNull/BaseIpmiCommandLibNull.inf

+  TraceHubDebugLib|MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf

+  TraceHubDebugLib|MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugLibSyst.inf

+  TraceHubDebugLib|MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf

 

 [LibraryClasses.EBC.PEIM]

   IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf

@@ -446,6 +449,9 @@
   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf

   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf

   MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf

+  MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf

+  MdeModulePkg/Library/TraceHubDebugLibSysT/PeiTraceHubDebugLibSyst.inf

+  MdeModulePkg/Library/TraceHubDebugLibSysT/DxeSmmTraceHubDebugLibSyst.inf

 

 [Components.IA32, Components.X64, Components.AARCH64]

   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf

diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index 33ce9f6198..b64f26d255 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1290,6 +1290,24 @@
                                                                                     "   TRUE  - UEFI Stack Guard will be enabled.<BR>\n"

                                                                                     "   FALSE - UEFI Stack Guard will be disabled.<BR>"

 

+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdTraceHubDebugLevel_PROMPT  #language en-US "Debug level of Trace Hub."

+

+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdTraceHubDebugLevel_HELP    #language en-US "Indicate debug level of Trace Hub"

+                                                                                         "  0x0 - TraceHubDebugLevelError.<BR>"

+                                                                                         "  0x1 - TraceHubDebugLevelErrorWarning.<BR>"

+                                                                                         "  0x2 - TraceHubDebugLevelErrorWarningInfo.<BR>"

+                                                                                         "  0x3 - TraceHubDebugLevelErrorWarningInfoVerbose.<BR>"

+

+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdEnableTraceHubDebugMsg_PROMPT  #language en-US "Flag to enable or disable Trace Hub message"

+

+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdEnableTraceHubDebugMsg_HELP    #language en-US "Enable or Disable Trace Hub message"

+                                                                                             "  FALSE - Disable Trace Hub debug message.<BR>"

+                                                                                             "  TRUE  - Enable Trace Hub debug message.<BR>"

+

+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdTraceHubDebugAddress_PROMPT  #language en-US "Output MMIO address of Trace Hub message"

+

+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdTraceHubDebugAddress_HELP    #language en-US "Indicate MMIO address where Trace Hub message output to."

+

 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSetNvStoreDefaultId_PROMPT  #language en-US "NV Storage DefaultId"

 

 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSetNvStoreDefaultId_HELP    #language en-US "This dynamic PCD enables the default variable setting.\n"

-- 
2.28.0.windows.1


  reply	other threads:[~2023-01-31  3:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31  2:48 [PATCH 1/4] MdePkg: Add MipiSysTLib library victorx.hsu
2023-01-31  2:49 ` [PATCH 2/4] MdeModulePkg: Add TraceHubDebugLibSysT library victorx.hsu
2023-01-31  3:17   ` Guo, Gua [this message]
2023-01-31  2:49 ` [PATCH 3/4] MdePkg: Add NULL library for TraceHubDebugLibSysT victorx.hsu
2023-01-31  3:17   ` Guo, Gua
2023-01-31  2:49 ` [PATCH 4/4] Maintainers.txt: Update reviewers for Trace Hub library victorx.hsu
2023-01-31  3:16   ` Guo, Gua
2023-01-31  3:17 ` [PATCH 1/4] MdePkg: Add MipiSysTLib library Guo, Gua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN9PR11MB5483A8B9777656C966555DDEEFD09@BN9PR11MB5483.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox