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 1/4] MdePkg: Add MipiSysTLib library
Date: Tue, 31 Jan 2023 03:17:10 +0000 [thread overview]
Message-ID: <BN9PR11MB5483C28581C91AD9B157ADDEEFD09@BN9PR11MB5483.namprd11.prod.outlook.com> (raw)
In-Reply-To: <29c690501f493d9d003ee7089228a7273c3ff091.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 1/4] MdePkg: Add MipiSysTLib library
From: VictorX Hsu <victorx.hsu@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144
Wrap mipi sys-T submodule as a MipiSysTLib. This Library provide mipi sys-T API to be consumed.
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>
---
.gitmodules | 5 +-
.pytool/CISettings.py | 2 +
MdePkg/Include/Library/MipiSysTLib.h | 242 +++++++++
MdePkg/Library/MipiSysTLib/MipiSysTLib.c | 110 +++++
MdePkg/Library/MipiSysTLib/MipiSysTLib.inf | 52 ++
MdePkg/Library/MipiSysTLib/Platform.c | 160 ++++++
MdePkg/Library/MipiSysTLib/Platform.h | 140 ++++++
MdePkg/Library/MipiSysTLib/mipi_syst.h | 539 +++++++++++++++++++++
MdePkg/Library/MipiSysTLib/mipisyst | 1 +
MdePkg/MdePkg.ci.yaml | 4 +-
MdePkg/MdePkg.dec | 5 +
MdePkg/MdePkg.dsc | 2 +
ReadMe.rst | 1 +
13 files changed, 1261 insertions(+), 2 deletions(-) create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h
create mode 160000 MdePkg/Library/MipiSysTLib/mipisyst
diff --git a/.gitmodules b/.gitmodules
index 8011a88d9d..4a0500eea4 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -16,10 +16,13 @@
[submodule "BaseTools/Source/C/BrotliCompress/brotli"]
path = BaseTools/Source/C/BrotliCompress/brotli
url = https://github.com/google/brotli
- ignore = untracked+ ignore = untracked
[submodule "RedfishPkg/Library/JsonLib/jansson"]
path = RedfishPkg/Library/JsonLib/jansson
url = https://github.com/akheron/jansson
[submodule "UnitTestFrameworkPkg/Library/GoogleTestLib/googletest"]
path = UnitTestFrameworkPkg/Library/GoogleTestLib/googletest
url = https://github.com/google/googletest.git
+[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
+ path = MdePkg/Library/MipiSysTLib/mipisyst
+ url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py index d87c8e838e..0118820680 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -193,6 +193,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
"BaseTools/Source/C/BrotliCompress/brotli", False)) rs.append(RequiredSubmodule( "RedfishPkg/Library/JsonLib/jansson", False))+ rs.append(RequiredSubmodule(+ "MdePkg/Library/MipiSysTLib/mipisyst", False)) return rs def GetName(self):diff --git a/MdePkg/Include/Library/MipiSysTLib.h b/MdePkg/Include/Library/MipiSysTLib.h
new file mode 100644
index 0000000000..6282baac8e
--- /dev/null
+++ b/MdePkg/Include/Library/MipiSysTLib.h
@@ -0,0 +1,242 @@
+/** @file++Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>++SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#ifndef MIPI_SYST_LIB_H_+#define MIPI_SYST_LIB_H_++#include <Uefi.h>++#define MIPI_SYST_CONFORMANCE_LEVEL 30+#define MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA+#define MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID++struct mipi_syst_header;+struct mipi_syst_handle;+struct mipi_syst_scatter_prog;++/**+ * SyS-T handle state initialization hook definition+ *+ * This function gets called in the context of IO handle generation.+ * Its purpose is to initialize the platform dependent portion of+* the handle and other necessary platform specific initialization steps.+ *+ * @param systh Pointer to new SyS-T handle+ * @see syst_handle_t+ */+typedef void (*mipi_syst_inithandle_hook_t)(+ struct mipi_syst_handle *systh+ );++/**+ * SyS-T handle state release hook definition+ *+ * This function gets called when a handle is about to be destroyed..+ * Its purpose is to free any resources allocated during the handle+ * generation.+ *+ * @param systh Pointer to handle that is destroyed+ * @see syst_handle_t+ */+typedef void (*mipi_syst_releasehandle_hook_t)(+ struct mipi_syst_handle *systh+ );++/**+ * Low level message write routine definition+ *+ * This function is called at the end of an instrumentation API to output+ * the raw message data.+ *+ * @param systh pointer to a SyS-T handle structure used in the API call,+ * @param scatterprog pointer to a list of scatter write instructions that+ * encodes how to convert the descriptor pointer by+ * pdesc into raw binary data. This list doesn't include+ * the mandatory first 32 tag byte value pointed by pdesc.+ * @param pdesc pointer to a message descriptor, which containing at least+ * the 32-bit message tag data+ */+typedef void (*mipi_syst_msg_write_t)(+ struct mipi_syst_handle *systh,+ struct mipi_syst_scatter_prog *scatterprog,+ const void *pdesc+ );++typedef struct {+ UINTN MmioAddr;+} TRACE_HUB_PLATFORM_SYST_DATA;++struct mipi_syst_platform_handle {+ TRACE_HUB_PLATFORM_SYST_DATA TraceHubPlatformData;+};++/** internal handle state flags+ */+typedef struct mipi_syst_handle_flags {+ UINT32 shf_alloc : 1; /**< set to 1 if heap allocated handle */+} MIPI_SYST_HANDLE_FLAGS;++/**+ * Message data header tag definition+ *+ * Each SyS-T message starts with a 32-bit message tag. The tag defines the+ * message originator and decoding information for the data following+ * the tag.+ */++typedef struct mipi_syst_msg_tag {+ #if defined (MIPI_SYST_BIG_ENDIAN)+ UINT32 et_res31 : 1; /**< reserved for future use */+ UINT32 et_res30 : 1; /**< reserved for future use */+ UINT32 et_subtype : 6; /**< type dependent sub category */+ UINT32 et_guid : 1; /**< 128-bit GUID present */+ UINT32 et_modunit : 11; /**< unit for GUID or module:unit */+ UINT32 et_timestamp : 1; /**< indicate 64-bit timestamp */+ UINT32 et_chksum : 1; /**< indicate 32-bit CRC */+ UINT32 et_length : 1; /**< indicate length field */+ UINT32 et_location : 1; /**< indicate location information */+ UINT32 et_res7 : 1; /**< reserved for future use */+ UINT32 et_severity : 3; /**< severity level of message */+ UINT32 et_type : 4; /**< SyS-T message type ID */+ #else+ UINT32 et_type : 4; /**< SyS-T message type ID */+ UINT32 et_severity : 3; /**< severity level of message */+ UINT32 et_res7 : 1; /**< reserved for future use */+ UINT32 et_location : 1; /**< indicate location information */+ UINT32 et_length : 1; /**< indicate length field */+ UINT32 et_chksum : 1; /**< indicate 32-bit CRC */+ UINT32 et_timestamp : 1; /**< indicate 64-bit timestamp */+ UINT32 et_modunit : 11; /**< unit for GUID or module:unit */+ UINT32 et_guid : 1; /**< 128-bit GUID present */+ UINT32 et_subtype : 6; /**< type dependent sub category */+ UINT32 et_res30 : 1; /**< reserved for future use */+ UINT32 et_res31 : 1; /**< reserved for future use */+ #endif+} MIPI_SYST_MSG_TAG;++/** 128-bit GUID style message origin ID */+typedef struct mipi_syst_guid {+ union {+ UINT8 b[16];+ UINT64 ll[2];+ } u;+} MIPI_SYST_GUID;++/**+ * Message severity level enumeration+ */+typedef enum mipi_syst_severity {+ MIPI_SYST_SEVERITY_MAX = 0, /**< no assigned severity */+ MIPI_SYST_SEVERITY_FATAL = 1, /**< critical error level */+ MIPI_SYST_SEVERITY_ERROR = 2, /**< error message level */+ MIPI_SYST_SEVERITY_WARNING = 3, /**< warning message level */+ MIPI_SYST_SEVERITY_INFO = 4, /**< information message level */+ MIPI_SYST_SEVERITY_USER1 = 5, /**< user defined level 5 */+ MIPI_SYST_SEVERITY_USER2 = 6, /**< user defined level 6 */+ MIPI_SYST_SEVERITY_DEBUG = 7 /**< debug information level */+} MIPI_SYST_SEVERITY;++/** SyS-T connection handle state structure+ *+ * This structure connects the instrumentation API with the underlying SyS-T+ * infrastructure. It plays a similar role to a FILE * in traditional+ * C file IO.+ */+typedef struct mipi_syst_handle {+ struct mipi_syst_header *systh_header; /**< global state */+ struct mipi_syst_handle_flags systh_flags; /**< handle state */+ struct mipi_syst_msg_tag systh_tag; /**< tag flags */++ #if defined (MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID)+ struct mipi_syst_guid systh_guid; /**< module GUID */+ #endif++ #if defined (MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD)+ struct mipi_syst_msglocation systh_location; /**< location record */+ #endif++ UINT32 systh_param_count; /**< number of parameters */+ UINT32 systh_param[6]; /**< catalog msg parameters */++ #if defined (MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA)+ struct mipi_syst_platform_handle systh_platform; /**< platform specific state */+ #endif+} MIPI_SYST_HANDLE;++/** SyS-T global state structure.+ * This structure is holding the global SyS-T library state+ */+typedef struct mipi_syst_header {+ UINT32 systh_version; /**< SyS-T version ID */++ #if defined (MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA)+ mipi_syst_inithandle_hook_t systh_inith; /**< handle init hook function*/+ mipi_syst_releasehandle_hook_t systh_releaseh; /**< handle release hook */+ #endif++ #if MIPI_SYST_CONFORMANCE_LEVEL > 10+ mipi_syst_msg_write_t systh_writer; /**< message output routine */+ #endif+ #if defined (MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA)+ struct mipi_syst_platform_state systh_platform; /**< platform specific state */+ #endif+} MIPI_SYST_HEADER;++/**+ Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T handle.++ @param[in, out] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.++ @retval EFI_SUCCESS MIPI_SYST_HANDLE instance was initialized.+ @retval EFI_INVALID_PARAMETER On entry, MipiSystHandle is a NULL pointer.+**/+EFI_STATUS+EFIAPI+InitMipiSystHandle (+ IN OUT MIPI_SYST_HANDLE *MipiSystHandle+ );++/**+ Invoke write_debug_string function in Mipi Sys-T module.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Severity An error level to decide whether to enable Trace Hub data.+ @param[in] Len Length of data buffer.+ @param[in] Str A pointer to data buffer.++ @retval EFI_SUCCESS Data in buffer was processed.+ @retval EFI_ABORTED No data need to be written to Trace Hub.+ @retval EFI_INVALID_PARAMETER On entry, MipiSystHandle is a NULL pointer.+**/+EFI_STATUS+EFIAPI+MipiSystWriteDebug (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Severity,+ IN UINT16 Len,+ IN CONST CHAR8 *Str+ );++/**+ Invoke catalog_write_message function in Mipi Sys-T module.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Severity An error level to decide whether to enable Trace Hub data.+ @param[in] CatId Catalog Id.++ @retval EFI_SUCCESS Data in buffer was processed.+**/+EFI_STATUS+EFIAPI+MipiSystWriteCatalog (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Severity,+ IN UINT64 CatId+ );++#endif // MIPI_SYST_LIB_H_diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.c b/MdePkg/Library/MipiSysTLib/MipiSysTLib.c
new file mode 100644
index 0000000000..0195ad85b0
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/MipiSysTLib.c
@@ -0,0 +1,110 @@
+/** @file++Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>++SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#include <Uefi.h>+#include "mipi_syst.h"++/**+ Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T handle.++ @param[in, out] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.++ @retval EFI_SUCCESS MIPI_SYST_HANDLE instance was initialized.+ @retval EFI_INVALID_PARAMETER On entry, MipiSystHandle is a NULL pointer.+**/+EFI_STATUS+EFIAPI+InitMipiSystHandle (+ IN OUT MIPI_SYST_HANDLE *MipiSystHandle+ )+{+ if (MipiSystHandle == NULL) {+ return EFI_INVALID_PARAMETER;+ }++ mipi_syst_init (MipiSystHandle->systh_header, 0, NULL);+ mipi_syst_init_handle (MipiSystHandle->systh_header, MipiSystHandle, NULL, 0);++ return EFI_SUCCESS;+}++/**+ Invoke write_debug_string function in Mipi Sys-T module.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Severity An error level to decide whether to enable Trace Hub data.+ @param[in] Len Length of data buffer.+ @param[in] Str A pointer to data buffer.++ @retval EFI_SUCCESS Data in buffer was processed.+ @retval EFI_ABORTED No data need to be written to Trace Hub.+ @retval EFI_INVALID_PARAMETER On entry, MipiSystHandle is a NULL pointer.+**/+EFI_STATUS+EFIAPI+MipiSystWriteDebug (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Severity,+ IN UINT16 Len,+ IN CONST CHAR8 *Str+ )+{+ if (MipiSystHandle == NULL) {+ return EFI_INVALID_PARAMETER;+ }++ if ((Len == 0) || (Str == NULL)) {+ //+ // No data need to be written to Trace Hub+ //+ return EFI_ABORTED;+ }++ mipi_syst_write_debug_string (+ MipiSystHandle,+ MIPI_SYST_NOLOCATION,+ MIPI_SYST_STRING_GENERIC,+ Severity,+ Len,+ Str+ );++ return EFI_SUCCESS;+}++/**+ Invoke catalog_write_message function in Mipi Sys-T module.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Severity An error level to decide whether to enable Trace Hub data.+ @param[in] CatId Catalog Id.++ @retval EFI_SUCCESS Data in buffer was processed.+ @retval EFI_INVALID_PARAMETER On entry, MipiSystHandle is a NULL pointer.+**/+EFI_STATUS+EFIAPI+MipiSystWriteCatalog (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Severity,+ IN UINT64 CatId+ )+{+ if (MipiSystHandle == NULL) {+ return EFI_INVALID_PARAMETER;+ }++ mipi_syst_write_catalog64_message (+ MipiSystHandle,+ MIPI_SYST_NOLOCATION,+ Severity,+ CatId+ );++ return EFI_SUCCESS;+}diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
new file mode 100644
index 0000000000..17ede382cc
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
@@ -0,0 +1,52 @@
+## @file+# This library provides Mipi Sys-T API.+#+# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>+#+# SPDX-License-Identifier: BSD-2-Clause-Patent+#+##++[Defines]+ INF_VERSION = 0x00010005+ BASE_NAME = MipiSysTLib+ FILE_GUID = A58B0510-9E6D-4747-95D8-E5B8AF4633E6+ MODULE_TYPE = BASE+ VERSION_STRING = 1.0+ LIBRARY_CLASS = MipiSysTLib++ DEFINE MIPI_HEADER_PATH = mipisyst/library/include/mipi_syst+ DEFINE MIPI_SOURCE_PATH = mipisyst/library/src++#+# The following information is for reference only and not required by the build tools.+#+# VALID_ARCHITECTURES = IA32 X64+#++[LibraryClasses]+ IoLib+ BaseMemoryLib++[Packages]+ MdePkg/MdePkg.dec++[Sources]+ MipiSysTLib.c+ mipi_syst.h+ Platform.c+ Platform.h+ $(MIPI_HEADER_PATH)/api.h+ $(MIPI_HEADER_PATH)/crc32.h+ $(MIPI_HEADER_PATH)/compiler.h+ $(MIPI_HEADER_PATH)/message.h+ $(MIPI_HEADER_PATH)/inline.h+ $(MIPI_SOURCE_PATH)/mipi_syst_init.c+ $(MIPI_SOURCE_PATH)/mipi_syst_api.c+ $(MIPI_SOURCE_PATH)/mipi_syst_crc32.c+ $(MIPI_SOURCE_PATH)/mipi_syst_writer.c+ $(MIPI_SOURCE_PATH)/mipi_syst_inline.c+ $(MIPI_SOURCE_PATH)/mipi_syst_compiler.c++[BuildOptions]+ MSFT:*_*_*_CC_FLAGS = /Oddiff --git a/MdePkg/Library/MipiSysTLib/Platform.c b/MdePkg/Library/MipiSysTLib/Platform.c
new file mode 100644
index 0000000000..4079ccb1b8
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/Platform.c
@@ -0,0 +1,160 @@
+/** @file++Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>++SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#include <Uefi.h>+#include <Library/IoLib.h>+#include <Library/BaseMemoryLib.h>+#include "mipi_syst.h"++/**+ Write 4 bytes to Trace Hub MMIO addr + 0x10.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD32Ts (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Data+ )+{+ MmioWrite32 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x10, Data);+}++/**+ Write 4 bytes to Trace Hub MMIO addr + 0x18.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD32Mts (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Data+ )+{+ MmioWrite32 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x18, Data);+}++/**+ Write 8 bytes to Trace Hub MMIO addr + 0x18.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD64Mts (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT64 Data+ )+{+ MmioWrite64 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x18, Data);+}++/**+ Write 1 byte to Trace Hub MMIO addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD8 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT8 Data+ )+{+ MmioWrite8 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x0, Data);+}++/**+ Write 2 bytes to Trace Hub MMIO mmio addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD16 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT16 Data+ )+{+ MmioWrite16 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x0, Data);+}++/**+ Write 4 bytes to Trace Hub MMIO addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD32 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Data+ )+{+ MmioWrite32 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x0, Data);+}++/**+ Write 8 bytes to Trace Hub MMIO addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD64 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT64 Data+ )+{+ MmioWrite64 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x0, Data);+}++/**+ Clear data in Trace Hub MMIO addr + 0x30.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+**/+VOID+EFIAPI+MipiSystWriteFlag (+ IN MIPI_SYST_HANDLE *MipiSystHandle+ )+{+ UINT32 Flag;++ Flag = 0;++ MmioWrite32 (MipiSystHandle->systh_platform.TraceHubPlatformData.MmioAddr + 0x30, Flag);+}++/**+ Get Epoch time.++ @retval UINT64 A numeric number for timestamp.+**/+UINT64+EFIAPI+MipiSystGetEpochUs (+ VOID+ )+{+ UINT64 Epoch;++ Epoch = 1000;++ return Epoch;+}diff --git a/MdePkg/Library/MipiSysTLib/Platform.h b/MdePkg/Library/MipiSysTLib/Platform.h
new file mode 100644
index 0000000000..b36ab6b84b
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/Platform.h
@@ -0,0 +1,140 @@
+/** @file++Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>++SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#ifndef MIPI_SYST_PLATFORM_H_+#define MIPI_SYST_PLATFORM_H_++/**+ Write 4 bytes to Trace Hub MMIO addr + 0x10.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD32Ts (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Data+ );++/**+ Write 4 bytes to Trace Hub MMIO addr + 0x18.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD32Mts (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Data+ );++/**+ Write 8 bytes to Trace Hub MMIO addr + 0x18.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD64Mts (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT64 Data+ );++/**+ Write 1 byte to Trace Hub MMIO addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD8 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT8 Data+ );++/**+ Write 2 bytes to Trace Hub MMIO mmio addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD16 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT16 Data+ );++/**+ Write 4 bytes to Trace Hub MMIO addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD32 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT32 Data+ );++/**+ Write 8 bytes to Trace Hub MMIO addr + 0x0.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+ @param[in] Data Data to be written.+**/+VOID+EFIAPI+MipiSystWriteD64 (+ IN MIPI_SYST_HANDLE *MipiSystHandle,+ IN UINT64 Data+ );++/**+ Clear data in Trace Hub MMIO addr + 0x30.++ @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure.+**/+VOID+EFIAPI+MipiSystWriteFlag (+ IN MIPI_SYST_HANDLE *MipiSystHandle+ );++/**+ Get Epoch time.++ @retval UINT64 A numeric number for timestamp.+**/+UINT64+EFIAPI+MipiSystGetEpochUs (+ VOID+ );++#define MIPI_SYST_PLATFORM_CLOCK() MipiSystGetEpochUs ()++#ifndef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA+#define MIPI_SYST_OUTPUT_D32TS(MipiSystHandle, Data) MipiSystWriteD32Ts ((MipiSystHandle), (Data))+#define MIPI_SYST_OUTPUT_D32MTS(MipiSystHandle, Data) MipiSystWriteD32Mts ((MipiSystHandle), (Data))+#define MIPI_SYST_OUTPUT_D64MTS(MipiSystHandle, Data) MipiSystWriteD64Mts ((MipiSystHandle), (Data))+#define MIPI_SYST_OUTPUT_D8(MipiSystHandle, Data) MipiSystWriteD8 ((MipiSystHandle), (Data))+#define MIPI_SYST_OUTPUT_D16(MipiSystHandle, Data) MipiSystWriteD16 ((MipiSystHandle), (Data))+#define MIPI_SYST_OUTPUT_D32(MipiSystHandle, Data) MipiSystWriteD32 ((MipiSystHandle), (Data))+ #if defined (MIPI_SYST_PCFG_ENABLE_64BIT_IO)+#define MIPI_SYST_OUTPUT_D64(MipiSystHandle, Data) MipiSystWriteD64 ((MipiSystHandle), (Data))+ #endif+#define MIPI_SYST_OUTPUT_FLAG(MipiSystHandle) MipiSystWriteFlag ((MipiSystHandle))+#endif++#endif // MIPI_SYST_PLATFORM_H_diff --git a/MdePkg/Library/MipiSysTLib/mipi_syst.h b/MdePkg/Library/MipiSysTLib/mipi_syst.h
new file mode 100644
index 0000000000..29a1aa431b
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/mipi_syst.h
@@ -0,0 +1,539 @@
+/** @file++This header file is a customized version of mipi_syst.h.in in mipi module.++Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>++SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#ifndef MIPI_SYST_H_INCLUDED+#define MIPI_SYST_H_INCLUDED++#include <Library/MipiSysTLib.h>++/* SyS-T API version information+ */+#define MIPI_SYST_VERSION_MAJOR 1 /**< Major version, incremented if API changes */+#define MIPI_SYST_VERSION_MINOR 0 /**< Minor version, incremented on compatible extensions */+#define MIPI_SYST_VERSION_PATCH 0 /**< Patch for existing major, minor, usually 0 */++/** Define SyS-T API conformance level+ *+ * 10 = minimal (only short events)+ * 20 = low overhead (exluding varag functions and CRC32)+ * 30 = full implementation+ */+#define MIPI_SYST_CONFORMANCE_LEVEL 30++/** Compute SYS-T version value+ *+ * Used to compare SYS-T Major.Minor.patch versions numerically at runtime.+ *+ * @param ma major version number+ * @param mi minor version number+ * @param p patch version number+ *+ * Example:+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}+ *+ * #if MIPI_SYST_VERSION_CODE >= MIPI_SYST_MAKE_VERSION_CODE(1,5,0)+ * // do what only >= 1.5.x supports+ * #endif+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ */+#define MIPI_SYST_MAKE_VERSION_CODE(ma, mi, p) (((ma) << 16) | ((mi)<<8) | (p))++/** Numeric SYS-T version code */+#define MIPI_SYST_VERSION_CODE MIPI_SYST_MAKE_VERSION_CODE(\+ MIPI_SYST_VERSION_MAJOR,\+ MIPI_SYST_VERSION_MINOR,\+ MIPI_SYST_VERSION_PATCH)++/* Macros to trick numeric values like __LINE__ into a string+ */+#define _MIPI_SYST_STRINGIFY(x) #x+#define _MIPI_SYST_CPP_TOSTR(x) _MIPI_SYST_STRINGIFY(x)++#define _MIPI_SYST_VERSION_STRING(a, b, c) \+ _MIPI_SYST_CPP_TOSTR(a)"."_MIPI_SYST_CPP_TOSTR(b)"."_MIPI_SYST_CPP_TOSTR(c)++/** Textual version string */+#define MIPI_SYST_VERSION_STRING \+ _MIPI_SYST_VERSION_STRING(\+ MIPI_SYST_VERSION_MAJOR,\+ MIPI_SYST_VERSION_MINOR,\+ MIPI_SYST_VERSION_PATCH)++#ifndef MIPI_SYST_COMPILER_INCLUDED+#define MIPI_SYST_STATIC+ #include "mipi_syst/compiler.h"+#endif++/* String hash macros for compile time computation of catalog ID's.+ * Notes:+ * These macros will only be used with optimized builds, otherwise+ * a lot of runtime code will be generated.+ *+ * Only the last 64 bytes of the string are considered for hashing+ */+#define _MIPI_SYST_HASH1(s, i, x, l) (x*65599u+(mipi_syst_u8)s[(i)<(l)?((l)-1-(i)):(l)])+#define _MIPI_SYST_HASH4(s, i, x, l) _MIPI_SYST_HASH1(s,i,_MIPI_SYST_HASH1(s,i+1,_MIPI_SYST_HASH1(s,i+2,_MIPI_SYST_HASH1(s,i+3,x,l),l),l),l)+#define _MIPI_SYST_HASH16(s, i, x, l) _MIPI_SYST_HASH4(s,i,_MIPI_SYST_HASH4(s,i+4,_MIPI_SYST_HASH4(s,i+8,_MIPI_SYST_HASH4(s,i+12,x,l),l),l),l)+#define _MIPI_SYST_HASH64(s, i, x, l) _MIPI_SYST_HASH16(s,i,_MIPI_SYST_HASH16(s,i+16,_MIPI_SYST_HASH16(s,i+32,_MIPI_SYST_HASH16(s,i+48,x,l),l),l),l)++#define _MIPI_SYST_HASH_x65599(s, l) ((mipi_syst_u32)_MIPI_SYST_HASH64(s,0,0,l))++#define _MIPI_SYST_HASH_AT_CPP_TIME(str, offset) (_MIPI_SYST_HASH_x65599(str, sizeof(str)-1) + (offset))+#define _MIPI_SYST_HASH_AT_RUN_TIME(str, offset) (mipi_syst_hash_x65599(str, sizeof(str)-1) + (offset))++#if defined (_MIPI_SYST_OPTIMIZER_ON)+#define MIPI_SYST_HASH(a, b) _MIPI_SYST_HASH_AT_CPP_TIME((a), (b))+#else+#define MIPI_SYST_HASH(a, b) _MIPI_SYST_HASH_AT_RUN_TIME((a), (b))+#endif++/** Major Message Types+ */+enum mipi_syst_msgtype {+ MIPI_SYST_TYPE_BUILD = 0, /**< client build id message */+ MIPI_SYST_TYPE_SHORT32 = 1, /**< value only message */+ MIPI_SYST_TYPE_STRING = 2, /**< text message output */+ MIPI_SYST_TYPE_CATALOG = 3, /**< catalog message output */+ MIPI_SYST_TYPE_RAW = 6, /**< raw binary data */+ MIPI_SYST_TYPE_SHORT64 = 7, /**< value only message */+ MIPI_SYST_TYPE_CLOCK = 8, /**< clock sync message */++ MIPI_SYST_TYPE_MAX+};++/** MIPI_SYST_TYPE_DEBUG_STRING Sub-Types+ */+enum mipi_syst_subtype_string {+ MIPI_SYST_STRING_GENERIC = 1, /**< string generic debug */+ MIPI_SYST_STRING_FUNCTIONENTER = 2, /**< string is function name */+ MIPI_SYST_STRING_FUNCTIONEXIT = 3, /**< string is function name */+ MIPI_SYST_STRING_INVALIDPARAM = 5, /**< invalid SyS-T APIcall */+ MIPI_SYST_STRING_ASSERT = 7, /**< Software Assert: failure */+ MIPI_SYST_STRING_PRINTF_32 = 11, /**< printf with 32-bit packing */+ MIPI_SYST_STRING_PRINTF_64 = 12, /**< printf with 64-bit packing */++ MIPI_SYST_STRING_MAX+};++/** MIPI_SYST_TYPE_CATALOG Sub-Types+ */+enum mipi_syst_subtype_catalog {+ MIPI_SYST_CATALOG_ID32_P32 = 1, /**< 32-bit catalog ID, 32-bit packing */+ MIPI_SYST_CATALOG_ID64_P32 = 2, /**< 64-bit catalog ID, 32-bit packing */+ MIPI_SYST_CATALOG_ID32_P64 = 5, /**< 32-bit catalog ID, 64-bit packing */+ MIPI_SYST_CATALOG_ID64_P64 = 6, /**< 64-bit catalog ID, 64-bit packing */++ MIPI_SYST_CATALOG_MAX+};++/** MIPI_SYST_TYPE_CLOCK Sub-Types+ */+enum mipi_syst_subtype_clock {+ MIPI_SYST_CLOCK_TRANSPORT_SYNC = 1, /**< SyS-T clock & frequency sync */+ MIPI_SYST_CLOCK_MAX+};++enum mipi_syst_subtype_build {+ MIPI_SYST_BUILD_ID_COMPACT32 = 0, /**< compact32 build id */+ MIPI_SYST_BUILD_ID_COMPACT64 = 1, /**< compact64 build id */+ MIPI_SYST_BUILD_ID_LONG = 2, /**< normal build message */+ MIPI_SYST_BUILD_MAX+};++/** GUID initializer code+ *+ * This macro simplifies converting a GUID from its string representation+ * into the mipi_syst_guid data structure. The following example shows+ * how the values from a GUID string are used with the macro. Each numeric+ * component from the GUID string gets converted into a hex value parameter+ * when invoking the macro.+ *+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}+ *+ * // Guid: f614b99d-99a1-4c04-8c30-90999ab5fe05+ *+ * struct mipi_syst_guid guid =+ * MIPI_SYST_GEN_GUID(0xf614b99d, 0x99a1, 0x4c04, 0x8c30, 0x90999ab5fe05);+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ */+#define MIPI_SYST_GEN_GUID(l1, w1, w2, w3, l2) \+ {{\+ (mipi_syst_u8)((mipi_syst_u32)(l1) >> 24), \+ (mipi_syst_u8)((mipi_syst_u32)(l1) >> 16), \+ (mipi_syst_u8)((mipi_syst_u32)(l1) >> 8), \+ (mipi_syst_u8)((mipi_syst_u32)(l1) >> 0), \+ (mipi_syst_u8)((mipi_syst_u16)(w1) >> 8), \+ (mipi_syst_u8)((mipi_syst_u16)(w1) >> 0), \+ (mipi_syst_u8)((mipi_syst_u16)(w2) >> 8), \+ (mipi_syst_u8)((mipi_syst_u16)(w2) >> 0), \+ (mipi_syst_u8)((mipi_syst_u16)(w3) >> 8), \+ (mipi_syst_u8)((mipi_syst_u16)(w3) >> 0), \+ (mipi_syst_u8)((mipi_syst_u64)(l2) >> 40), \+ (mipi_syst_u8)((mipi_syst_u64)(l2) >> 32), \+ (mipi_syst_u8)((mipi_syst_u64)(l2) >> 24), \+ (mipi_syst_u8)((mipi_syst_u64)(l2) >> 16), \+ (mipi_syst_u8)((mipi_syst_u64)(l2) >> 8), \+ (mipi_syst_u8)((mipi_syst_u64)(l2) >> 0) \+ }}++/** SyS-T client origin data+ *+ * This structure holds the GUID or header origin and unit data+ * used by SyS-T handles. The structure gets passed into the handle+ * creation functions to initialize the values that identify clients.+ * @see MIPI_SYST_SET_HANDLE_GUID_UNIT+ * @see MIPI_SYST_SET_HANDLE_MODULE_UNIT+ * @see MIPI_SYST_SET_HANDLE_ORIGIN+ */+struct mipi_syst_origin {+ struct mipi_syst_guid guid; /**< origin GUID or module value */+ mipi_syst_u16 unit; /**< unit value */+};++/** Origin structure initializer code using GUID+*+* This macro simplifies initializing a mipi_syst_origin structure. The+* first 5 parameters are GUID values as used by the MIPI_SYST_GEN_GUID+* macro. The last parameter is the unit value (11-Bits).+* @see MIPI_SYST_GEN_GUID+*+*+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}+*+* // Guid: {494E5443-B659-45AF-B786-9DB0786248AE}++*+* struct mipi_syst_origin = origin+* MIPI_SYST_GEN_ORIGIN_GUID(+* 0x494E5443, 0xB659, 0x45AF, 0xB786, 0x9DB0786248AE,+* 0x1);+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+*/+#define MIPI_SYST_GEN_ORIGIN_GUID(l1, w1, w2, w3, l2, u) \+ {\+ MIPI_SYST_GEN_GUID(l1, w1, w2, w3, l2) ,\+ u\+ }++/** Origin structure initializer code using header module value+*+* This macro simplifies initializing a mipi_syst_origin structure. The+* first parameter is the header origin value (7-Bits). The second parameter+* is the unit value (4-bits)+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}+*+* // Guid: {494E5443-B659-45AF-B786-9DB0786248AE}++* #define MODULE_X 0x10+* struct mipi_syst_origin =+* MIPI_SYST_GEN_ORIGIN_MODULE(MODULE_X, 0x1);+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+*/+#define MIPI_SYST_GEN_ORIGIN_MODULE(m, u) \+ {\+ MIPI_SYST_GEN_GUID(0,0,0, ((mipi_syst_u16)(m & 0x7F)) << 8, 0 ),\+ u\+ }++/**+ * Global state initialization hook definition+ *+ * This function gets called in the context of the mipi_syst_init() API+ * function after the generic state members of the global state+ * structure syst_hdr have been setup. It's purpose is to initialize the+ * platform dependent portion of the state and other necessary+ * platform specific initialization steps.+ *+ * @param systh Pointer to global state structure+ * @param p user defined value or pointer to data+ * @see mipi_syst_header+ */+typedef void (MIPI_SYST_CALLCONV *mipi_syst_inithook_t)(+ struct mipi_syst_header *systh,+ const void *p+ );++/**+ * Global state destroy hook definition+ *+ * This function gets called in the context of the mipi_syst_destroy() API+ * function before the generic state members of the global state+ * structure syst_hdr have been destroyed. Its purpose is to free resources+ * used by the platform dependent portion of the global state.+ *+ * @param systh Pointer to global state structure+ */+typedef void (MIPI_SYST_CALLCONV *mipi_syst_destroyhook_t)(+ struct mipi_syst_header *systh+ );++#ifndef MIPI_SYST_PLATFORM_INCLUDED++/**+ * @defgroup PCFG_Config Platform Feature Configuration Defines+ *+ * Defines to customize the SyS-T feature set to match the platform needs.+ *+ * Each optional library feature can be disabled by not defining the related+ * MIPI_SYST_PCFG_ENABLE define. Removing unused features in this way reduces+ * both memory footprint and runtime overhead of SyS-T.+ */++/**+ * @defgroup PCFG_Global Platform Wide Configuration+ * @ingroup PCFG_Config+ *+ * These defines enable global features in the SyS-T library.+ * @{+ */++/**+ * Extend SyS-T handle data state+ *+ * This define extends the SyS-T handle state data structure+ * mipi_syst_handle with platform private content. A platform typically+ * stores data for fast trace hardware access in the handle data, for+ * example a volatile pointer to an MMIO space.+ *+ * The platform example uses #mipi_syst_platform_handle as handle state+ * extension.+ */+#define MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA++/* MSVC and GNU compiler 64-bit mode */++/**+ * Enable 64-bit instruction addresses+ *+ * Set this define if running in 64-bit code address space.+ */+ #if defined (_WIN64) || defined (__x86_64__) || defined (__LP64__)+#define MIPI_SYST_PCFG_ENABLE_64BIT_ADDR+ #endif++/**+ * Enable atomic 64-bit write operations+ *+ * Set this define if your platform supports an atomic 64-bit data write+ * operation. This results in fewer MMIO accesses.The SyS-T library+ * defaults to 2 consecutive 32-Bit writes otherwise.+ */+ #if defined (_WIN64) || defined (__x86_64__) || defined (__LP64__)+#define MIPI_SYST_PCFG_ENABLE_64BIT_IO+ #endif++/**+ * Enable helper function code inlining+ *+ * Set this define if speed is more important than code size on your platform.+ * It causes several helper function to get inlined, producing faster, but+ * also larger, code.+ */+#define MIPI_SYST_PCFG_ENABLE_INLINE++/** @} */++/**+ * @defgroup PCFG_ApiSet Supported API sets+ * @ingroup PCFG_Config+ *+ * These defines enable API sets in the SyS-T library. They are set by default+ * depending on the SyS-T API conformance level. The level is specified using+ * the define #MIPI_SYST_CONFORMANCE_LEVEL.+ * @{+ */++ #if MIPI_SYST_CONFORMANCE_LEVEL > 10++/**+ * Use SyS-T scatter write output function+ *+ * The library comes with an output routine that is intended to write data out+ * to an MMIO space. It simplifies a SyS-T platform integration as+ * only low-level access macros must be provided for outputting data. These+ * macros follow MIPI System Trace Protocol (STP) naming convention, also+ * non STP generators can use this interface.+ *+ * These low level output macros are:+ *+ * #MIPI_SYST_OUTPUT_D32MTS, #MIPI_SYST_OUTPUT_D64MTS,+ * #MIPI_SYST_OUTPUT_D32TS, #MIPI_SYST_OUTPUT_D64,+ * #MIPI_SYST_OUTPUT_D32, #MIPI_SYST_OUTPUT_D16, #MIPI_SYST_OUTPUT_D8 and+ * #MIPI_SYST_OUTPUT_FLAG+ *+ * Note: This version of the write function always starts messages+ * using a 32-bit timestamped record also other sized timestamped+ * packets are allowed by the SyS-T specification.+ */+#define MIPI_SYST_PCFG_ENABLE_DEFAULT_SCATTER_WRITE++/**+ * Enable the Catalog API for 32-Bit Catalog IDs.+ */+#define MIPI_SYST_PCFG_ENABLE_CATID32_API++/**+ * Enable the Catalog API for 64-Bit Catalog IDs.+ */+#define MIPI_SYST_PCFG_ENABLE_CATID64_API++/**+ * Enable plain UTF-8 string output APIs.+ */+#define MIPI_SYST_PCFG_ENABLE_STRING_API++/**+ * Enable raw data output APIs+ */+#define MIPI_SYST_PCFG_ENABLE_WRITE_API++/**+ * Enable Build API+ */+#define MIPI_SYST_PCFG_ENABLE_BUILD_API+ #endif /* MIPI_SYST_CONFORMANCE_LEVEL > 10 */++ #if MIPI_SYST_CONFORMANCE_LEVEL > 20++/**+ * Maximum size of printf payload in bytes.+ * Adjust this value if larger strings shall be supported by the library.+ * The buffer space is located in stack memory when calling one of the printf+ * style APIs.+ */+#define MIPI_SYST_PCFG_PRINTF_ARGBUF_SIZE 1024++ #endif /* #if MIPI_SYST_CONFORMANCE_LEVEL > 20 */++/* @} */++/**+ * @defgroup PCFG_Message Optional Message Attributes+ * @ingroup PCFG_Config+ *+ * These defines enable optional message components. They are set by default+ * depending on the SyS-T API conformance level. The level is specified using+ * the define #MIPI_SYST_CONFORMANCE_LEVEL.+ * @{+ */++ #if MIPI_SYST_CONFORMANCE_LEVEL > 10++/**+ * Enable 128-bit origin GUID support.+ */+#define MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID++/**+ * Enable protocol timestamp.+ *+ * This option adds a timestamp into the SyS-T protocol. This+ * option is used if the SyS-T protocol is not embedded into a hardware+ * timestamped trace protocol like MIPI STP or if the HW timestamp cannot+ * be used for other reasons. Setting this option creates the need to define+ * the macros #MIPI_SYST_PLATFORM_CLOCK and #MIPI_SYST_PLATFORM_FREQ to+ * return a 64-bit clock tick value and its frequency.+ */+#define MIPI_SYST_PCFG_ENABLE_TIMESTAMP++ #if defined (_DOXYGEN_) /* only for doxygen, remove the #if to enable */++/**+* Enable generation of length field+*+* Set this define if the message data shall include the optional length+* field that indicates how many payload bytes follow.+*/+#define MIPI_SYST_PCFG_LENGTH_FIELD+ #endif++ #endif++ #if MIPI_SYST_CONFORMANCE_LEVEL > 20++/**+ * Enable message data CRC32 generation.+ */+#define MIPI_SYST_PCFG_ENABLE_CHECKSUM++ #endif /* #if MIPI_SYST_CONFORMANCE_LEVEL */++/** @} */++ #include "Platform.h"+#endif++#if defined (MIPI_SYST_PCFG_ENABLE_INLINE)+#define MIPI_SYST_INLINE static MIPI_SYST_CC_INLINE+#else+#define MIPI_SYST_INLINE MIPI_SYST_EXPORT+#endif++#define _MIPI_SYST_MK_MODUNIT_ORIGIN(m, u) (((u) & 0xF)|(m<<4))++/**+ * Location information inside a message (64-bit format)+ * Location is either the source position of the instrumentation call, or+ * the call instruction pointer value.+ */+union mipi_syst_msglocation32 {+ struct {+ #if defined (MIPI_SYST_BIG_ENDIAN)+ mipi_syst_u16 etls_lineNo; /**< line number in file */+ mipi_syst_u16 etls_fileID; /**< ID of instrumented file */+ #else+ mipi_syst_u16 etls_fileID; /**< ID of instrumented file */+ mipi_syst_u16 etls_lineNo; /**< line number in file */+ #endif+ } etls_source_location;++ mipi_syst_u32 etls_code_location : 32; /**< instruction pointer value */+};++/**+ * Location information inside a message (32-bit format)+ * Location is either the source position of the instrumentation call, or+ * the call instruction pointer value.+ */+union mipi_syst_msglocation64 {+ struct {+ #if defined (MIPI_SYST_BIG_ENDIAN)+ mipi_syst_u32 etls_lineNo; /**< line number in file */+ mipi_syst_u32 etls_fileID; /**< ID of instrumented file */+ #else+ mipi_syst_u32 etls_fileID; /**< ID of instrumented file */+ mipi_syst_u32 etls_lineNo; /**< line number in file */+ #endif+ } etls_source_location;+ mipi_syst_u64 etls_code_location; /**< instruction pointer value */+};++/**+ * Location information record descriptor+ */+struct mipi_syst_msglocation {+ /** Message format+ * 0 = 16-Bit file and 16-Bit line (total: 32-bit)+ * 1 = 32-Bit file and 32-Bit line (total: 64-bit)+ * 2 = 32-bit code address+ * 3 = 64-bit code address+ */+ mipi_syst_u8 el_format;+ union {+ union mipi_syst_msglocation32 loc32; /**< data for 32-bit variant */+ union mipi_syst_msglocation64 loc64; /**< data for 64-bit variant */+ } el_u;+};++#ifndef MIPI_SYST_API_INCLUDED+ #include "mipi_syst/api.h"+#endif++#endifdiff --git a/MdePkg/Library/MipiSysTLib/mipisyst b/MdePkg/Library/MipiSysTLib/mipisyst
new file mode 160000
index 0000000000..aae857d0d0
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/mipisyst
@@ -0,0 +1 @@
+Subproject commit aae857d0d05ac65152ed24992a4acd834a0a107c
diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml index 19bc0138cb..590cb85fd5 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -64,8 +64,10 @@
"Include/IndustryStandard/UefiTcgPlatform.h", "Include/Library/PcdLib.h", "Include/Library/SafeIntLib.h",+ "Include/Library/MipiSysTLib.h", "Include/Protocol/DebugSupport.h",- "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c"+ "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c",+ "Library/MipiSysTLib/mipi_syst.h" ] }, ## options defined ci/Plugin/CompilerPlugindiff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 3d08f20d15..bee7ac538a 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -26,6 +26,7 @@
[Includes] Include Test/UnitTest/Include+ Library/MipiSysTLib/mipisyst/library/include [Includes.IA32] Include/Ia32@@ -284,6 +285,10 @@
# ArmTrngLib|Include/Library/ArmTrngLib.h + ## @libraryclass Provides general mipi sys-T services.+ #+ MipiSysTLib|Include/Library/MipiSysTLib.h+ [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64] ## @libraryclass Provides services to generate random number. #diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 32a852dc46..cbcf4a6047 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -34,6 +34,7 @@
[LibraryClasses] SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf+ MipiSysTLib|MdePkg/Library/MipiSysTLib/MipiSysTLib.inf [Components] MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf@@ -135,6 +136,7 @@
MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf+ MdePkg/Library/MipiSysTLib/MipiSysTLib.inf [Components.IA32, Components.X64, Components.ARM, Components.AARCH64] #diff --git a/ReadMe.rst b/ReadMe.rst
index 497d963559..283f807ab5 100644
--- a/ReadMe.rst
+++ b/ReadMe.rst
@@ -95,6 +95,7 @@ that are covered by additional licenses.
- `UnitTestFrameworkPkg/Library/CmockaLib/cmocka <https://github.com/tianocore/edk2-cmocka/blob/f5e2cd77c88d9f792562888d2b70c5a396bfbf7a/COPYING>`__ - `UnitTestFrameworkPkg/Library/GoogleTestLib/googletest <https://github.com/google/googletest/blob/86add13493e5c881d7e4ba77fb91c1f57752b3a4/LICENSE>`__ - `RedfishPkg/Library/JsonLib/jansson <https://github.com/akheron/jansson/blob/2882ead5bb90cf12a01b07b2c2361e24960fae02/LICENSE>`__+- `MdePkg/Library/MipiSysTLib/mipisyst <https://github.com/MIPI-Alliance/public-mipi-sys-t/blob/aae857d0d05ac65152ed24992a4acd834a0a107c/LICENSE>`__ The EDK II Project is composed of packages. The maintainers for each package are listed in `Maintainers.txt <Maintainers.txt>`__.--
2.28.0.windows.1
next prev parent reply other threads:[~2023-01-31 3:17 UTC|newest]
Thread overview: 11+ 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
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 ` Guo, Gua [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-04-18 11:04 [PATCH 0/4] Trace Hub debug library support victorx.hsu
2023-04-18 11:04 ` [PATCH 1/4] MdePkg: Add MipiSysTLib library victorx.hsu
2023-05-08 5:31 [PATCH 0/4] Trace Hub debug library support victorx.hsu
2023-05-08 5:31 ` [PATCH 1/4] MdePkg: Add MipiSysTLib library victorx.hsu
2023-05-08 17:54 ` Michael D Kinney
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=BN9PR11MB5483C28581C91AD9B157ADDEEFD09@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