From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.115118.1683568494940989331 for ; Mon, 08 May 2023 10:54:55 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=FMVFv2ak; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683568494; x=1715104494; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=4oo7l3u1sHWYL+spnZTIfJssDDfXCGhWAYw5grvWHsE=; b=FMVFv2ak8/2c9g5cIKHQCMhPRMz3JMfEcx2REmLSIf4h5LOnYpC1rDJ9 OtM/lGxJXXvwTpeZmD6HLol9hUoV3+90CdYGPQ+joG+y2BshQEvg7lofY hyStfnr1ZYXR2iQTASsQwy/1QJojvyM3+pAcRZGEZm25ed2F1bYuIVLh5 T4LyYr8d6AL5xF6brTsY6GpGoByYkGuy97OayIYtqkpFKd67P0RiijeI5 mfTkqfN6/udQDbXz+oOW3O4URBMbXQ+Ci/49yQGzolRxUa7BzYg/mvQMZ 6U+4bQVBaNCbW278fyw8nXWtQ1fWTpq6TkyxwEwqK4x9FoEmtSfm5ct2r w==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="347182353" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="347182353" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 10:54:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="763486592" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="763486592" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga008.fm.intel.com with ESMTP; 08 May 2023 10:54:54 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 8 May 2023 10:54:53 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 8 May 2023 10:54:53 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.46) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 8 May 2023 10:54:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WzQ1imht1vyKImfKWNT0XnOXsozJ0qmEwQA/ycfLlKrFIRGrPd2q0AZhcmj++gei0v3OYSzRPIxuA/4ObfDyz0YlN4Q/pgye1zCPb9pyg8g4GF7CSQGI1QLki1SHeTgxFdbLxi5fKXccf1lyMOK+n0RyrG23824GiJkznWUewZq0sVZ3lizvKtUhYvDqV47N5T7FXSWh+iJf/UaKBJaxJ/r1W9RZNIqctW+NjvjTbX7Ivc9tRwGdEX2LDcIHz/zrRIqHZe9Szds3UtXnKEgdXchpH6FSeLwmcSr88hAUUL+qFW9uxostWhUnHLfKJR18xVcUbTTzUtJp+xxGnAyeOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d3pzz+HUTQPhUCcRyaZqinDE87528qQ/0/CI7x7qpDM=; b=MgOsSz51ZzW0FgOI2WLbGx/Oq+e3BUmKmqumB/10TZfADTl2wOeVs52Uuw3YbeCavCcX5CEhOZUEZw42WmCs5xNAyeoRAhSHC+Wm05L8oNIebSLg0E4RAx+v23JaCeWrj0pEToYGCQaBSznXDbscVlobsyu/BpMA/wQm0hMwvL9SW6Z+M86f5aFnXUuNKlL296PTh64UkZmYo+zo23JBsMl6uITBjlYzX6WhN5XJBhhonfulQZh1lMfVdvPQfz9uw865hY4yeZqaTn65svuK7ydsSUwtb70IAfa/NThtseGy3nKonogvSy7PaDGTtam0hQV3brJtN04se6uJaccNsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by DM4PR11MB8131.namprd11.prod.outlook.com (2603:10b6:8:190::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.31; Mon, 8 May 2023 17:54:48 +0000 Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::9b1e:23e9:53e:291]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::9b1e:23e9:53e:291%7]) with mapi id 15.20.6363.032; Mon, 8 May 2023 17:54:48 +0000 From: "Michael D Kinney" To: "Hsu, VictorX" , "devel@edk2.groups.io" CC: "Guo, Gua" , "Chan, Laura" , "Prakashan, Krishnadas Veliyathuparambil" , "K N, Karthik" , "Kinney, Michael D" Subject: Re: [PATCH 1/4] MdePkg: Add MipiSysTLib library Thread-Topic: [PATCH 1/4] MdePkg: Add MipiSysTLib library Thread-Index: AQHZgW6C3UYN1ZZVXE2+UWfa8CI0pK9QqMHg Date: Mon, 8 May 2023 17:54:48 +0000 Message-ID: References: <59aea36354ae4ef266ec1478104eb0d40c7d1d58.1683523672.git.victorx.hsu@intel.com> In-Reply-To: <59aea36354ae4ef266ec1478104eb0d40c7d1d58.1683523672.git.victorx.hsu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|DM4PR11MB8131:EE_ x-ms-office365-filtering-correlation-id: ea7e41dc-2e2d-4d02-53b0-08db4fed5091 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: giaGxGLxIyFr4ELVzTbgJ07N8aykjlo+8cDaADpKGqaaViWjNFFL9E02VK091Hw6MjxywsBovrNG3GwQzMpkgdbe8Mt2kE7IYZVyg5glao2jR/gf6KDJy72OAsWgRfc8MKQBjJoOJsc6MLv/MxkTqpbf/tkdgaqWAWbM5oZfjaM/UNpZgH7yN6zFCeGNmvmCVtLwHQ3GRmfnWtigVrxXcF+l32XNSnHwV5SpB5zjQOEbv/6gMAu3JtGJZKANrWNzWGx0oIiqcElxzkPJXFKrJUgmtfeLV096jLjOtBx1la59E+2CelQ0l2Ug4vTROKUJZT2XRBEG2tjSYokHoOdqoy/qBTs22aelSaWQr/bx+WXixPp+dX4Nv9JaZs/gYfCdcpQMmUNGqRePY/KP+9/VEqUYmO+DlmtDe8J8doUW1uNOgL5WzTxI66yCBNFQnXL5NoLw/e5lmQsLy8/dFTsraxtBGK1fUe30WcJih83N3RPIJiY+eL3emmDIBMKSgU1ACKv+MMY/FRf5oviDtAPcZEAZp90uLipPpziiQqX4PeTX8WJwJAEHC4cdwiuhIeHZGsnVl6dDDjGZZLZrsC3grzVRTt/R4GbuGKOsKSASiUzlkkn6LZ1T5tQDb4btH0BLkMod+ypVxq2rUId7pPYZHQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4929.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(366004)(376002)(346002)(39860400002)(136003)(451199021)(7696005)(9686003)(53546011)(6506007)(26005)(107886003)(966005)(83380400001)(55016003)(38100700002)(86362001)(122000001)(33656002)(38070700005)(186003)(82960400001)(19627235002)(110136005)(54906003)(2906002)(8936002)(316002)(8676002)(52536014)(41300700001)(76116006)(66946007)(64756008)(5660300002)(66556008)(66476007)(66446008)(4326008)(30864003)(478600001)(71200400001)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1qQ3qum6ZNBHMzAnCrwKtJcCnCTBePIkn2m9timgVDgg2rB75DthwfAvIoH+?= =?us-ascii?Q?JE91Uw3AaNbxzPLCVRvF4/21fHnD7hF7xxSuWghSrd/UGv0NHnS9cDWK93os?= =?us-ascii?Q?epKUqTJaGrVgQmQiSb/Ln8PMn7g0PCe2EUhmbcAAdCXFd0ict6162gi57mK5?= =?us-ascii?Q?10RNjc1fbo7Hzi/o02QW4+aOBrtQTydI1wbxPAEnalsQ8W2fQiztMcBbdpgG?= =?us-ascii?Q?3TT62QEEVMI0CvnhMGe6ui9LYn6pZDhxLZw+HaAteMcgBKqFwnVK90MCUPgT?= =?us-ascii?Q?D4IMKtZiS7ak2mChX2qW4w8LgtxQzgWafwVurBybGExlD5tGTyYflGRmhVvE?= =?us-ascii?Q?KdUtfIMyEeQoAVoL37qR7ZEKSzZ5mkj1O4x/eK5CutdcvR+Mi95qSr+fAX6V?= =?us-ascii?Q?BIZON1gtOJjX2MoRYBF8MCVlkPuZJzPmqG57GS3f6DGODV5E3RYDlA0Ocopf?= =?us-ascii?Q?PQY6TxZwh6uX4n2JWsQAZLhSbBMpnBCx+95r2SAenn4bHPelpnLEdbGm6rud?= =?us-ascii?Q?9EzV6NkrJ1R0fwwPI813OHmCEoaQV8zwaKFuRrgXI3TQ/6sN8ROXSe+JMDRk?= =?us-ascii?Q?z66AhiUkyua30xoipybXTbTNLKH2TGiLLEUBymaIh+3ozNBnIcxbhtBDdU7z?= =?us-ascii?Q?k2H/dW9IuK+JO3UEQbkDCAPhGUKncGkaMO35aHUW75aOHZJi/ybJSIw2pHgG?= =?us-ascii?Q?H22Puu4QHIUwgmbYAhs4j6y8rF36Iurey3jabSPcEfRCxTkHvStHl+zYnoHh?= =?us-ascii?Q?PzvYGMbZDMPEQ3Ss6DzqwogKxeQS3/Z/s3wAUSuIUBnH4nbHcjw0qRvqfYIj?= =?us-ascii?Q?T2S76kCcF9wBKZQf00SZDGRio221VihQ0mqEWMShpgk1JB1WxrPzT6Dcm+my?= =?us-ascii?Q?pHQJHP7/nBBsuhyDzX6TOVW5843s6sEHH/3j6Hi2wNHM4xI7nfCAefLRqJu5?= =?us-ascii?Q?R85jxWLIQXjSijcWsVpBJ6mlp9F8WGSezK4FJYkIbChu0TWb7wLC/SnjiLJ0?= =?us-ascii?Q?Hn1LqqmDn0cXRytvJROnuI5iIYzptdDab8g0J3iyvWJhvq7rwvDss57X0QLe?= =?us-ascii?Q?e7xFhlf7qtOMUd1WKcugAtHHVgg4Oz3Tj8iz2fvyhzBdzfCNd7iWKf4XoU5q?= =?us-ascii?Q?Ld9sJdAOn1kWDtVQbPQTL7SNL6ixxmDOYuDMhQfi7qNHy69PzZL+4rcR4Fif?= =?us-ascii?Q?MkJkfMMuLWX00MVKQmlpmG08mlgaTyrjAKe61sq6j8g8Ahtu0moRjNDudH+4?= =?us-ascii?Q?gqF9jiDAVgC0sur6NrFW8emhBA+fbk4VfMhCfd2r69W+AI1ViwxwWW92VKli?= =?us-ascii?Q?qhACdzrkWghmQV1icYa7fqwBia8Qkd8E9KyM/zeF89sxe7quOOiHFwiJvxjI?= =?us-ascii?Q?VxQegCy6HjiJNEoLJeSVgepHnb9o/dv74oR3Os4Eqp0VQaJFCEtsSUQ7QLTe?= =?us-ascii?Q?CzmUpITR6W2lXhoQFhq1L32zAzrAXxBi4BtIOsmm48qt+k6c6JufmWJNDnj4?= =?us-ascii?Q?X2Mpz/aO/cFqBh8evA+yvXxoLUmVVe/fodSc13aSejZqJW9D0Ub6kV1FjsZc?= =?us-ascii?Q?yrPTAdsnEiguuqjjRHTy+Ynqf/lzoVQBApzKd9kNsPOJJDV+u+snpf1noZ7+?= =?us-ascii?Q?Ng=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea7e41dc-2e2d-4d02-53b0-08db4fed5091 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 May 2023 17:54:48.0561 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8uvK9pNsyURsOlhTJy/FDEaMtdpB7YvLAXnu9J5TKvWHA2OQbEAZM4WBeoWWrpUPcAMYr3Cy2WDpwucBYt57rMmbbRTiln41elI9Onh2lzM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB8131 Return-Path: michael.d.kinney@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Update to INF to simplify [BuildOptions] section below. Mike > -----Original Message----- > From: Hsu, VictorX > Sent: Sunday, May 7, 2023 10:32 PM > To: devel@edk2.groups.io > Cc: Hsu, VictorX ; Kinney, Michael D > ; Guo, Gua ; Chan, Laura > ; Prakashan, Krishnadas Veliyathuparambil > ; K N, Karthik > > Subject: [PATCH 1/4] MdePkg: Add MipiSysTLib library >=20 > From: VictorX Hsu >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4144 >=20 > This Library provides functions consuming MIPI SYS-T submodule. >=20 > Cc: Michael D Kinney > Cc: Guo Gua > Cc: Chan Laura > Cc: Prakashan Krishnadas Veliyathuparambil > > Cc: K N Karthik > Signed-off-by: VictorX Hsu > --- > .gitmodules | 11 +- > .pytool/CISettings.py | 2 + > MdePkg/Include/Library/MipiSysTLib.h | 66 ++ > MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 ++++ > MdePkg/Library/MipiSysTLib/MipiSysTLib.c | 123 ++++ > MdePkg/Library/MipiSysTLib/MipiSysTLib.inf | 55 ++ > MdePkg/Library/MipiSysTLib/Platform.c | 164 +++++ > MdePkg/Library/MipiSysTLib/Platform.h | 138 ++++ > MdePkg/Library/MipiSysTLib/Readme.md | 25 + > MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +++++++++++++++++++++ > MdePkg/Library/MipiSysTLib/mipisyst | 1 + > MdePkg/MdePkg.ci.yaml | 12 +- > MdePkg/MdePkg.dec | 5 + > MdePkg/MdePkg.dsc | 1 + > ReadMe.rst | 1 + > 15 files changed, 1518 insertions(+), 7 deletions(-) > create mode 100644 MdePkg/Include/Library/MipiSysTLib.h > create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py > 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/Readme.md > create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h > create mode 160000 MdePkg/Library/MipiSysTLib/mipisyst >=20 > diff --git a/.gitmodules b/.gitmodules > index 6211c59724..fb79ebfb72 100644 > --- a/.gitmodules > +++ b/.gitmodules > @@ -16,7 +16,7 @@ > [submodule "BaseTools/Source/C/BrotliCompress/brotli"] > path =3D BaseTools/Source/C/BrotliCompress/brotli > url =3D https://github.com/google/brotli > - ignore =3D untracked >=20 > + ignore =3D untracked > [submodule "RedfishPkg/Library/JsonLib/jansson"] > path =3D RedfishPkg/Library/JsonLib/jansson > url =3D https://github.com/akheron/jansson > @@ -26,6 +26,9 @@ > [submodule "UnitTestFrameworkPkg/Library/SubhookLib/subhook"] > path =3D UnitTestFrameworkPkg/Library/SubhookLib/subhook > url =3D https://github.com/Zeex/subhook.git > -[submodule "MdePkg/Library/BaseFdtLib/libfdt"] >=20 > - path =3D MdePkg/Library/BaseFdtLib/libfdt >=20 > - url =3D https://github.com/devicetree-org/pylibfdt.git >=20 > +[submodule "MdePkg/Library/BaseFdtLib/libfdt"] > + path =3D MdePkg/Library/BaseFdtLib/libfdt > + url =3D https://github.com/devicetree-org/pylibfdt.git > +[submodule "MdePkg/Library/MipiSysTLib/mipisyst"] > + path =3D MdePkg/Library/MipiSysTLib/mipisyst > + url =3D https://github.com/MIPI-Alliance/public-mipi-sys-t.git > diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py > index 2fb99f2a17..6fb7342f81 100644 > --- a/.pytool/CISettings.py > +++ b/.pytool/CISettings.py > @@ -197,6 +197,8 @@ class Settings(CiBuildSettingsManager, > UpdateSettingsManager, SetupSettingsManag > "UnitTestFrameworkPkg/Library/SubhookLib/subhook", False)) >=20 > rs.append(RequiredSubmodule( >=20 > "MdePkg/Library/BaseFdtLib/libfdt", False)) >=20 > + rs.append(RequiredSubmodule( >=20 > + "MdePkg/Library/MipiSysTLib/mipisyst", False)) >=20 > return rs >=20 >=20 >=20 > def GetName(self): >=20 > diff --git a/MdePkg/Include/Library/MipiSysTLib.h > b/MdePkg/Include/Library/MipiSysTLib.h > new file mode 100644 > index 0000000000..4ced1c02cd > --- /dev/null > +++ b/MdePkg/Include/Library/MipiSysTLib.h > @@ -0,0 +1,66 @@ > +/** @file >=20 > +This header file declares functions consuming MIPI Sys-T submodule. >=20 > + >=20 > +Copyright (c) 2023, Intel Corporation. All rights reserved.
>=20 > + >=20 > +SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef MIPI_SYST_LIB_H_ >=20 > +#define MIPI_SYST_LIB_H_ >=20 > + >=20 > +/** >=20 > + Invoke initialization function in Mipi Sys-T module to initialize Mipi= Sys-T > handle. >=20 > + >=20 > + @param[in, out] MipiSystHandle A pointer to MIPI_SYST_HANDLE > structure. >=20 > + >=20 > + @retval RETURN_SUCCESS MIPI_SYST_HANDLE instance was initialized. >=20 > + @retval Other MIPI_SYST_HANDLE instance was not initiali= zed. >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +InitMipiSystHandle ( >=20 > + IN OUT VOID *MipiSystHandle >=20 > + ); >=20 > + >=20 > +/** >=20 > + Invoke write_debug_string function in Mipi Sys-T module. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Severity Severity type of input message. >=20 > + @param[in] Len Length of data buffer. >=20 > + @param[in] Str A pointer to data buffer. >=20 > + >=20 > + @retval RETURN_SUCCESS Data in buffer was processed. >=20 > + @retval RETURN_ABORTED No data need to be written to Tra= ce > Hub. >=20 > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str i= s > a NULL pointer. >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +MipiSystWriteDebug ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Severity, >=20 > + IN UINT16 Len, >=20 > + IN CONST CHAR8 *Str >=20 > + ); >=20 > + >=20 > +/** >=20 > + Invoke catalog_write_message function in Mipi Sys-T module. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Severity Severity type of input message. >=20 > + @param[in] CatId Catalog Id. >=20 > + >=20 > + @retval RETURN_SUCCESS Data in buffer was processed. >=20 > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a > NULL pointer. >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +MipiSystWriteCatalog ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Severity, >=20 > + IN UINT64 CatId >=20 > + ); >=20 > + >=20 > +#endif // MIPI_SYST_LIB_H_ >=20 > diff --git a/MdePkg/Library/MipiSysTLib/GenMipiSystH.py > b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py > new file mode 100644 > index 0000000000..ee48285590 > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py > @@ -0,0 +1,132 @@ > +## @file >=20 > +# This python script update content from mipi_syst.h.in in mipi sys-T > submodule >=20 > +# and generate it as mipi_syst.h. mipi_syst.h include necessary data > structure and >=20 > +# definition that will be consumed by MipiSysTLib itself, mipi sys-T > submodule >=20 > +# and other library. >=20 > +# >=20 > +# This script needs to be done once by a developer when adding some >=20 > +# project-relating definition or a new version of mipi_syst.h.in is rel= eased. >=20 > +# Normal users do not need to do this, since the resulting file is stor= ed >=20 > +# in the EDK2 git repository. >=20 > +# >=20 > +# Customize structures mentioned below to generate updated mipi_syst.h > file: >=20 > +# 1. ExistingValueToBeReplaced >=20 > +# -> To replace existing value in mipi_syst.h.in to newer one. >=20 > +# 2. ExistingDefinitionToBeRemoved >=20 > +# -> To #undef a existing definition in mipi_syst.h.in. >=20 > +# 3. NewItemToBeAdded >=20 > +# -> Items in this structure will be placed at the end of mipi_sys= t.h as a > customized section. >=20 > +# >=20 > +# Run GenMipiSystH.py without any parameters as normal python script > after customizing. >=20 > +# >=20 > +# Copyright (c) 2023, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > +import os >=20 > +import re >=20 > + >=20 > +# >=20 > +# A existing value to be customized should place this structure >=20 > +# Definitions in this customizable structure will be processed by > ReplaceOldValue() >=20 > +# e.g: >=20 > +# Before: @SYST_CFG_VERSION_MAJOR@ >=20 > +# After: 1 >=20 > +# >=20 > +ExistingValueToBeReplaced =3D [ >=20 > + ["@SYST_CFG_VERSION_MAJOR@", "1"], # Major version >=20 > + ["@SYST_CFG_VERSION_MINOR@", "0"], # Minor version >=20 > + ["@SYST_CFG_VERSION_PATCH@", "0"], # Patch version >=20 > + ["@SYST_CFG_CONFORMANCE_LEVEL@", "30"], # Feature level of mipi sys- > T submodule >=20 > + ["mipi_syst/platform.h", "Platform.h"], >=20 > +] >=20 > + >=20 > +# >=20 > +# A existing definition to be removed should place this structure >=20 > +# Definitions in this customizable structure will be processed by > RemoveDefinition() >=20 > +# e.g: >=20 > +# Before: >=20 > +# #define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA >=20 > +# After: >=20 > +# #define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA >=20 > +# #undef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA >=20 > +# >=20 > +ExistingDefinitionToBeRemoved =3D [ >=20 > + "MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA", >=20 > + "MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY", >=20 > + "MIPI_SYST_PCFG_ENABLE_PRINTF_API", >=20 > + "MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD", >=20 > + "MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS", >=20 > +] >=20 > + >=20 > +# >=20 > +# Items in this structure will be placed at the end of mipi_syst.h as a > customized section. >=20 > +# >=20 > +NewItemToBeAdded =3D [ >=20 > + "typedef struct mipi_syst_handle_flags MIPI_SYST_HANDLE_FLAGS;", >=20 > + "typedef struct mipi_syst_msg_tag MIPI_SYST_MSG_TAG;", >=20 > + "typedef struct mipi_syst_guid MIPI_SYST_GUID;", >=20 > + "typedef enum mipi_syst_severity MIPI_SYST_SEVERITY;", >=20 > + "typedef struct mipi_syst_handle MIPI_SYST_HANDLE;", >=20 > + "typedef struct mipi_syst_header MIPI_SYST_HEADER;", >=20 > +] >=20 > + >=20 > +def ProcessSpecialCharacter(Str): >=20 > + Str =3D Str.rstrip(" \n") >=20 > + Str =3D Str.replace("\t", " ") >=20 > + Str +=3D "\n" >=20 > + return Str >=20 > + >=20 > +def ReplaceOldValue(Str): >=20 > + for i in range(len(ExistingValueToBeReplaced)): >=20 > + Result =3D re.search(ExistingValueToBeReplaced[i][0], Str) >=20 > + if Result is not None: >=20 > + Str =3D Str.replace(ExistingValueToBeReplaced[i][0], > ExistingValueToBeReplaced[i][1]) >=20 > + break >=20 > + return Str >=20 > + >=20 > +def RemoveDefinition(Str): >=20 > + Result =3D re.search("\*", Str) >=20 > + if Result is None: >=20 > + for i in range(len(ExistingDefinitionToBeRemoved)): >=20 > + Result =3D re.search(ExistingDefinitionToBeRemoved[i], Str) >=20 > + if Result is not None: >=20 > + Result =3D re.search("defined", Str) >=20 > + if Result is None: >=20 > + Str =3D Str + "#undef " + ExistingDefinitionToBeRemo= ved[i] >=20 > + break >=20 > + return Str >=20 > + >=20 > +def main(): >=20 > + MipiSystHSrcDir =3D "mipisyst/library/include/mipi_syst.h.in" >=20 > + MipiSystHRealSrcDir =3D os.path.join(os.getcwd(), > os.path.normpath(MipiSystHSrcDir)) >=20 > + MipiSystHRealDstDir =3D os.path.join(os.getcwd(), "mipi_syst.h") >=20 > + >=20 > + # >=20 > + # Read content from mipi_syst.h.in and process each line by demand >=20 > + # >=20 > + with open(MipiSystHRealSrcDir, "r") as rfObj: >=20 > + SrcFile =3D rfObj.readlines() >=20 > + for lineIndex in range(len(SrcFile)): >=20 > + SrcFile[lineIndex] =3D ProcessSpecialCharacter(SrcFile[lineI= ndex]) >=20 > + SrcFile[lineIndex] =3D ReplaceOldValue(SrcFile[lineIndex]) >=20 > + SrcFile[lineIndex] =3D RemoveDefinition(SrcFile[lineIndex]) >=20 > + >=20 > + # >=20 > + # Typedef a structure or enum type >=20 > + # >=20 > + i =3D -1 >=20 > + for struct in NewItemToBeAdded: >=20 > + struct +=3D "\n" >=20 > + SrcFile.insert(i, struct) >=20 > + i -=3D 1 >=20 > + >=20 > + # >=20 > + # Save edited content to mipi_syst.h >=20 > + # >=20 > + with open(MipiSystHRealDstDir, "w") as wfObj: >=20 > + wfObj.writelines(SrcFile) >=20 > + >=20 > +if __name__ =3D=3D '__main__': >=20 > + main() >=20 > diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.c > b/MdePkg/Library/MipiSysTLib/MipiSysTLib.c > new file mode 100644 > index 0000000000..3a15a2af58 > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/MipiSysTLib.c > @@ -0,0 +1,123 @@ > +/** @file >=20 > +This file provide functions to communicate with mipi sys-T submodule. >=20 > + >=20 > +Copyright (c) 2023, Intel Corporation. All rights reserved.
>=20 > + >=20 > +SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include "mipi_syst.h" >=20 > + >=20 > +/** >=20 > + Invoke initialization function in Mipi Sys-T module to initialize Mipi= Sys-T > handle. >=20 > + >=20 > + @param[in, out] MipiSystHandle A pointer to MIPI_SYST_HANDLE > structure. >=20 > + >=20 > + @retval RETURN_SUCCESS MIPI_SYST_HANDLE instance was initialized. >=20 > + @retval Other MIPI_SYST_HANDLE instance was not initiali= zed. >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +InitMipiSystHandle ( >=20 > + IN OUT VOID *MipiSystHandle >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + if (MipiSystH =3D=3D NULL) { >=20 > + return RETURN_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + mipi_syst_init (MipiSystH->systh_header, 0, NULL); >=20 > + >=20 > + return RETURN_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Invoke write_debug_string function in Mipi Sys-T module. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Severity Severity type of input message. >=20 > + @param[in] Len Length of data buffer. >=20 > + @param[in] Str A pointer to data buffer. >=20 > + >=20 > + @retval RETURN_SUCCESS Data in buffer was processed. >=20 > + @retval RETURN_ABORTED No data need to be written to Tra= ce > Hub. >=20 > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str i= s > a NULL pointer. >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +MipiSystWriteDebug ( >=20 > + IN MIPI_SYST_HANDLE *MipiSystHandle, >=20 > + IN UINT32 Severity, >=20 > + IN UINT16 Len, >=20 > + IN CONST CHAR8 *Str >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + if (MipiSystH =3D=3D NULL) { >=20 > + return RETURN_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + if (Len =3D=3D 0) { >=20 > + // >=20 > + // No data need to be written to Trace Hub >=20 > + // >=20 > + return RETURN_ABORTED; >=20 > + } >=20 > + >=20 > + if (Str =3D=3D NULL) { >=20 > + return RETURN_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + mipi_syst_write_debug_string ( >=20 > + MipiSystH, >=20 > + MIPI_SYST_NOLOCATION, >=20 > + MIPI_SYST_STRING_GENERIC, >=20 > + Severity, >=20 > + Len, >=20 > + Str >=20 > + ); >=20 > + >=20 > + return RETURN_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Invoke catalog_write_message function in Mipi Sys-T module. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Severity Severity type of input message. >=20 > + @param[in] CatId Catalog Id. >=20 > + >=20 > + @retval RETURN_SUCCESS Data in buffer was processed. >=20 > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a > NULL pointer. >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +MipiSystWriteCatalog ( >=20 > + IN MIPI_SYST_HANDLE *MipiSystHandle, >=20 > + IN UINT32 Severity, >=20 > + IN UINT64 CatId >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + if (MipiSystH =3D=3D NULL) { >=20 > + return RETURN_INVALID_PARAMETER; >=20 > + } >=20 > + >=20 > + mipi_syst_write_catalog64_message ( >=20 > + MipiSystH, >=20 > + MIPI_SYST_NOLOCATION, >=20 > + Severity, >=20 > + CatId >=20 > + ); >=20 > + >=20 > + return RETURN_SUCCESS; >=20 > +} >=20 > diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > new file mode 100644 > index 0000000000..b2aefcc9cc > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > @@ -0,0 +1,55 @@ > +## @file >=20 > +# A library providing funcitons to communicate with mipi sys-T submodul= e. >=20 > +# >=20 > +# Copyright (c) 2023, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D MipiSysTLib >=20 > + FILE_GUID =3D A58B0510-9E6D-4747-95D8-E5B8AF4633E= 6 >=20 > + MODULE_TYPE =3D BASE >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D MipiSysTLib >=20 > + >=20 > + DEFINE MIPI_HEADER_PATH =3D mipisyst/library/include/mipi_syst >=20 > + DEFINE MIPI_SOURCE_PATH =3D mipisyst/library/src >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e > build tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 >=20 > +# >=20 > + >=20 > +[LibraryClasses] >=20 > + IoLib >=20 > + BaseMemoryLib >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + >=20 > +[Sources] >=20 > + MipiSysTLib.c >=20 > + mipi_syst.h >=20 > + Platform.c >=20 > + Platform.h >=20 > + $(MIPI_HEADER_PATH)/api.h >=20 > + $(MIPI_HEADER_PATH)/crc32.h >=20 > + $(MIPI_HEADER_PATH)/compiler.h >=20 > + $(MIPI_HEADER_PATH)/message.h >=20 > + $(MIPI_HEADER_PATH)/inline.h >=20 > + $(MIPI_SOURCE_PATH)/mipi_syst_init.c >=20 > + $(MIPI_SOURCE_PATH)/mipi_syst_api.c >=20 > + $(MIPI_SOURCE_PATH)/mipi_syst_crc32.c >=20 > + $(MIPI_SOURCE_PATH)/mipi_syst_writer.c >=20 > + $(MIPI_SOURCE_PATH)/mipi_syst_inline.c >=20 > + $(MIPI_SOURCE_PATH)/mipi_syst_compiler.c >=20 > + >=20 > +[BuildOptions] >=20 > + MSFT:*_*_IA32_CC_FLAGS =3D /DMIPI_SYST_STATIC >=20 > + MSFT:*_*_X64_CC_FLAGS =3D /DMIPI_SYST_STATIC >=20 > + GCC:*_*_IA32_CC_FLAGS =3D -DMIPI_SYST_STATIC >=20 > + GCC:*_*_X64_CC_FLAGS =3D -DMIPI_SYST_STATIC MSFT and GCC both support -D, and this can be further simplified to a singl= e line by removing arch specific statements *_*_*_CC_FLAGS =3D -DMIPI_SYST_STATIC >=20 > diff --git a/MdePkg/Library/MipiSysTLib/Platform.c > b/MdePkg/Library/MipiSysTLib/Platform.c > new file mode 100644 > index 0000000000..90a524bc1e > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/Platform.c > @@ -0,0 +1,164 @@ > +/** @file >=20 > +This file defines functions that output Trace Hub message. >=20 > + >=20 > +Copyright (c) 2023, Intel Corporation. All rights reserved.
>=20 > + >=20 > +SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include "mipi_syst.h" >=20 > + >=20 > +/** >=20 > + Write 4 bytes to Trace Hub MMIO addr + 0x10. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD32Ts ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite32 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x10), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Write 4 bytes to Trace Hub MMIO addr + 0x18. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD32Mts ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite32 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x18), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Write 8 bytes to Trace Hub MMIO addr + 0x18. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD64Mts ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT64 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite64 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x18), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Write 1 byte to Trace Hub MMIO addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD8 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT8 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite8 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Write 2 bytes to Trace Hub MMIO mmio addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD16 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT16 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite16 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Write 4 bytes to Trace Hub MMIO addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD32 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite32 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Write 8 bytes to Trace Hub MMIO addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD64 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT64 Data >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + MmioWrite64 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data); >=20 > +} >=20 > + >=20 > +/** >=20 > + Clear data in Trace Hub MMIO addr + 0x30. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteFlag ( >=20 > + IN VOID *MipiSystHandle >=20 > + ) >=20 > +{ >=20 > + MIPI_SYST_HANDLE *MipiSystH; >=20 > + >=20 > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; >=20 > + >=20 > + MmioWrite32 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x30), 0x0); >=20 > +} >=20 > diff --git a/MdePkg/Library/MipiSysTLib/Platform.h > b/MdePkg/Library/MipiSysTLib/Platform.h > new file mode 100644 > index 0000000000..ac77edf33d > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/Platform.h > @@ -0,0 +1,138 @@ > +/** @file >=20 > +This header file declares functions and structures. >=20 > + >=20 > +Copyright (c) 2023, Intel Corporation. All rights reserved.
>=20 > + >=20 > +SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef MIPI_SYST_PLATFORM_H_ >=20 > +#define MIPI_SYST_PLATFORM_H_ >=20 > + >=20 > +typedef struct { >=20 > + UINT64 MmioAddr; >=20 > +} TRACE_HUB_PLATFORM_SYST_DATA; >=20 > + >=20 > +struct mipi_syst_platform_handle { >=20 > + TRACE_HUB_PLATFORM_SYST_DATA TraceHubPlatformData; >=20 > +}; >=20 > + >=20 > +/** >=20 > + Write 4 bytes to Trace Hub MMIO addr + 0x10. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD32Ts ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Write 4 bytes to Trace Hub MMIO addr + 0x18. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD32Mts ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Write 8 bytes to Trace Hub MMIO addr + 0x18. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD64Mts ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT64 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Write 1 byte to Trace Hub MMIO addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD8 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT8 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Write 2 bytes to Trace Hub MMIO mmio addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD16 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT16 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Write 4 bytes to Trace Hub MMIO addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD32 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT32 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Write 8 bytes to Trace Hub MMIO addr + 0x0. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > + @param[in] Data Data to be written. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteD64 ( >=20 > + IN VOID *MipiSystHandle, >=20 > + IN UINT64 Data >=20 > + ); >=20 > + >=20 > +/** >=20 > + Clear data in Trace Hub MMIO addr + 0x30. >=20 > + >=20 > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +MipiSystWriteFlag ( >=20 > + IN VOID *MipiSystHandle >=20 > + ); >=20 > + >=20 > +#define MIPI_SYST_PLATFORM_CLOCK() 1000 // (unit: MicroSecond) >=20 > + >=20 > +#ifndef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA >=20 > +#define MIPI_SYST_OUTPUT_D32TS(MipiSystHandle, Data) > MipiSystWriteD32Ts ((MipiSystHandle), (Data)) >=20 > +#define MIPI_SYST_OUTPUT_D32MTS(MipiSystHandle, Data) > MipiSystWriteD32Mts ((MipiSystHandle), (Data)) >=20 > +#define MIPI_SYST_OUTPUT_D64MTS(MipiSystHandle, Data) > MipiSystWriteD64Mts ((MipiSystHandle), (Data)) >=20 > +#define MIPI_SYST_OUTPUT_D8(MipiSystHandle, Data) MipiSystWriteD8 > ((MipiSystHandle), (Data)) >=20 > +#define MIPI_SYST_OUTPUT_D16(MipiSystHandle, Data) MipiSystWriteD16 > ((MipiSystHandle), (Data)) >=20 > +#define MIPI_SYST_OUTPUT_D32(MipiSystHandle, Data) MipiSystWriteD32 > ((MipiSystHandle), (Data)) >=20 > + #if defined (MIPI_SYST_PCFG_ENABLE_64BIT_IO) >=20 > +#define MIPI_SYST_OUTPUT_D64(MipiSystHandle, Data) MipiSystWriteD64 > ((MipiSystHandle), (Data)) >=20 > + #endif >=20 > +#define MIPI_SYST_OUTPUT_FLAG(MipiSystHandle) MipiSystWriteFlag > ((MipiSystHandle)) >=20 > +#endif >=20 > + >=20 > +#endif // MIPI_SYST_PLATFORM_H_ >=20 > diff --git a/MdePkg/Library/MipiSysTLib/Readme.md > b/MdePkg/Library/MipiSysTLib/Readme.md > new file mode 100644 > index 0000000000..2e5df0194e > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/Readme.md > @@ -0,0 +1,25 @@ > +## Introduction of MipiSysTLib ## >=20 > +MipiSysTLib library is a upper level library consuming MIPI SYS-T submod= ule. >=20 > +It provides MIPI-related APIs in EDK2 format to be consumed. >=20 > + >=20 > +## MipiSysTLib Version ## >=20 > +EDK2 supports building with v1.1+edk2 official version which was fully > validated. >=20 > + >=20 > +## HOW to Install MipiSysTLib for UEFI Building ## >=20 > +MIPI SYS-T repository was added as a submodule of EDK2 project. Please >=20 > +refer to edk2/Readme.md for how to clone the code. >=20 > + >=20 > +## About GenMipiSystH.py ## >=20 > +"GenMipiSystH.py" is a Python script which is used for customizing the >=20 > +mipi_syst.h.in in mipi sys-T repository. The resulting file, mipi_syst.h= , will >=20 > +be put to same folder level as this script. >=20 > +``` >=20 > + mipisyst submodule MipiSysTLib library >=20 > +|---------------------| GenMipiSystH.py |---------------------| >=20 > +| mipi_syst.h.in |-----------------> | mipi_syst.h | >=20 > +|---------------------| |---------------------| >=20 > +``` >=20 > +This script needs to be done once by a developer when adding some >=20 > +project-related definition or a new version of mipi_syst.h.in was releas= ed. >=20 > +Normal users do not need to do this, since the resulting file is stored >=20 > +in the EDK2 git repository. >=20 > diff --git a/MdePkg/Library/MipiSysTLib/mipi_syst.h > b/MdePkg/Library/MipiSysTLib/mipi_syst.h > new file mode 100644 > index 0000000000..3cf67a1ee5 > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/mipi_syst.h > @@ -0,0 +1,789 @@ > +/* >=20 > +Copyright (c) 2018, MIPI Alliance, Inc. >=20 > +All rights reserved. >=20 > + >=20 > +Redistribution and use in source and binary forms, with or without >=20 > +modification, are permitted provided that the following conditions >=20 > +are met: >=20 > + >=20 > +* Redistributions of source code must retain the above copyright >=20 > + notice, this list of conditions and the following disclaimer. >=20 > + >=20 > +* Redistributions in binary form must reproduce the above copyright >=20 > + notice, this list of conditions and the following disclaimer in >=20 > + the documentation and/or other materials provided with the >=20 > + distribution. >=20 > + >=20 > +* Neither the name of the copyright holder nor the names of its >=20 > + contributors may be used to endorse or promote products derived >=20 > + from this software without specific prior written permission. >=20 > + >=20 > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS >=20 > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >=20 > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR >=20 > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT >=20 > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, >=20 > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >=20 > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, >=20 > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY >=20 > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >=20 > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE > USE >=20 > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >=20 > +*/ >=20 > + >=20 > +/* >=20 > + * Contributors: >=20 > + * Norbert Schulz (Intel Corporation) - Initial API and implementation >=20 > + */ >=20 > + >=20 > +#ifndef MIPI_SYST_H_INCLUDED >=20 > +#define MIPI_SYST_H_INCLUDED >=20 > + >=20 > +/* SyS-T API version information >=20 > + */ >=20 > +#define MIPI_SYST_VERSION_MAJOR 1 /**< Major version, incremented if > API changes */ >=20 > +#define MIPI_SYST_VERSION_MINOR 0 /**< Minor version, incremented on > compatible extensions */ >=20 > +#define MIPI_SYST_VERSION_PATCH 0 /**< Patch for existing major, minor= , > usually 0 */ >=20 > + >=20 > +/** Define SyS-T API conformance level >=20 > + * >=20 > + * 10 =3D minimal (only short events) >=20 > + * 20 =3D low overhead (exluding varag functions and CRC32) >=20 > + * 30 =3D full implementation >=20 > + */ >=20 > +#define MIPI_SYST_CONFORMANCE_LEVEL 30 >=20 > + >=20 > +/** Compute SYS-T version value >=20 > + * >=20 > + * Used to compare SYS-T Major.Minor.patch versions numerically at > runtime. >=20 > + * >=20 > + * @param ma major version number >=20 > + * @param mi minor version number >=20 > + * @param p patch version number >=20 > + * >=20 > + * Example: >=20 > + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c} >=20 > + * >=20 > + * #if MIPI_SYST_VERSION_CODE >=3D MIPI_SYST_MAKE_VERSION_CODE(1,5,0) >=20 > + * // do what only >=3D 1.5.x supports >=20 > + * #endif >=20 > + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > + */ >=20 > +#define MIPI_SYST_MAKE_VERSION_CODE(ma, mi, p) (((ma) << 16) | ((mi)<<8) > | (p)) >=20 > + >=20 > +/** Numeric SYS-T version code */ >=20 > +#define MIPI_SYST_VERSION_CODE MIPI_SYST_MAKE_VERSION_CODE(\ >=20 > + MIPI_SYST_VERSION_MAJOR,\ >=20 > + MIPI_SYST_VERSION_MINOR,\ >=20 > + MIPI_SYST_VERSION_PATCH) >=20 > + >=20 > +/* Macros to trick numeric values like __LINE__ into a string >=20 > + */ >=20 > +#define _MIPI_SYST_STRINGIFY(x) #x >=20 > +#define _MIPI_SYST_CPP_TOSTR(x) _MIPI_SYST_STRINGIFY(x) >=20 > + >=20 > +#define _MIPI_SYST_VERSION_STRING(a, b, c)\ >=20 > + > _MIPI_SYST_CPP_TOSTR(a)"."_MIPI_SYST_CPP_TOSTR(b)"."_MIPI_SYST_CPP_TO > STR(c) >=20 > + >=20 > +/** Textual version string */ >=20 > +#define MIPI_SYST_VERSION_STRING \ >=20 > + _MIPI_SYST_VERSION_STRING(\ >=20 > + MIPI_SYST_VERSION_MAJOR,\ >=20 > + MIPI_SYST_VERSION_MINOR,\ >=20 > + MIPI_SYST_VERSION_PATCH) >=20 > + >=20 > +#ifndef MIPI_SYST_COMPILER_INCLUDED >=20 > +#include "mipi_syst/compiler.h" >=20 > +#endif >=20 > + >=20 > +/* String hash macros for compile time computation of catalog ID's. >=20 > + * Notes: >=20 > + * These macros will only be used with optimized builds, otherwise >=20 > + * a lot of runtime code will be generated. >=20 > + * >=20 > + * Only the last 64 bytes of the string are considered for hashing >=20 > + */ >=20 > +#define _MIPI_SYST_HASH1(s,i,x,l) (x*65599u+(mipi_syst_u8)s[(i)<(l)?((l= )-1- > (i)):(l)]) >=20 > +#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,_MIP > I_SYST_HASH1(s,i+3,x,l),l),l),l) >=20 > +#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,_MIP > I_SYST_HASH4(s,i+12,x,l),l),l),l) >=20 > +#define _MIPI_SYST_HASH64(s,i,x,l) > _MIPI_SYST_HASH16(s,i,_MIPI_SYST_HASH16(s,i+16,_MIPI_SYST_HASH16(s,i+3 > 2,_MIPI_SYST_HASH16(s,i+48,x,l),l),l),l) >=20 > + >=20 > +#define _MIPI_SYST_HASH_x65599(s,l) > ((mipi_syst_u32)_MIPI_SYST_HASH64(s,0,0,l)) >=20 > + >=20 > +#define _MIPI_SYST_HASH_AT_CPP_TIME(str, offset) > (_MIPI_SYST_HASH_x65599(str, sizeof(str)-1) + (offset)) >=20 > +#define _MIPI_SYST_HASH_AT_RUN_TIME(str, offset) > (mipi_syst_hash_x65599(str, sizeof(str)-1) + (offset)) >=20 > + >=20 > +#if defined(_MIPI_SYST_OPTIMIZER_ON) >=20 > +#define MIPI_SYST_HASH(a, b) _MIPI_SYST_HASH_AT_CPP_TIME((a), (b)) >=20 > +#else >=20 > +#define MIPI_SYST_HASH(a, b) _MIPI_SYST_HASH_AT_RUN_TIME((a),(b)) >=20 > +#endif >=20 > + >=20 > +#if defined(__cplusplus) >=20 > +extern "C" { >=20 > +#endif >=20 > + >=20 > +/** Major Message Types >=20 > + */ >=20 > +enum mipi_syst_msgtype { >=20 > + MIPI_SYST_TYPE_BUILD =3D 0, /**< client build id message */ >=20 > + MIPI_SYST_TYPE_SHORT32 =3D 1, /**< value only message */ >=20 > + MIPI_SYST_TYPE_STRING =3D 2, /**< text message output */ >=20 > + MIPI_SYST_TYPE_CATALOG =3D 3, /**< catalog message output */ >=20 > + MIPI_SYST_TYPE_RAW =3D 6, /**< raw binary data */ >=20 > + MIPI_SYST_TYPE_SHORT64 =3D 7, /**< value only message */ >=20 > + MIPI_SYST_TYPE_CLOCK =3D 8, /**< clock sync message */ >=20 > + >=20 > + MIPI_SYST_TYPE_MAX >=20 > +}; >=20 > + >=20 > +/** MIPI_SYST_TYPE_DEBUG_STRING Sub-Types >=20 > + */ >=20 > +enum mipi_syst_subtype_string { >=20 > + MIPI_SYST_STRING_GENERIC =3D 1, /**< string generic debug = */ >=20 > + MIPI_SYST_STRING_FUNCTIONENTER =3D 2, /**< string is function name = */ >=20 > + MIPI_SYST_STRING_FUNCTIONEXIT =3D 3, /**< string is function name = */ >=20 > + MIPI_SYST_STRING_INVALIDPARAM =3D 5, /**< invalid SyS-T APIcall = */ >=20 > + MIPI_SYST_STRING_ASSERT =3D 7, /**< Software Assert: failure = */ >=20 > + MIPI_SYST_STRING_PRINTF_32 =3D 11, /**< printf with 32-bit packing= */ >=20 > + MIPI_SYST_STRING_PRINTF_64 =3D 12, /**< printf with 64-bit packing= */ >=20 > + >=20 > + MIPI_SYST_STRING_MAX >=20 > +}; >=20 > + >=20 > +/** MIPI_SYST_TYPE_CATALOG Sub-Types >=20 > + */ >=20 > +enum mipi_syst_subtype_catalog { >=20 > + MIPI_SYST_CATALOG_ID32_P32 =3D 1, /**< 32-bit catalog ID, 32-bit pac= king > */ >=20 > + MIPI_SYST_CATALOG_ID64_P32 =3D 2, /**< 64-bit catalog ID, 32-bit pac= king > */ >=20 > + MIPI_SYST_CATALOG_ID32_P64 =3D 5, /**< 32-bit catalog ID, 64-bit pac= king > */ >=20 > + MIPI_SYST_CATALOG_ID64_P64 =3D 6, /**< 64-bit catalog ID, 64-bit pac= king > */ >=20 > + >=20 > + MIPI_SYST_CATALOG_MAX >=20 > +}; >=20 > + >=20 > +/** MIPI_SYST_TYPE_CLOCK Sub-Types >=20 > + */ >=20 > +enum mipi_syst_subtype_clock{ >=20 > + MIPI_SYST_CLOCK_TRANSPORT_SYNC =3D 1, /**< SyS-T clock & frequency > sync */ >=20 > + MIPI_SYST_CLOCK_MAX >=20 > +}; >=20 > + >=20 > +enum mipi_syst_subtype_build { >=20 > + MIPI_SYST_BUILD_ID_COMPACT32 =3D 0, /**< compact32 build id */ >=20 > + MIPI_SYST_BUILD_ID_COMPACT64 =3D 1, /**< compact64 build id */ >=20 > + MIPI_SYST_BUILD_ID_LONG =3D 2, /**< normal build message */ >=20 > + MIPI_SYST_BUILD_MAX >=20 > +}; >=20 > + >=20 > +struct mipi_syst_header; >=20 > +struct mipi_syst_handle; >=20 > +struct mipi_syst_scatter_prog; >=20 > + >=20 > +/** 128-bit GUID style message origin ID */ >=20 > +struct mipi_syst_guid { >=20 > + union { >=20 > + mipi_syst_u8 b[16]; >=20 > + mipi_syst_u64 ll[2]; >=20 > + } u; >=20 > +}; >=20 > + >=20 > +/** GUID initializer code >=20 > + * >=20 > + * This macro simplifies converting a GUID from its string representatio= n >=20 > + * into the mipi_syst_guid data structure. The following example shows >=20 > + * how the values from a GUID string are used with the macro. Each numer= ic >=20 > + * component from the GUID string gets converted into a hex value > parameter >=20 > + * when invoking the macro. >=20 > + * >=20 > + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c} >=20 > + * >=20 > + * // Guid: f614b99d-99a1-4c04-8c30-90999ab5fe05 >=20 > + * >=20 > + * struct mipi_syst_guid guid =3D >=20 > + * MIPI_SYST_GEN_GUID(0xf614b99d, 0x99a1, 0x4c04, 0x8c30, > 0x90999ab5fe05); >=20 > + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > + */ >=20 > +#define MIPI_SYST_GEN_GUID(l1, w1, w2, w3, l2) \ >=20 > + {{\ >=20 > + (mipi_syst_u8)((mipi_syst_u32)(l1) >> 24), \ >=20 > + (mipi_syst_u8)((mipi_syst_u32)(l1) >> 16), \ >=20 > + (mipi_syst_u8)((mipi_syst_u32)(l1) >> 8), \ >=20 > + (mipi_syst_u8)((mipi_syst_u32)(l1) >> 0), \ >=20 > + (mipi_syst_u8)((mipi_syst_u16)(w1) >> 8), \ >=20 > + (mipi_syst_u8)((mipi_syst_u16)(w1) >> 0), \ >=20 > + (mipi_syst_u8)((mipi_syst_u16)(w2) >> 8), \ >=20 > + (mipi_syst_u8)((mipi_syst_u16)(w2) >> 0), \ >=20 > + (mipi_syst_u8)((mipi_syst_u16)(w3) >> 8), \ >=20 > + (mipi_syst_u8)((mipi_syst_u16)(w3) >> 0), \ >=20 > + (mipi_syst_u8)((mipi_syst_u64)(l2) >> 40), \ >=20 > + (mipi_syst_u8)((mipi_syst_u64)(l2) >> 32), \ >=20 > + (mipi_syst_u8)((mipi_syst_u64)(l2) >> 24), \ >=20 > + (mipi_syst_u8)((mipi_syst_u64)(l2) >> 16), \ >=20 > + (mipi_syst_u8)((mipi_syst_u64)(l2) >> 8), \ >=20 > + (mipi_syst_u8)((mipi_syst_u64)(l2) >> 0) \ >=20 > + }} >=20 > + >=20 > + /** SyS-T client origin data >=20 > + * >=20 > + * This structure holds the GUID or header origin and unit data >=20 > + * used by SyS-T handles. The structure gets passed into the handle >=20 > + * creation functions to initialize the values that identify clients. >=20 > + * @see MIPI_SYST_SET_HANDLE_GUID_UNIT >=20 > + * @see MIPI_SYST_SET_HANDLE_MODULE_UNIT >=20 > + * @see MIPI_SYST_SET_HANDLE_ORIGIN >=20 > + */ >=20 > +struct mipi_syst_origin { >=20 > + struct mipi_syst_guid guid; /**< origin GUID or module value */ >=20 > + mipi_syst_u16 unit; /**< unit value */ >=20 > +}; >=20 > + >=20 > +/** Origin structure initializer code using GUID >=20 > +* >=20 > +* This macro simplifies initializing a mipi_syst_origin structure. The >=20 > +* first 5 parameters are GUID values as used by the MIPI_SYST_GEN_GUID >=20 > +* macro. The last parameter is the unit value (11-Bits). >=20 > +* @see MIPI_SYST_GEN_GUID >=20 > +* >=20 > +* >=20 > +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c} >=20 > +* >=20 > +* // Guid: {494E5443-B659-45AF-B786-9DB0786248AE} >=20 > + >=20 > +* >=20 > +* struct mipi_syst_origin =3D origin >=20 > +* MIPI_SYST_GEN_ORIGIN_GUID( >=20 > +* 0x494E5443, 0xB659, 0x45AF, 0xB786, 0x9DB0786248AE, >=20 > +* 0x1); >=20 > +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > +*/ >=20 > +#define MIPI_SYST_GEN_ORIGIN_GUID(l1, w1, w2, w3, l2 , u) \ >=20 > + {\ >=20 > + MIPI_SYST_GEN_GUID(l1, w1, w2, w3, l2) ,\ >=20 > + u\ >=20 > + } >=20 > + >=20 > +/** Origin structure initializer code using header module value >=20 > +* >=20 > +* This macro simplifies initializing a mipi_syst_origin structure. The >=20 > +* first parameter is the header origin value (7-Bits). The second parame= ter >=20 > +* is the unit value (4-bits) >=20 > +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c} >=20 > +* >=20 > +* // Guid: {494E5443-B659-45AF-B786-9DB0786248AE} >=20 > + >=20 > +* #define MODULE_X 0x10 >=20 > +* struct mipi_syst_origin =3D >=20 > +* MIPI_SYST_GEN_ORIGIN_MODULE(MODULE_X, 0x1); >=20 > +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > +*/ >=20 > +#define MIPI_SYST_GEN_ORIGIN_MODULE(m , u) \ >=20 > + {\ >=20 > + MIPI_SYST_GEN_GUID(0,0,0, ((mipi_syst_u16)(m & 0x7F)) << 8, 0 ),\ >=20 > + u\ >=20 > + } >=20 > +/** >=20 > + * Global state initialization hook definition >=20 > + * >=20 > + * This function gets called in the context of the mipi_syst_init() API >=20 > + * function after the generic state members of the global state >=20 > + * structure syst_hdr have been setup. It's purpose is to initialize the >=20 > + * platform dependent portion of the state and other necessary >=20 > + * platform specific initialization steps. >=20 > + * >=20 > + * @param systh Pointer to global state structure >=20 > + * @param p user defined value or pointer to data >=20 > + * @see mipi_syst_header >=20 > + */ >=20 > +typedef void (MIPI_SYST_CALLCONV *mipi_syst_inithook_t)(struct > mipi_syst_header *systh, >=20 > + const void *p); >=20 > + >=20 > +/** >=20 > + * Global state destroy hook definition >=20 > + * >=20 > + * This function gets called in the context of the mipi_syst_destroy() A= PI >=20 > + * function before the generic state members of the global state >=20 > + * structure syst_hdr have been destroyed. Its purpose is to free resour= ces >=20 > + * used by the platform dependent portion of the global state. >=20 > + * >=20 > + * @param systh Pointer to global state structure >=20 > + */ >=20 > +typedef void (MIPI_SYST_CALLCONV *mipi_syst_destroyhook_t)(struct > mipi_syst_header *systh); >=20 > + >=20 > +/** >=20 > + * SyS-T handle state initialization hook definition >=20 > + * >=20 > + * This function gets called in the context of IO handle generation. >=20 > + * Its purpose is to initialize the platform dependent portion of >=20 > +* the handle and other necessary platform specific initialization steps= . >=20 > + * >=20 > + * @param systh Pointer to new SyS-T handle >=20 > + * @see syst_handle_t >=20 > + */ >=20 > +typedef void (*mipi_syst_inithandle_hook_t)(struct mipi_syst_handle > *systh); >=20 > + >=20 > +/** >=20 > + * SyS-T handle state release hook definition >=20 > + * >=20 > + * This function gets called when a handle is about to be destroyed.. >=20 > + * Its purpose is to free any resources allocated during the handle >=20 > + * generation. >=20 > + * >=20 > + * @param systh Pointer to handle that is destroyed >=20 > + * @see syst_handle_t >=20 > + */ >=20 > +typedef void (*mipi_syst_releasehandle_hook_t)(struct mipi_syst_handle > *systh); >=20 > + >=20 > +/** >=20 > + * Low level message write routine definition >=20 > + * >=20 > + * This function is called at the end of an instrumentation API to outpu= t >=20 > + * the raw message data. >=20 > + * >=20 > + * @param systh pointer to a SyS-T handle structure used in the API call= , >=20 > + * @param scatterprog pointer to a list of scatter write instructions th= at >=20 > + * encodes how to convert the descriptor pointer by >=20 > + * pdesc into raw binary data. This list doesn't incl= ude >=20 > + * the mandatory first 32 tag byte value pointed by p= desc. >=20 > + * @param pdesc pointer to a message descriptor, which containing at lea= st >=20 > + * the 32-bit message tag data >=20 > + */ >=20 > +typedef void (*mipi_syst_msg_write_t)( >=20 > + struct mipi_syst_handle *systh, >=20 > + struct mipi_syst_scatter_prog *scatterprog, >=20 > + const void *pdesc); >=20 > + >=20 > +#ifdef __cplusplus >=20 > +} /* extern C */ >=20 > +#endif >=20 > +#ifndef MIPI_SYST_PLATFORM_INCLUDED >=20 > + >=20 > +/** >=20 > + * @defgroup PCFG_Config Platform Feature Configuration Defines >=20 > + * >=20 > + * Defines to customize the SyS-T feature set to match the platform need= s. >=20 > + * >=20 > + * Each optional library feature can be disabled by not defining the rel= ated >=20 > + * MIPI_SYST_PCFG_ENABLE define. Removing unused features in this way > reduces >=20 > + * both memory footprint and runtime overhead of SyS-T. >=20 > + */ >=20 > + >=20 > +/** >=20 > + * @defgroup PCFG_Global Platform Wide Configuration >=20 > + * @ingroup PCFG_Config >=20 > + * >=20 > + * These defines enable global features in the SyS-T library. >=20 > + * @{ >=20 > + */ >=20 > + >=20 > + >=20 > + /** >=20 > + * Extend Platform global SyS-T data state >=20 > + * >=20 > + * This define extends the global SyS-T state data structure >=20 > + * mipi_syst_header with platform private content. A platform typically >=20 > + * stores data for SyS-T handle creation processing in this structure. >=20 > + * >=20 > + * Note: This data is not touched by the library code itself, but typica= lly >=20 > + * is used by platform hook functions for handle creation and destructi= on. >=20 > + * **These hook function calls are not lock protected and may happen >=20 > + * concurrently!** The hook functions need to implement locking if they >=20 > + * modify the platform state data. >=20 > + * >=20 > + * The platform example uses #mipi_syst_platform_state as data state > extension. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA >=20 > +#undef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA >=20 > +/** >=20 > + * Extend SyS-T handle data state >=20 > + * >=20 > + * This define extends the SyS-T handle state data structure >=20 > + * mipi_syst_handle with platform private content. A platform typically >=20 > + * stores data for fast trace hardware access in the handle data, for >=20 > + * example a volatile pointer to an MMIO space. >=20 > + * >=20 > + * The platform example uses #mipi_syst_platform_handle as handle state >=20 > + * extension. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA >=20 > + >=20 > +/** >=20 > + * Enable HEAP usage for handle generation >=20 > + * >=20 > + * This macro tells the SyS-T library to enable the heap allocation hand= le >=20 > + * creation API #MIPI_SYST_ALLOC_HANDLE. >=20 > + * The platform must provide the macros #MIPI_SYST_HEAP_MALLOC and >=20 > + * #MIPI_SYST_HEAP_FREE to point SyS-T to the platform malloc and free >=20 > + * functions. >=20 > + * >=20 > + * Note: In OS kernel space environments, you must use unpaged memory >=20 > + * allocation functions. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY >=20 > +#undef MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY >=20 > +/* MSVC and GNU compiler 64-bit mode */ >=20 > + >=20 > +/** >=20 > + * Enable 64-bit instruction addresses >=20 > + * >=20 > + * Set this define if running in 64-bit code address space. >=20 > + */ >=20 > +#if defined(_WIN64) || defined(__x86_64__) || defined (__LP64__) >=20 > +#define MIPI_SYST_PCFG_ENABLE_64BIT_ADDR >=20 > +#endif >=20 > +/** >=20 > + * Enable atomic 64-bit write operations >=20 > + * >=20 > + * Set this define if your platform supports an atomic 64-bit data write >=20 > + * operation. This results in fewer MMIO accesses.The SyS-T library >=20 > + * defaults to 2 consecutive 32-Bit writes otherwise. >=20 > + */ >=20 > +#if defined(_WIN64) || defined(__x86_64__) || defined (__LP64__) >=20 > +#define MIPI_SYST_PCFG_ENABLE_64BIT_IO >=20 > +#endif >=20 > + >=20 > +/** >=20 > + * Enable helper function code inlining >=20 > + * >=20 > + * Set this define if speed is more important than code size on your pla= tform. >=20 > + * It causes several helper function to get inlined, producing faster, b= ut >=20 > + * also larger, code. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_INLINE >=20 > + >=20 > +/** @} */ >=20 > + >=20 > +/** >=20 > + * @defgroup PCFG_ApiSet Supported API sets >=20 > + * @ingroup PCFG_Config >=20 > + * >=20 > + * These defines enable API sets in the SyS-T library. They are set by d= efault >=20 > + * depending on the SyS-T API conformance level. The level is specified = using >=20 > + * the define #MIPI_SYST_CONFORMANCE_LEVEL. >=20 > + * @{ >=20 > + */ >=20 > + >=20 > +#if MIPI_SYST_CONFORMANCE_LEVEL > 10 >=20 > + /** >=20 > + * Use SyS-T scatter write output function >=20 > + * >=20 > + * The library comes with an output routine that is intended to write da= ta > out >=20 > + * to an MMIO space. It simplifies a SyS-T platform integration as >=20 > + * only low-level access macros must be provided for outputting data. Th= ese >=20 > + * macros follow MIPI System Trace Protocol (STP) naming convention, als= o >=20 > + * non STP generators can use this interface. >=20 > + * >=20 > + * These low level output macros are: >=20 > + * >=20 > + * #MIPI_SYST_OUTPUT_D32MTS, #MIPI_SYST_OUTPUT_D64MTS, >=20 > + * #MIPI_SYST_OUTPUT_D32TS, #MIPI_SYST_OUTPUT_D64, >=20 > + * #MIPI_SYST_OUTPUT_D32, #MIPI_SYST_OUTPUT_D16, > #MIPI_SYST_OUTPUT_D8 and >=20 > + * #MIPI_SYST_OUTPUT_FLAG >=20 > + * >=20 > + * Note: This version of the write function always starts messages >=20 > + * using a 32-bit timestamped record also other sized timestamped >=20 > + * packets are allowed by the SyS-T specification. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_DEFAULT_SCATTER_WRITE >=20 > + >=20 > +/** >=20 > + * Enable the Catalog API for 32-Bit Catalog IDs. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_CATID32_API >=20 > + >=20 > +/** >=20 > + * Enable the Catalog API for 64-Bit Catalog IDs. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_CATID64_API >=20 > + >=20 > +/** >=20 > + * Enable plain UTF-8 string output APIs. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_STRING_API >=20 > + >=20 > +/** >=20 > + * Enable raw data output APIs >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_WRITE_API >=20 > + >=20 > +/** >=20 > + * Enable Build API >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_BUILD_API >=20 > +#endif /* MIPI_SYST_CONFORMANCE_LEVEL > 10 */ >=20 > + >=20 > +#if MIPI_SYST_CONFORMANCE_LEVEL > 20 >=20 > + /** >=20 > + * Enable printf API support >=20 > + * >=20 > + * Note: >=20 > + * Enabling printf requires compiler var_arg support as defined by the >=20 > + * header files stdarg.h stddef.h. >=20 > + */ >=20 > + >=20 > +#define MIPI_SYST_PCFG_ENABLE_PRINTF_API >=20 > +#undef MIPI_SYST_PCFG_ENABLE_PRINTF_API >=20 > +/** >=20 > + * Maximum size of printf payload in bytes. >=20 > + * Adjust this value if larger strings shall be supported by the library= . >=20 > + * The buffer space is located in stack memory when calling one of the p= rintf >=20 > + * style APIs. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_PRINTF_ARGBUF_SIZE 1024 >=20 > + >=20 > +#endif /* #if MIPI_SYST_CONFORMANCE_LEVEL > 20 */ >=20 > + >=20 > +/* @} */ >=20 > + >=20 > +/** >=20 > + * @defgroup PCFG_Message Optional Message Attributes >=20 > + * @ingroup PCFG_Config >=20 > + * >=20 > + * These defines enable optional message components. They are set by > default >=20 > + * depending on the SyS-T API conformance level. The level is specified = using >=20 > + * the define #MIPI_SYST_CONFORMANCE_LEVEL. >=20 > + * @{ >=20 > + */ >=20 > + >=20 > +#if MIPI_SYST_CONFORMANCE_LEVEL > 10 >=20 > +/** >=20 > + * Enable 128-bit origin GUID support. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID >=20 > + >=20 > +/** >=20 > + * Enable the API variants that send file:line ID pair location records. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD >=20 > +#undef MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD >=20 > +/** >=20 > + * Enable the API variants that send the address of the instrumentation > location. >=20 > + * >=20 > + * This API requires #MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD to be set > as well. >=20 > + * It uses its own define as it additionally requires the function >=20 > + * @ref mipi_syst_return_addr() to be implemented for your platform. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS >=20 > +#undef MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS >=20 > +/** >=20 > + * Enable protocol timestamp. >=20 > + * >=20 > + * This option adds a timestamp into the SyS-T protocol. This >=20 > + * option is used if the SyS-T protocol is not embedded into a hardware >=20 > + * timestamped trace protocol like MIPI STP or if the HW timestamp canno= t >=20 > + * be used for other reasons. Setting this option creates the need to de= fine >=20 > + * the macros #MIPI_SYST_PLATFORM_CLOCK and > #MIPI_SYST_PLATFORM_FREQ to >=20 > + * return a 64-bit clock tick value and its frequency. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_TIMESTAMP >=20 > + >=20 > +#if defined(_DOXYGEN_) /* only for doxygen, remove the #if to enable *= / >=20 > + /** >=20 > + * Enable generation of length field >=20 > + * >=20 > + * Set this define if the message data shall include the optional length >=20 > + * field that indicates how many payload bytes follow. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_LENGTH_FIELD >=20 > +#endif >=20 > + >=20 > +#endif >=20 > + >=20 > +#if MIPI_SYST_CONFORMANCE_LEVEL > 20 >=20 > +/** >=20 > + * Enable message data CRC32 generation. >=20 > + */ >=20 > +#define MIPI_SYST_PCFG_ENABLE_CHECKSUM >=20 > + >=20 > +#endif /* #if MIPI_SYST_CONFORMANCE_LEVEL */ >=20 > + >=20 > +/** @} */ >=20 > + >=20 > +#include "Platform.h" >=20 > +#endif >=20 > +#ifdef __cplusplus >=20 > +extern "C" { >=20 > +#endif >=20 > + >=20 > +#if defined(MIPI_SYST_PCFG_ENABLE_INLINE) >=20 > +#define MIPI_SYST_INLINE static MIPI_SYST_CC_INLINE >=20 > +#else >=20 > +#define MIPI_SYST_INLINE MIPI_SYST_EXPORT >=20 > +#endif >=20 > + >=20 > +/** SyS-T global state structure. >=20 > + * This structure is holding the global SyS-T library state >=20 > + */ >=20 > +struct mipi_syst_header { >=20 > + mipi_syst_u32 systh_version; /**< SyS-T version ID */ >=20 > + >=20 > +#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA) >=20 > + mipi_syst_inithandle_hook_t systh_inith; /**< handle init hook > function*/ >=20 > + mipi_syst_releasehandle_hook_t systh_releaseh; /**< handle release hoo= k > */ >=20 > +#endif >=20 > + >=20 > +#if MIPI_SYST_CONFORMANCE_LEVEL > 10 >=20 > + mipi_syst_msg_write_t systh_writer; /**< message output rou= tine > */ >=20 > +#endif >=20 > +#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA) >=20 > + struct mipi_syst_platform_state systh_platform; >=20 > + /**< platform specific state */ >=20 > +#endif >=20 > +}; >=20 > + >=20 > +/** >=20 > + * Message data header tag definition >=20 > + * >=20 > + * Each SyS-T message starts with a 32-bit message tag. The tag defines = the >=20 > + * message originator and decoding information for the data following >=20 > + * the tag. >=20 > + */ >=20 > + >=20 > +struct mipi_syst_msg_tag { >=20 > +#if defined(MIPI_SYST_BIG_ENDIAN) >=20 > + mipi_syst_u32 et_res31 : 1; /**< reserved for future use */ >=20 > + mipi_syst_u32 et_res30 : 1; /**< reserved for future use */ >=20 > + mipi_syst_u32 et_subtype : 6; /**< type dependent sub category */ >=20 > + mipi_syst_u32 et_guid : 1; /**< 128-bit GUID present */ >=20 > + mipi_syst_u32 et_modunit : 11; /**< unit for GUID or module:unit */ >=20 > + mipi_syst_u32 et_timestamp : 1;/**< indicate 64-bit timestamp */ >=20 > + mipi_syst_u32 et_chksum : 1; /**< indicate 32-bit CRC */ >=20 > + mipi_syst_u32 et_length : 1; /**< indicate length field */ >=20 > + mipi_syst_u32 et_location : 1; /**< indicate location information */ >=20 > + mipi_syst_u32 et_res7 : 1; /**< reserved for future use */ >=20 > + mipi_syst_u32 et_severity : 3; /**< severity level of message */ >=20 > + mipi_syst_u32 et_type : 4; /**< SyS-T message type ID */ >=20 > +#else >=20 > + mipi_syst_u32 et_type : 4; /**< SyS-T message type ID */ >=20 > + mipi_syst_u32 et_severity : 3; /**< severity level of message */ >=20 > + mipi_syst_u32 et_res7 : 1; /**< reserved for future use */ >=20 > + mipi_syst_u32 et_location : 1; /**< indicate location information */ >=20 > + mipi_syst_u32 et_length : 1; /**< indicate length field */ >=20 > + mipi_syst_u32 et_chksum : 1; /**< indicate 32-bit CRC */ >=20 > + mipi_syst_u32 et_timestamp : 1;/**< indicate 64-bit timestamp */ >=20 > + mipi_syst_u32 et_modunit : 11; /**< unit for GUID or module:unit */ >=20 > + mipi_syst_u32 et_guid : 1; /**< 128-bit GUID present */ >=20 > + mipi_syst_u32 et_subtype : 6; /**< type dependent sub category */ >=20 > + mipi_syst_u32 et_res30 : 1; /**< reserved for future use */ >=20 > + mipi_syst_u32 et_res31 : 1; /**< reserved for future use */ >=20 > +#endif >=20 > +}; >=20 > +#define _MIPI_SYST_MK_MODUNIT_ORIGIN(m,u) (((u) & 0xF)|(m<<4)) >=20 > + >=20 > +/** >=20 > + * Message severity level enumeration >=20 > + */ >=20 > +enum mipi_syst_severity { >=20 > + MIPI_SYST_SEVERITY_MAX =3D 0, /**< no assigned severity */ >=20 > + MIPI_SYST_SEVERITY_FATAL =3D 1, /**< critical error level */ >=20 > + MIPI_SYST_SEVERITY_ERROR =3D 2, /**< error message level */ >=20 > + MIPI_SYST_SEVERITY_WARNING =3D 3,/**< warning message level */ >=20 > + MIPI_SYST_SEVERITY_INFO =3D 4, /**< information message level */ >=20 > + MIPI_SYST_SEVERITY_USER1 =3D 5, /**< user defined level 5 */ >=20 > + MIPI_SYST_SEVERITY_USER2 =3D 6, /**< user defined level 6 */ >=20 > + MIPI_SYST_SEVERITY_DEBUG =3D 7 /**< debug information level */ >=20 > +}; >=20 > + >=20 > +/** >=20 > + * Location information inside a message (64-bit format) >=20 > + * Location is either the source position of the instrumentation call, o= r >=20 > + * the call instruction pointer value. >=20 > + */ >=20 > +union mipi_syst_msglocation32 { >=20 > + struct { >=20 > +#if defined(MIPI_SYST_BIG_ENDIAN) >=20 > + mipi_syst_u16 etls_lineNo; /**< line number in file */ >=20 > + mipi_syst_u16 etls_fileID; /**< ID of instrumented file */ >=20 > +#else >=20 > + mipi_syst_u16 etls_fileID; /**< ID of instrumented file */ >=20 > + mipi_syst_u16 etls_lineNo; /**< line number in file */ >=20 > +#endif >=20 > + } etls_source_location; >=20 > + >=20 > + mipi_syst_u32 etls_code_location:32; /**< instruction pointer value */ >=20 > +}; >=20 > + >=20 > +/** >=20 > + * Location information inside a message (32-bit format) >=20 > + * Location is either the source position of the instrumentation call, o= r >=20 > + * the call instruction pointer value. >=20 > + */ >=20 > +union mipi_syst_msglocation64 { >=20 > + struct { >=20 > +#if defined(MIPI_SYST_BIG_ENDIAN) >=20 > + mipi_syst_u32 etls_lineNo; /**< line number in file */ >=20 > + mipi_syst_u32 etls_fileID; /**< ID of instrumented file */ >=20 > +#else >=20 > + mipi_syst_u32 etls_fileID; /**< ID of instrumented file */ >=20 > + mipi_syst_u32 etls_lineNo; /**< line number in file */ >=20 > +#endif >=20 > + } etls_source_location; >=20 > + mipi_syst_u64 etls_code_location; /**< instruction pointer value */ >=20 > +}; >=20 > + >=20 > +/** >=20 > + * Location information record descriptor >=20 > + */ >=20 > +struct mipi_syst_msglocation { >=20 > + /** Message format >=20 > + * 0 =3D 16-Bit file and 16-Bit line (total: 32-bit) >=20 > + * 1 =3D 32-Bit file and 32-Bit line (total: 64-bit) >=20 > + * 2 =3D 32-bit code address >=20 > + * 3 =3D 64-bit code address >=20 > + */ >=20 > + mipi_syst_u8 el_format; >=20 > + union { >=20 > + union mipi_syst_msglocation32 loc32; /**< data for 32-bit variant *= / >=20 > + union mipi_syst_msglocation64 loc64; /**< data for 64-bit variant *= / >=20 > + } el_u; >=20 > +}; >=20 > + >=20 > +/** internal handle state flags >=20 > + */ >=20 > +struct mipi_syst_handle_flags { >=20 > + mipi_syst_u32 shf_alloc:1; /**< set to 1 if heap allocated handle */ >=20 > +}; >=20 > + >=20 > +/** SyS-T connection handle state structure >=20 > + * >=20 > + * This structure connects the instrumentation API with the underlying S= yS-T >=20 > + * infrastructure. It plays a similar role to a FILE * in traditional >=20 > + * C file IO. >=20 > + */ >=20 > + struct mipi_syst_handle { >=20 > + struct mipi_syst_header* systh_header; /**< global state = */ >=20 > + struct mipi_syst_handle_flags systh_flags; /**< handle state = */ >=20 > + struct mipi_syst_msg_tag systh_tag; /**< tag flags = */ >=20 > + >=20 > +#if defined(MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID) >=20 > + struct mipi_syst_guid systh_guid; /**< module GUID = */ >=20 > +#endif >=20 > + >=20 > +#if defined(MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD) >=20 > + struct mipi_syst_msglocation systh_location; /**< location record = */ >=20 > +#endif >=20 > + >=20 > + mipi_syst_u32 systh_param_count; /**< number of parameters = */ >=20 > + mipi_syst_u32 systh_param[6]; /**< catalog msg parameters = */ >=20 > + >=20 > +#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA) >=20 > + struct mipi_syst_platform_handle systh_platform; >=20 > + /**< platform specific state */ >=20 > +#endif >=20 > +}; >=20 > + >=20 > + >=20 > +#ifdef __cplusplus >=20 > +} /* extern C */ >=20 > +#endif >=20 > +#ifndef MIPI_SYST_API_INCLUDED >=20 > +#include "mipi_syst/api.h" >=20 > +#endif >=20 > + >=20 > +typedef struct mipi_syst_header MIPI_SYST_HEADER; >=20 > +typedef struct mipi_syst_handle MIPI_SYST_HANDLE; >=20 > +typedef enum mipi_syst_severity MIPI_SYST_SEVERITY; >=20 > +typedef struct mipi_syst_guid MIPI_SYST_GUID; >=20 > +typedef struct mipi_syst_msg_tag MIPI_SYST_MSG_TAG; >=20 > +typedef struct mipi_syst_handle_flags MIPI_SYST_HANDLE_FLAGS; >=20 > +#endif >=20 > diff --git a/MdePkg/Library/MipiSysTLib/mipisyst > b/MdePkg/Library/MipiSysTLib/mipisyst > new file mode 160000 > index 0000000000..370b5944c0 > --- /dev/null > +++ b/MdePkg/Library/MipiSysTLib/mipisyst > @@ -0,0 +1 @@ > +Subproject commit 370b5944c046bab043dd8b133727b2135af7747a > diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml > index 035c34b3ad..f024b48685 100644 > --- a/MdePkg/MdePkg.ci.yaml > +++ b/MdePkg/MdePkg.ci.yaml > @@ -10,7 +10,10 @@ > { >=20 > ## options defined .pytool/Plugin/LicenseCheck >=20 > "LicenseCheck": { >=20 > - "IgnoreFiles": [] >=20 > + "IgnoreFiles": [ >=20 > + # This file is copied from mipi sys-T submodule and generate= d by > python script with customization. >=20 > + "Library/MipiSysTLib/mipi_syst.h" >=20 > + ] >=20 > }, >=20 > "EccCheck": { >=20 > ## Exception sample looks like below: >=20 > @@ -68,7 +71,8 @@ > "Include/Library/SafeIntLib.h", >=20 > "Include/Protocol/DebugSupport.h", >=20 > "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c", >=20 > - "Library/BaseFdtLib" >=20 > + "Library/BaseFdtLib", >=20 > + "Library/MipiSysTLib/mipi_syst.h" >=20 > ] >=20 > }, >=20 > ## options defined ci/Plugin/CompilerPlugin >=20 > @@ -166,6 +170,7 @@ > "IgnoreStandardPaths": [], # Standard Plugin defined paths tha= t should > be ignore >=20 > "AdditionalIncludePaths": [] # Additional paths to spell check (= wildcards > supported) >=20 > }, >=20 > + >=20 > # options defined in .pytool/Plugin/UncrustifyCheck >=20 > "UncrustifyCheck": { >=20 > "IgnoreFiles": [ >=20 > @@ -175,7 +180,8 @@ > "Library/BaseFdtLib/stddef.h", >=20 > "Library/BaseFdtLib/stdint.h", >=20 > "Library/BaseFdtLib/stdlib.h", >=20 > - "Library/BaseFdtLib/string.h" >=20 > + "Library/BaseFdtLib/string.h", >=20 > + "mipi_syst.h" >=20 > ] >=20 > } >=20 > } >=20 > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec > index d6c4179b2a..d68ed988c0 100644 > --- a/MdePkg/MdePkg.dec > +++ b/MdePkg/MdePkg.dec > @@ -28,6 +28,7 @@ > Include >=20 > Test/UnitTest/Include >=20 > Test/Mock/Include >=20 > + Library/MipiSysTLib/mipisyst/library/include >=20 >=20 >=20 > [Includes.IA32] >=20 > Include/Ia32 >=20 > @@ -293,6 +294,10 @@ > # >=20 > FdtLib|Include/Library/FdtLib.h >=20 >=20 >=20 > + ## @libraryclass Provides general mipi sys-T services. >=20 > + # >=20 > + MipiSysTLib|Include/Library/MipiSysTLib.h >=20 > + >=20 > [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64] >=20 > ## @libraryclass Provides services to generate random number. >=20 > # >=20 > diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc > index b38c863812..902a39cffc 100644 > --- a/MdePkg/MdePkg.dsc > +++ b/MdePkg/MdePkg.dsc > @@ -184,6 +184,7 @@ > MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf >=20 > MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf >=20 > MdePkg/Library/TdxLib/TdxLib.inf >=20 > + MdePkg/Library/MipiSysTLib/MipiSysTLib.inf >=20 >=20 >=20 > [Components.EBC] >=20 > MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf >=20 > diff --git a/ReadMe.rst b/ReadMe.rst > index d46c534229..ed1d482245 100644 > --- a/ReadMe.rst > +++ b/ReadMe.rst > @@ -97,6 +97,7 @@ that are covered by additional licenses. > - `UnitTestFrameworkPkg/Library/SubhookLib/subhook > 801cb70bc/LICENSE.txt>`__ >=20 > - `RedfishPkg/Library/JsonLib/jansson > 1e24960fae02/LICENSE>`__ >=20 > - `MdePkg/Library/BaseFdtLib/libfdt org/pylibfdt/blob/f39368a217496d32c4091a2dba4045b60649e3a5/BSD-2- > Clause>`__ >=20 > +- `MdePkg/Library/MipiSysTLib/mipisyst Alliance/public-mipi-sys- > t/blob/aae857d0d05ac65152ed24992a4acd834a0a107c/LICENSE>`__ >=20 >=20 >=20 > The EDK II Project is composed of packages. The maintainers for each pac= kage >=20 > are listed in `Maintainers.txt `__. >=20 > -- > 2.40.0.windows.1