From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.25934.1683744768778522015 for ; Wed, 10 May 2023 11:52:49 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=CZn0LDlU; spf=pass (domain: intel.com, ip: 192.55.52.136, 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=1683744768; x=1715280768; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=sGEHTAqgN0aJLivg+w3VuPYa1Kl1SnX0DDjBqRaB/2k=; b=CZn0LDlUetg4E31i/8FwIuq5rU6EMVa7ScuBfeMH5semp7dqs3tny5yg wk+oi3I2H5J45gpNh2J+Vd6hPrkKSobv/YC38ZE8yaLNLdC8Q/tAkN9VC 9VncvbF4qFHFhlnf+BIYwt98ERTGGhymECOGdq5bvwVWzdsde1s7STeYL gcrmFrsvrppmweB5QjsxsJ4u1c+u5IjPkFfI4PCoYxn1RNgWc2LVfBdP/ y7BCVuFjCDrurdbZtiDrm2XHGPrYQldJ6jBQiWNQiICe0wuAkgghH1Xu9 PEX1RHDbyJ4gb6c+xgnyWMSks69ETvMZPi2KrTKb4vzCgaAeHNHXpEzyQ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="329912847" X-IronPort-AV: E=Sophos;i="5.99,265,1677571200"; d="scan'208";a="329912847" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2023 11:52:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="811255255" X-IronPort-AV: E=Sophos;i="5.99,265,1677571200"; d="scan'208";a="811255255" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga002.fm.intel.com with ESMTP; 10 May 2023 11:52:47 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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; Wed, 10 May 2023 11:52:47 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 11:52:46 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Wed, 10 May 2023 11:52:46 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Wed, 10 May 2023 11:52:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bnxoj/T+oXU4Zvv2XhFnqkwCaVQm4sQA8EMz0u04an35PwUeLp5BhhshTcUEvoXt86/tPFagKOiyrD8c6RfxSYiGwL51TgvTTkgVJ6yCzQ93kNQzzGqjo28Fo1mR5C80BnoVX0fD08dufRdaMzpJ9XsTq+bGyoTumNHzMUIRgTLlHsSr49JTEWBJ3CU/Tm1Grb5w6RLaRDUEEKEkMzm2NHgVV0dN1LqYRzn+qQbb4S1LoEcISHtUNnHvMKRCYoQnje8bwUL4xVRVJPocGq4ICVufMTgyKqXiCAjdg5B1jgNmQjIioH8r2QWr7BiQhW7KvMEXB4wVBASbYLgMWXGb0g== 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=zn1Sgf4ei0FzxTjKO6I5mbIWDOL6rUcuBtI6+UZoczk=; b=c3O7/oZdZbLB3uj70ZXaEH0n5OzVGxnpKxhJuFEq+4joGFpuoyxtOfpdX3tjK+M5FoshAIs1w6fJ9/+p94PM76nq99nJQCg2d5btB/JP+3kwOh0HzjorY1qplTnzDRRytgmjXRiGYFMCsdHmEoNUpHGoniZ9mtrTRufeAroHnWqFaR4TGZl+QJ3JuV5saPWjCISb4NBhK7iPiSKeJT0VapDyrcVZAOjx9U+iBT+95LaVyrEv6Syn+1L/uMPjyWiYxXAP08qxSGOEIqlI60zRjaZKAfpAKVgHJKXgTgOK9GJ/o8+lFbVpHiCPqQOWPZTsh9sdsZxD+9es5FRrgHCTWg== 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 BN9PR11MB5276.namprd11.prod.outlook.com (2603:10b6:408:135::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Wed, 10 May 2023 18:52:42 +0000 Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::6e8f:1c7:b499:a84d]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::6e8f:1c7:b499:a84d%4]) with mapi id 15.20.6387.019; Wed, 10 May 2023 18:52:41 +0000 From: "Michael D Kinney" To: Leif Lindholm , "devel@edk2.groups.io" , "Guo, Gua" CC: "Chan, Laura" , "Prakashan, Krishnadas Veliyathuparambil" , "K N, Karthik" , "Hsu, VictorX" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH v3 1/4] MdePkg: Add MipiSysTLib library Thread-Topic: [edk2-devel] [PATCH v3 1/4] MdePkg: Add MipiSysTLib library Thread-Index: AQHZgufwOBcJNjvOkUmJRqQinj8/ea9T1LKAgAAGdZA= Date: Wed, 10 May 2023 18:52:41 +0000 Message-ID: References: <20230510023355.1467-1-gua.guo@intel.com> <20230510023355.1467-2-gua.guo@intel.com> In-Reply-To: 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_|BN9PR11MB5276:EE_ x-ms-office365-filtering-correlation-id: b2b249c8-2967-4e6f-c43a-08db5187bb97 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oE1UDvSNI1evEQjxqx6VyXVfikG637GDCp0E7qxc65wJmXkE52mrm+FLcuA+pmcPxNgbDjocy/nIIOK7GRi8YeCCJWdORqGuo1Edm7LifCvIqNZ8eAkMXZ69X4i0BF4V7zDdxGLYeBF4cKMj5D2R4htiWu7xE7IFuGvYo96nLMcib76d9lsn9akga5LrpXt7hE64G4DC0DDExA4BK8EkOIoX8w9FAJHiPnDFGmUJsn3JDUKcztUPiR3i5vHhCmVGh8IoM94Xp/scNk/qtmOh+upWXVc3Zt6SQcbg7voupjRMmm1ZDsmVeIft1T2o/I86wUZhr5J1wYUo4ZWQ5myltHHP6Uer5l0a5kYQZJRI8RGjaaZUpE1ozWpM/U6BA5T0N4vnMybGbdilGD7fnFZ1TDOSScTgHCcQlFflqo9plZShCiCE6/5nVyjAVBEvQCLrVXb2oyi6Dz1KY0FsfyhbhD+3BazOaTQwJwQ5khTz0uJisJJDAy+p8beZcB5I5007lPjGdDKmYd6hzRyW923AKc4mTRmBGQEQoYtjMTUMHtYGZ3iz3HjRQJpPpbefVUvBdYs6Xt0laez6RPKGxwS/BsCPjMuMda1zEstxsYdTw/2BH93bPQFPT5uXRFhtBTG120x/Af7VDY0EiudjUr25VQ== 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)(39860400002)(376002)(136003)(366004)(346002)(396003)(451199021)(478600001)(7696005)(55016003)(83380400001)(966005)(82960400001)(6636002)(107886003)(41300700001)(38100700002)(9686003)(71200400001)(6506007)(122000001)(53546011)(110136005)(66476007)(66946007)(54906003)(86362001)(66446008)(64756008)(66556008)(30864003)(26005)(38070700005)(4326008)(52536014)(5660300002)(316002)(76116006)(19627235002)(8676002)(33656002)(186003)(8936002)(66899021)(2906002)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?NspsoVfaeceyStTFRaBb0kd9Lt4blmKbKSVsZV6mUNCJfCCi/WwSrr58USvB?= =?us-ascii?Q?BGMJTzDG0naQBA0A3q5nxeJNVMdRUn+fwWtj3HRcR1iK7YMmF1896ed8FKVT?= =?us-ascii?Q?m448T5YBECi36Dyvp+p/Hm10rRT4QHqX54NxCokcIFWBSPDFfMDSp6BsWjM1?= =?us-ascii?Q?Dx6NttX31Eale1bYeINJBths9hDcgoBTyt+2Fk6oGl0Ie8nh+aduJOqSF4q0?= =?us-ascii?Q?/w1G9kx7ioxJU89xD+EoSZPiaWHW5VonuTcHRqb4iUndJVn4+kJxZahl3IpD?= =?us-ascii?Q?x5sCzRJPYA1E56UgUwGPpz+n/v655NLhsXT+Q461iEbv+ohR4r9y7CbmA5v6?= =?us-ascii?Q?K12LwuYQkxpxRwR9Vrsr1sOIdNNtfiqKot4FB5mR5T+S7opjivcOsPUa0khb?= =?us-ascii?Q?+F2m2AJakNg45QCzq33kstq1pWUesghonUgYx0aZM3Th/25FwZXrxLY+K103?= =?us-ascii?Q?XtYppV4mSvo9M0pn5vsoZG9jBW0Vhz73Cnsuk//zhzicyeaVcOBIum1UQ/ZD?= =?us-ascii?Q?Cg4r6IPzTB5DPGzqgAvCGCqRoRcw6pX8LQGvPmDp470e8hufPsGZRzQ0mOfI?= =?us-ascii?Q?v7ymqxwHrH4OBf3HIkBetcsyKdqbl9qRLh+dL5QzhAiSWJhZw4GprtkYtVXp?= =?us-ascii?Q?RnnbzDNc6XUz/qIiazJki98gOEdz11DmnQVImnJY/oemvEXWu1puWROHA9Y6?= =?us-ascii?Q?dpn2EBE1+jlnBsgbQ40kjmeROBkPHT0h8LnRpArkzkkud2qjdmdMHZs9XJZm?= =?us-ascii?Q?UZiyAYr4DHeUOK6ZayDKMtkVsZ6wtk/B/KoNdQN5MvDmEs5YT8atA1bpICB/?= =?us-ascii?Q?956XiqXL67ztUGdxbYTUulN2uIz0gmQ84ZiTbYg0dWREqp0UPuwFheXJ4AFU?= =?us-ascii?Q?SrDbxtefNcGcW3c4v0Wk6DcO7BA4v5hfPey3Y3xnhBZrIcIdoLizTbvEoGgV?= =?us-ascii?Q?UWdIDZgyQgRhgRxIzwwg7ejmt5MYRMQIsi8gH8ZFI21+OyCQ/ES7KSlwiU4V?= =?us-ascii?Q?6Se96c+PEp27GZhWr8u3vEQqo39JPjbkxwMGQpj2E4xqdAgfJy01IwDQtx7p?= =?us-ascii?Q?rRbqjXX8i8rMqcLXoD+zTFk0ePoScPXyCl8cZUu74+7qkn9CWpUN2wHAiNiX?= =?us-ascii?Q?+cjXu7n5kzMoAqamJFBvRpuxAyTj+28OA1BzfQ8p4Pq4ikP7dPeym+ik/Rh6?= =?us-ascii?Q?fpY4uu+AC20VNFprU+2vkfCUI2MYedCaiNExPws2MVRWLCDNh3YEF96V+b3X?= =?us-ascii?Q?9cvvzJlZZ+IJzMLYcWZmBZrrCpt09G4/SrqziX4yvGEHexykT5jMdK5eNivQ?= =?us-ascii?Q?BkWQO9MlhIZEKEkO/ImalJbjtn9votWFwgHxWIoNaX6gCIqh8GfVdXDGzJHY?= =?us-ascii?Q?3FVxb0cJOiK8fbNxm6Dd8PWqCRJNkZCAbr8l5997NhmVfndOYZu6kdrMoDSl?= =?us-ascii?Q?aL//6BSYDjUZmAUvqn9FFaICCxM979oWOv31KT5/YmyH/arRvy+z906OKkZ+?= =?us-ascii?Q?A1NKXkfVdrB2Samzd9M637VkyYEZbcrm81oiPGiPBFSwcBOtH/Z3ZoRlrG/x?= =?us-ascii?Q?Y721v4AjcWgpZYrac0k5Q8XQUxbTI6a9bkLEUNXhiA09t6KlaR6EXy4/VrXl?= =?us-ascii?Q?Dw=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: b2b249c8-2967-4e6f-c43a-08db5187bb97 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2023 18:52:41.2426 (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: i1L9f4t/hgNkqsrw12JWR5onk6ixdNq31Zfz+3Qa5t8m4WdNK2Efq/DFW+QmlkUJwpkjtMRFQ2XCTQ/m8oGUD08sz+Mq+At/jI9cl9PHp8E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5276 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 Thanks Leif, I will split the patch into the line ending changes and the addition of jus= t the MipiSysTLib submodule and apply your Rb to the submodule addition. Mike > -----Original Message----- > From: Leif Lindholm > Sent: Wednesday, May 10, 2023 11:29 AM > To: devel@edk2.groups.io; Guo, Gua > Cc: Kinney, Michael D ; Chan, Laura > ; Prakashan, Krishnadas Veliyathuparambil > ; K N, Karthik > ; Hsu, VictorX > Subject: Re: [edk2-devel] [PATCH v3 1/4] MdePkg: Add MipiSysTLib library >=20 > On Wed, May 10, 2023 at 10:33:52 +0800, Guo, Gua wrote: > > From: Gua Guo > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4144 > > > > This Library provides functions consuming MIPI SYS-T submodule. > > > > 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 | 52 ++ > > 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 | 9 + > > MdePkg/MdePkg.dsc | 1 + > > ReadMe.rst | 1 + > > 15 files changed, 1519 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 > > > > 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 > > + 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"] > > - path =3D MdePkg/Library/BaseFdtLib/libfdt > > - url =3D https://github.com/devicetree-org/pylibfdt.git > > +[submodule "MdePkg/Library/BaseFdtLib/libfdt"] > > + path =3D MdePkg/Library/BaseFdtLib/libfdt > > + url =3D https://github.com/devicetree-org/pylibfdt.git >=20 > It's unfortunate that incorrect line endings have crept into the > .gitmodules file, but fixing that should be a separate patch, not part > of this one. >=20 > Once the unrelated changes have been removed: > Reviewed-by: Leif Lindholm >=20 > > +[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)) > > rs.append(RequiredSubmodule( > > "MdePkg/Library/BaseFdtLib/libfdt", 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..4ced1c02cd > > --- /dev/null > > +++ b/MdePkg/Include/Library/MipiSysTLib.h > > @@ -0,0 +1,66 @@ > > +/** @file > > +This header file declares functions consuming MIPI Sys-T submodule. > > + > > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> > + > > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef MIPI_SYST_LIB_H_ > > +#define MIPI_SYST_LIB_H_ > > + > > +/** > > + Invoke initialization function in Mipi Sys-T module to initialize Mi= pi Sys-T > handle. > > + > > + @param[in, out] MipiSystHandle A pointer to MIPI_SYST_HANDLE > structure. > > + > > + @retval RETURN_SUCCESS MIPI_SYST_HANDLE instance was initialize= d. > > + @retval Other MIPI_SYST_HANDLE instance was not initia= lized. > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +InitMipiSystHandle ( > > + IN OUT VOID *MipiSystHandle > > + ); > > + > > +/** > > + Invoke write_debug_string function in Mipi Sys-T module. > > + > > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. > > + @param[in] Severity Severity type of input message. > > + @param[in] Len Length of data buffer. > > + @param[in] Str A pointer to data buffer. > > + > > + @retval RETURN_SUCCESS Data in buffer was processed. > > + @retval RETURN_ABORTED No data need to be written to T= race > Hub. > > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str > is a NULL pointer. > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +MipiSystWriteDebug ( > > + IN VOID *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 Severity type of input message. > > + @param[in] CatId Catalog Id. > > + > > + @retval RETURN_SUCCESS Data in buffer was processed. > > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a > NULL pointer. > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +MipiSystWriteCatalog ( > > + IN VOID *MipiSystHandle, > > + IN UINT32 Severity, > > + IN UINT64 CatId > > + ); > > + > > +#endif // MIPI_SYST_LIB_H_ > > 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 > > +# This python script update content from mipi_syst.h.in in mipi sys-T > submodule > > +# and generate it as mipi_syst.h. mipi_syst.h include necessary data > structure and > > +# definition that will be consumed by MipiSysTLib itself, mipi sys-T > submodule > > +# and other library. > > +# > > +# This script needs to be done once by a developer when adding some > > +# project-relating definition or a new version of mipi_syst.h.in is r= eleased. > > +# Normal users do not need to do this, since the resulting file is st= ored > > +# in the EDK2 git repository. > > +# > > +# Customize structures mentioned below to generate updated mipi_syst.= h > file: > > +# 1. ExistingValueToBeReplaced > > +# -> To replace existing value in mipi_syst.h.in to newer one. > > +# 2. ExistingDefinitionToBeRemoved > > +# -> To #undef a existing definition in mipi_syst.h.in. > > +# 3. NewItemToBeAdded > > +# -> Items in this structure will be placed at the end of mipi_s= yst.h as a > customized section. > > +# > > +# Run GenMipiSystH.py without any parameters as normal python script > after customizing. > > +# > > +# Copyright (c) 2023, Intel Corporation. All rights reserved.
> > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > +import os > > +import re > > + > > +# > > +# A existing value to be customized should place this structure > > +# Definitions in this customizable structure will be processed by > ReplaceOldValue() > > +# e.g: > > +# Before: @SYST_CFG_VERSION_MAJOR@ > > +# After: 1 > > +# > > +ExistingValueToBeReplaced =3D [ > > + ["@SYST_CFG_VERSION_MAJOR@", "1"], # Major version > > + ["@SYST_CFG_VERSION_MINOR@", "0"], # Minor version > > + ["@SYST_CFG_VERSION_PATCH@", "0"], # Patch version > > + ["@SYST_CFG_CONFORMANCE_LEVEL@", "30"], # Feature level of mipi > sys-T submodule > > + ["mipi_syst/platform.h", "Platform.h"], > > +] > > + > > +# > > +# A existing definition to be removed should place this structure > > +# Definitions in this customizable structure will be processed by > RemoveDefinition() > > +# e.g: > > +# Before: > > +# #define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA > > +# After: > > +# #define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA > > +# #undef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA > > +# > > +ExistingDefinitionToBeRemoved =3D [ > > + "MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA", > > + "MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY", > > + "MIPI_SYST_PCFG_ENABLE_PRINTF_API", > > + "MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD", > > + "MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS", > > +] > > + > > +# > > +# Items in this structure will be placed at the end of mipi_syst.h as = a > customized section. > > +# > > +NewItemToBeAdded =3D [ > > + "typedef struct mipi_syst_handle_flags MIPI_SYST_HANDLE_FLAGS;", > > + "typedef struct mipi_syst_msg_tag MIPI_SYST_MSG_TAG;", > > + "typedef struct mipi_syst_guid MIPI_SYST_GUID;", > > + "typedef enum mipi_syst_severity MIPI_SYST_SEVERITY;", > > + "typedef struct mipi_syst_handle MIPI_SYST_HANDLE;", > > + "typedef struct mipi_syst_header MIPI_SYST_HEADER;", > > +] > > + > > +def ProcessSpecialCharacter(Str): > > + Str =3D Str.rstrip(" \n") > > + Str =3D Str.replace("\t", " ") > > + Str +=3D "\n" > > + return Str > > + > > +def ReplaceOldValue(Str): > > + for i in range(len(ExistingValueToBeReplaced)): > > + Result =3D re.search(ExistingValueToBeReplaced[i][0], Str) > > + if Result is not None: > > + Str =3D Str.replace(ExistingValueToBeReplaced[i][0], > ExistingValueToBeReplaced[i][1]) > > + break > > + return Str > > + > > +def RemoveDefinition(Str): > > + Result =3D re.search("\*", Str) > > + if Result is None: > > + for i in range(len(ExistingDefinitionToBeRemoved)): > > + Result =3D re.search(ExistingDefinitionToBeRemoved[i], Str= ) > > + if Result is not None: > > + Result =3D re.search("defined", Str) > > + if Result is None: > > + Str =3D Str + "#undef " + ExistingDefinitionToBeRe= moved[i] > > + break > > + return Str > > + > > +def main(): > > + MipiSystHSrcDir =3D "mipisyst/library/include/mipi_syst.h.in" > > + MipiSystHRealSrcDir =3D os.path.join(os.getcwd(), > os.path.normpath(MipiSystHSrcDir)) > > + MipiSystHRealDstDir =3D os.path.join(os.getcwd(), "mipi_syst.h") > > + > > + # > > + # Read content from mipi_syst.h.in and process each line by demand > > + # > > + with open(MipiSystHRealSrcDir, "r") as rfObj: > > + SrcFile =3D rfObj.readlines() > > + for lineIndex in range(len(SrcFile)): > > + SrcFile[lineIndex] =3D ProcessSpecialCharacter(SrcFile[lin= eIndex]) > > + SrcFile[lineIndex] =3D ReplaceOldValue(SrcFile[lineIndex]) > > + SrcFile[lineIndex] =3D RemoveDefinition(SrcFile[lineIndex]= ) > > + > > + # > > + # Typedef a structure or enum type > > + # > > + i =3D -1 > > + for struct in NewItemToBeAdded: > > + struct +=3D "\n" > > + SrcFile.insert(i, struct) > > + i -=3D 1 > > + > > + # > > + # Save edited content to mipi_syst.h > > + # > > + with open(MipiSystHRealDstDir, "w") as wfObj: > > + wfObj.writelines(SrcFile) > > + > > +if __name__ =3D=3D '__main__': > > + main() > > 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 > > +This file provide functions to communicate with mipi sys-T submodule. > > + > > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> > + > > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include > > +#include "mipi_syst.h" > > + > > +/** > > + Invoke initialization function in Mipi Sys-T module to initialize Mi= pi Sys-T > handle. > > + > > + @param[in, out] MipiSystHandle A pointer to MIPI_SYST_HANDLE > structure. > > + > > + @retval RETURN_SUCCESS MIPI_SYST_HANDLE instance was initialize= d. > > + @retval Other MIPI_SYST_HANDLE instance was not initia= lized. > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +InitMipiSystHandle ( > > + IN OUT VOID *MipiSystHandle > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + if (MipiSystH =3D=3D NULL) { > > + return RETURN_INVALID_PARAMETER; > > + } > > + > > + mipi_syst_init (MipiSystH->systh_header, 0, NULL); > > + > > + return RETURN_SUCCESS; > > +} > > + > > +/** > > + Invoke write_debug_string function in Mipi Sys-T module. > > + > > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. > > + @param[in] Severity Severity type of input message. > > + @param[in] Len Length of data buffer. > > + @param[in] Str A pointer to data buffer. > > + > > + @retval RETURN_SUCCESS Data in buffer was processed. > > + @retval RETURN_ABORTED No data need to be written to T= race > Hub. > > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str > is a NULL pointer. > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +MipiSystWriteDebug ( > > + IN MIPI_SYST_HANDLE *MipiSystHandle, > > + IN UINT32 Severity, > > + IN UINT16 Len, > > + IN CONST CHAR8 *Str > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + if (MipiSystH =3D=3D NULL) { > > + return RETURN_INVALID_PARAMETER; > > + } > > + > > + if (Len =3D=3D 0) { > > + // > > + // No data need to be written to Trace Hub > > + // > > + return RETURN_ABORTED; > > + } > > + > > + if (Str =3D=3D NULL) { > > + return RETURN_INVALID_PARAMETER; > > + } > > + > > + mipi_syst_write_debug_string ( > > + MipiSystH, > > + MIPI_SYST_NOLOCATION, > > + MIPI_SYST_STRING_GENERIC, > > + Severity, > > + Len, > > + Str > > + ); > > + > > + return RETURN_SUCCESS; > > +} > > + > > +/** > > + Invoke catalog_write_message function in Mipi Sys-T module. > > + > > + @param[in] MipiSystHandle A pointer to MIPI_SYST_HANDLE structure. > > + @param[in] Severity Severity type of input message. > > + @param[in] CatId Catalog Id. > > + > > + @retval RETURN_SUCCESS Data in buffer was processed. > > + @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a > NULL pointer. > > +**/ > > +RETURN_STATUS > > +EFIAPI > > +MipiSystWriteCatalog ( > > + IN MIPI_SYST_HANDLE *MipiSystHandle, > > + IN UINT32 Severity, > > + IN UINT64 CatId > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + if (MipiSystH =3D=3D NULL) { > > + return RETURN_INVALID_PARAMETER; > > + } > > + > > + mipi_syst_write_catalog64_message ( > > + MipiSystH, > > + MIPI_SYST_NOLOCATION, > > + Severity, > > + CatId > > + ); > > + > > + return RETURN_SUCCESS; > > +} > > diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > > new file mode 100644 > > index 0000000000..f2e7215b5b > > --- /dev/null > > +++ b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > > @@ -0,0 +1,52 @@ > > +## @file > > +# A library providing funcitons to communicate with mipi sys-T > submodule. > > +# > > +# Copyright (c) 2023, Intel Corporation. All rights reserved.
> > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +## > > + > > +[Defines] > > + INF_VERSION =3D 0x00010005 > > + BASE_NAME =3D MipiSysTLib > > + FILE_GUID =3D A58B0510-9E6D-4747-95D8-E5B8AF463= 3E6 > > + MODULE_TYPE =3D BASE > > + VERSION_STRING =3D 1.0 > > + LIBRARY_CLASS =3D MipiSysTLib > > + > > + DEFINE MIPI_HEADER_PATH =3D mipisyst/library/include/mipi_sys= t > > + DEFINE MIPI_SOURCE_PATH =3D mipisyst/library/src > > + > > +# > > +# The following information is for reference only and not required by = the > build tools. > > +# > > +# VALID_ARCHITECTURES =3D 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] > > + *_*_*_CC_FLAGS =3D -DMIPI_SYST_STATIC > > 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 > > +This file defines functions that output Trace Hub message. > > + > > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> > + > > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include > > +#include > > +#include > > +#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 VOID *MipiSystHandle, > > + IN UINT32 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite32 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle, > > + IN UINT32 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite32 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle, > > + IN UINT64 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite64 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle, > > + IN UINT8 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite8 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle, > > + IN UINT16 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite16 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle, > > + IN UINT32 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite32 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle, > > + IN UINT64 Data > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + MmioWrite64 ((UINTN)(MipiSystH- > >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 VOID *MipiSystHandle > > + ) > > +{ > > + MIPI_SYST_HANDLE *MipiSystH; > > + > > + MipiSystH =3D (MIPI_SYST_HANDLE *)MipiSystHandle; > > + > > + MmioWrite32 ((UINTN)(MipiSystH- > >systh_platform.TraceHubPlatformData.MmioAddr + 0x30), 0x0); > > +} > > 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 > > +This header file declares functions and structures. > > + > > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> > + > > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef MIPI_SYST_PLATFORM_H_ > > +#define MIPI_SYST_PLATFORM_H_ > > + > > +typedef struct { > > + UINT64 MmioAddr; > > +} TRACE_HUB_PLATFORM_SYST_DATA; > > + > > +struct mipi_syst_platform_handle { > > + TRACE_HUB_PLATFORM_SYST_DATA TraceHubPlatformData; > > +}; > > + > > +/** > > + 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 VOID *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 VOID *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 VOID *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 VOID *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 VOID *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 VOID *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 VOID *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 VOID *MipiSystHandle > > + ); > > + > > +#define MIPI_SYST_PLATFORM_CLOCK() 1000 // (unit: MicroSecond) > > + > > +#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/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 ## > > +MipiSysTLib library is a upper level library consuming MIPI SYS-T > submodule. > > +It provides MIPI-related APIs in EDK2 format to be consumed. > > + > > +## MipiSysTLib Version ## > > +EDK2 supports building with v1.1+edk2 official version which was fully > validated. > > + > > +## HOW to Install MipiSysTLib for UEFI Building ## > > +MIPI SYS-T repository was added as a submodule of EDK2 project. Please > > +refer to edk2/Readme.md for how to clone the code. > > + > > +## About GenMipiSystH.py ## > > +"GenMipiSystH.py" is a Python script which is used for customizing the > > +mipi_syst.h.in in mipi sys-T repository. The resulting file, mipi_syst= .h, will > > +be put to same folder level as this script. > > +``` > > + mipisyst submodule MipiSysTLib library > > +|---------------------| GenMipiSystH.py |---------------------| > > +| mipi_syst.h.in |-----------------> | mipi_syst.h | > > +|---------------------| |---------------------| > > +``` > > +This script needs to be done once by a developer when adding some > > +project-related definition or a new version of mipi_syst.h.in was rele= ased. > > +Normal users do not need to do this, since the resulting file is store= d > > +in the EDK2 git repository. > > 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 @@ > > +/* > > +Copyright (c) 2018, MIPI Alliance, Inc. > > +All rights reserved. > > + > > +Redistribution and use in source and binary forms, with or without > > +modification, are permitted provided that the following conditions > > +are met: > > + > > +* Redistributions of source code must retain the above copyright > > + notice, this list of conditions and the following disclaimer. > > + > > +* Redistributions in binary form must reproduce the above copyright > > + notice, this list of conditions and the following disclaimer in > > + the documentation and/or other materials provided with the > > + distribution. > > + > > +* Neither the name of the copyright holder nor the names of its > > + contributors may be used to endorse or promote products derived > > + from this software without specific prior written permission. > > + > > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS > > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR > > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT > > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, > > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, > > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND > ON ANY > > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > THE USE > > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH > DAMAGE. > > +*/ > > + > > +/* > > + * Contributors: > > + * Norbert Schulz (Intel Corporation) - Initial API and implementation > > + */ > > + > > +#ifndef MIPI_SYST_H_INCLUDED > > +#define MIPI_SYST_H_INCLUDED > > + > > +/* 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 =3D minimal (only short events) > > + * 20 =3D low overhead (exluding varag functions and CRC32) > > + * 30 =3D 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 >=3D > MIPI_SYST_MAKE_VERSION_CODE(1,5,0) > > + * // do what only >=3D 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_TO > STR(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 > > +#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,_MIP > I_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,_MIP > I_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+3 > 2,_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 > > + > > +#if defined(__cplusplus) > > +extern "C" { > > +#endif > > + > > +/** Major Message Types > > + */ > > +enum mipi_syst_msgtype { > > + MIPI_SYST_TYPE_BUILD =3D 0, /**< client build id message = */ > > + MIPI_SYST_TYPE_SHORT32 =3D 1, /**< value only message = */ > > + MIPI_SYST_TYPE_STRING =3D 2, /**< text message output = */ > > + MIPI_SYST_TYPE_CATALOG =3D 3, /**< catalog message output = */ > > + MIPI_SYST_TYPE_RAW =3D 6, /**< raw binary data = */ > > + MIPI_SYST_TYPE_SHORT64 =3D 7, /**< value only message = */ > > + MIPI_SYST_TYPE_CLOCK =3D 8, /**< clock sync message = */ > > + > > + MIPI_SYST_TYPE_MAX > > +}; > > + > > +/** MIPI_SYST_TYPE_DEBUG_STRING Sub-Types > > + */ > > +enum mipi_syst_subtype_string { > > + MIPI_SYST_STRING_GENERIC =3D 1, /**< string generic debug = */ > > + MIPI_SYST_STRING_FUNCTIONENTER =3D 2, /**< string is function name > */ > > + MIPI_SYST_STRING_FUNCTIONEXIT =3D 3, /**< string is function name = */ > > + MIPI_SYST_STRING_INVALIDPARAM =3D 5, /**< invalid SyS-T APIcall = */ > > + MIPI_SYST_STRING_ASSERT =3D 7, /**< Software Assert: failure= */ > > + MIPI_SYST_STRING_PRINTF_32 =3D 11, /**< printf with 32-bit packi= ng */ > > + MIPI_SYST_STRING_PRINTF_64 =3D 12, /**< printf with 64-bit packi= ng */ > > + > > + MIPI_SYST_STRING_MAX > > +}; > > + > > +/** MIPI_SYST_TYPE_CATALOG Sub-Types > > + */ > > +enum mipi_syst_subtype_catalog { > > + MIPI_SYST_CATALOG_ID32_P32 =3D 1, /**< 32-bit catalog ID, 32-bit p= acking > */ > > + MIPI_SYST_CATALOG_ID64_P32 =3D 2, /**< 64-bit catalog ID, 32-bit p= acking > */ > > + MIPI_SYST_CATALOG_ID32_P64 =3D 5, /**< 32-bit catalog ID, 64-bit p= acking > */ > > + MIPI_SYST_CATALOG_ID64_P64 =3D 6, /**< 64-bit catalog ID, 64-bit p= acking > */ > > + > > + MIPI_SYST_CATALOG_MAX > > +}; > > + > > +/** MIPI_SYST_TYPE_CLOCK Sub-Types > > + */ > > +enum mipi_syst_subtype_clock{ > > + MIPI_SYST_CLOCK_TRANSPORT_SYNC =3D 1, /**< SyS-T clock & frequen= cy > sync */ > > + MIPI_SYST_CLOCK_MAX > > +}; > > + > > +enum mipi_syst_subtype_build { > > + MIPI_SYST_BUILD_ID_COMPACT32 =3D 0, /**< compact32 build id = */ > > + MIPI_SYST_BUILD_ID_COMPACT64 =3D 1, /**< compact64 build id = */ > > + MIPI_SYST_BUILD_ID_LONG =3D 2, /**< normal build message = */ > > + MIPI_SYST_BUILD_MAX > > +}; > > + > > +struct mipi_syst_header; > > +struct mipi_syst_handle; > > +struct mipi_syst_scatter_prog; > > + > > +/** 128-bit GUID style message origin ID */ > > +struct mipi_syst_guid { > > + union { > > + mipi_syst_u8 b[16]; > > + mipi_syst_u64 ll[2]; > > + } u; > > +}; > > + > > +/** GUID initializer code > > + * > > + * This macro simplifies converting a GUID from its string representat= ion > > + * 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 =3D > > + * 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 =3D 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 para= meter > > +* is the unit value (4-bits) > > +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c} > > +* > > +* // Guid: {494E5443-B659-45AF-B786-9DB0786248AE} > > + > > +* #define MODULE_X 0x10 > > +* struct mipi_syst_origin =3D > > +* 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() AP= I > > + * function after the generic state members of the global state > > + * structure syst_hdr have been setup. It's purpose is to initialize t= he > > + * 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 reso= urces > > + * 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); > > + > > +/** > > + * 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 ste= ps. > > + * > > + * @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 out= put > > + * the raw message data. > > + * > > + * @param systh pointer to a SyS-T handle structure used in the API ca= ll, > > + * @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 in= clude > > + * 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); > > + > > +#ifdef __cplusplus > > +} /* extern C */ > > +#endif > > +#ifndef MIPI_SYST_PLATFORM_INCLUDED > > + > > +/** > > + * @defgroup PCFG_Config Platform Feature Configuration Defines > > + * > > + * Defines to customize the SyS-T feature set to match the platform ne= eds. > > + * > > + * Each optional library feature can be disabled by not defining the r= elated > > + * 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 Platform global SyS-T data state > > + * > > + * This define extends the global SyS-T state data structure > > + * mipi_syst_header with platform private content. A platform typicall= y > > + * stores data for SyS-T handle creation processing in this structure. > > + * > > + * Note: This data is not touched by the library code itself, but typi= cally > > + * is used by platform hook functions for handle creation and destruc= tion. > > + * **These hook function calls are not lock protected and may happen > > + * concurrently!** The hook functions need to implement locking if th= ey > > + * modify the platform state data. > > + * > > + * The platform example uses #mipi_syst_platform_state as data state > extension. > > + */ > > +#define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA > > +#undef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA > > +/** > > + * 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 typicall= y > > + * 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 stat= e > > + * extension. > > + */ > > +#define MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA > > + > > +/** > > + * Enable HEAP usage for handle generation > > + * > > + * This macro tells the SyS-T library to enable the heap allocation ha= ndle > > + * creation API #MIPI_SYST_ALLOC_HANDLE. > > + * The platform must provide the macros #MIPI_SYST_HEAP_MALLOC and > > + * #MIPI_SYST_HEAP_FREE to point SyS-T to the platform malloc and free > > + * functions. > > + * > > + * Note: In OS kernel space environments, you must use unpaged memory > > + * allocation functions. > > + */ > > +#define MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY > > +#undef MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY > > +/* 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 wri= te > > + * 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 specifie= d > 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, a= lso > > + * 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 > > + /** > > + * Enable printf API support > > + * > > + * Note: > > + * Enabling printf requires compiler var_arg support as defined by the > > + * header files stdarg.h stddef.h. > > + */ > > + > > +#define MIPI_SYST_PCFG_ENABLE_PRINTF_API > > +#undef MIPI_SYST_PCFG_ENABLE_PRINTF_API > > +/** > > + * Maximum size of printf payload in bytes. > > + * Adjust this value if larger strings shall be supported by the libra= ry. > > + * 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 specifie= d > 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 the API variants that send file:line ID pair location record= s. > > + */ > > +#define MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD > > +#undef MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD > > +/** > > + * Enable the API variants that send the address of the instrumentatio= n > location. > > + * > > + * This API requires #MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD to be > set as well. > > + * It uses its own define as it additionally requires the function > > + * @ref mipi_syst_return_addr() to be implemented for your platform. > > + */ > > +#define MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS > > +#undef MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS > > +/** > > + * 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 hardwar= e > > + * timestamped trace protocol like MIPI STP or if the HW timestamp can= not > > + * 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 leng= th > > + * 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 > > +#ifdef __cplusplus > > +extern "C" { > > +#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 > > + > > +/** SyS-T global state structure. > > + * This structure is holding the global SyS-T library state > > + */ > > +struct mipi_syst_header { > > + mipi_syst_u32 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 r= outine > */ > > +#endif > > +#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA) > > + struct mipi_syst_platform_state systh_platform; > > + /**< platform specific state */ > > +#endif > > +}; > > + > > +/** > > + * Message data header tag definition > > + * > > + * Each SyS-T message starts with a 32-bit message tag. The tag define= s the > > + * message originator and decoding information for the data following > > + * the tag. > > + */ > > + > > +struct mipi_syst_msg_tag { > > +#if defined(MIPI_SYST_BIG_ENDIAN) > > + mipi_syst_u32 et_res31 : 1; /**< reserved for future use *= / > > + mipi_syst_u32 et_res30 : 1; /**< reserved for future use *= / > > + mipi_syst_u32 et_subtype : 6; /**< type dependent sub category *= / > > + mipi_syst_u32 et_guid : 1; /**< 128-bit GUID present *= / > > + mipi_syst_u32 et_modunit : 11; /**< unit for GUID or module:unit *= / > > + mipi_syst_u32 et_timestamp : 1;/**< indicate 64-bit timestamp *= / > > + mipi_syst_u32 et_chksum : 1; /**< indicate 32-bit CRC *= / > > + mipi_syst_u32 et_length : 1; /**< indicate length field *= / > > + mipi_syst_u32 et_location : 1; /**< indicate location information *= / > > + mipi_syst_u32 et_res7 : 1; /**< reserved for future use *= / > > + mipi_syst_u32 et_severity : 3; /**< severity level of message *= / > > + mipi_syst_u32 et_type : 4; /**< SyS-T message type ID *= / > > +#else > > + mipi_syst_u32 et_type : 4; /**< SyS-T message type ID *= / > > + mipi_syst_u32 et_severity : 3; /**< severity level of message *= / > > + mipi_syst_u32 et_res7 : 1; /**< reserved for future use *= / > > + mipi_syst_u32 et_location : 1; /**< indicate location information *= / > > + mipi_syst_u32 et_length : 1; /**< indicate length field *= / > > + mipi_syst_u32 et_chksum : 1; /**< indicate 32-bit CRC *= / > > + mipi_syst_u32 et_timestamp : 1;/**< indicate 64-bit timestamp *= / > > + mipi_syst_u32 et_modunit : 11; /**< unit for GUID or module:unit *= / > > + mipi_syst_u32 et_guid : 1; /**< 128-bit GUID present *= / > > + mipi_syst_u32 et_subtype : 6; /**< type dependent sub category *= / > > + mipi_syst_u32 et_res30 : 1; /**< reserved for future use *= / > > + mipi_syst_u32 et_res31 : 1; /**< reserved for future use *= / > > +#endif > > +}; > > +#define _MIPI_SYST_MK_MODUNIT_ORIGIN(m,u) (((u) & 0xF)|(m<<4)) > > + > > +/** > > + * Message severity level enumeration > > + */ > > +enum mipi_syst_severity { > > + MIPI_SYST_SEVERITY_MAX =3D 0, /**< no assigned severity */ > > + MIPI_SYST_SEVERITY_FATAL =3D 1, /**< critical error level */ > > + MIPI_SYST_SEVERITY_ERROR =3D 2, /**< error message level */ > > + MIPI_SYST_SEVERITY_WARNING =3D 3,/**< warning message level */ > > + MIPI_SYST_SEVERITY_INFO =3D 4, /**< information message level */ > > + MIPI_SYST_SEVERITY_USER1 =3D 5, /**< user defined level 5 */ > > + MIPI_SYST_SEVERITY_USER2 =3D 6, /**< user defined level 6 */ > > + MIPI_SYST_SEVERITY_DEBUG =3D 7 /**< debug information level */ > > +}; > > + > > +/** > > + * 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 =3D 16-Bit file and 16-Bit line (total: 32-bit) > > + * 1 =3D 32-Bit file and 32-Bit line (total: 64-bit) > > + * 2 =3D 32-bit code address > > + * 3 =3D 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; > > +}; > > + > > +/** internal handle state flags > > + */ > > +struct mipi_syst_handle_flags { > > + mipi_syst_u32 shf_alloc:1; /**< set to 1 if heap allocated handle */ > > +}; > > + > > +/** 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. > > + */ > > + 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 > > + > > + mipi_syst_u32 systh_param_count; /**< number of parameters = */ > > + mipi_syst_u32 systh_param[6]; /**< catalog msg parameter= s */ > > + > > +#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA) > > + struct mipi_syst_platform_handle systh_platform; > > + /**< platform specific state */ > > +#endif > > +}; > > + > > + > > +#ifdef __cplusplus > > +} /* extern C */ > > +#endif > > +#ifndef MIPI_SYST_API_INCLUDED > > +#include "mipi_syst/api.h" > > +#endif > > + > > +typedef struct mipi_syst_header MIPI_SYST_HEADER; > > +typedef struct mipi_syst_handle MIPI_SYST_HANDLE; > > +typedef enum mipi_syst_severity MIPI_SYST_SEVERITY; > > +typedef struct mipi_syst_guid MIPI_SYST_GUID; > > +typedef struct mipi_syst_msg_tag MIPI_SYST_MSG_TAG; > > +typedef struct mipi_syst_handle_flags MIPI_SYST_HANDLE_FLAGS; > > +#endif > > 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 @@ > > { > > ## options defined .pytool/Plugin/LicenseCheck > > "LicenseCheck": { > > - "IgnoreFiles": [] > > + "IgnoreFiles": [ > > + # This file is copied from mipi sys-T submodule and genera= ted by > python script with customization. > > + "Library/MipiSysTLib/mipi_syst.h" > > + ] > > }, > > "EccCheck": { > > ## Exception sample looks like below: > > @@ -68,7 +71,8 @@ > > "Include/Library/SafeIntLib.h", > > "Include/Protocol/DebugSupport.h", > > "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c= ", > > - "Library/BaseFdtLib" > > + "Library/BaseFdtLib", > > + "Library/MipiSysTLib/mipi_syst.h" > > ] > > }, > > ## options defined ci/Plugin/CompilerPlugin > > @@ -166,6 +170,7 @@ > > "IgnoreStandardPaths": [], # Standard Plugin defined paths t= hat > should be ignore > > "AdditionalIncludePaths": [] # Additional paths to spell check > (wildcards supported) > > }, > > + > > # options defined in .pytool/Plugin/UncrustifyCheck > > "UncrustifyCheck": { > > "IgnoreFiles": [ > > @@ -175,7 +180,8 @@ > > "Library/BaseFdtLib/stddef.h", > > "Library/BaseFdtLib/stdint.h", > > "Library/BaseFdtLib/stdlib.h", > > - "Library/BaseFdtLib/string.h" > > + "Library/BaseFdtLib/string.h", > > + "mipi_syst.h" > > ] > > } > > } > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec > > index d6c4179b2a..597f4f7137 100644 > > --- a/MdePkg/MdePkg.dec > > +++ b/MdePkg/MdePkg.dec > > @@ -28,6 +28,7 @@ > > Include > > Test/UnitTest/Include > > Test/Mock/Include > > + Library/MipiSysTLib/mipisyst/library/include > > > > [Includes.IA32] > > Include/Ia32 > > @@ -293,6 +294,14 @@ > > # > > FdtLib|Include/Library/FdtLib.h > > > > + ## @libraryclass Provides general mipi sys-T services. > > + # > > + MipiSysTLib|Include/Library/MipiSysTLib.h > > + > > + ## @libraryclass Provides API to output Trace Hub debug message. > > + # > > + TraceHubDebugSysTLib|Include/Library/TraceHubDebugSysTLib.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 b38c863812..902a39cffc 100644 > > --- a/MdePkg/MdePkg.dsc > > +++ b/MdePkg/MdePkg.dsc > > @@ -184,6 +184,7 @@ > > MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf > > MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf > > MdePkg/Library/TdxLib/TdxLib.inf > > + MdePkg/Library/MipiSysTLib/MipiSysTLib.inf > > > > [Components.EBC] > > MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > > 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>`__ > > - `RedfishPkg/Library/JsonLib/jansson > 1e24960fae02/LICENSE>`__ > > - `MdePkg/Library/BaseFdtLib/libfdt org/pylibfdt/blob/f39368a217496d32c4091a2dba4045b60649e3a5/BSD-2- > Clause>`__ > > +- `MdePkg/Library/MipiSysTLib/mipisyst 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 `__. > > -- > > 2.39.2.windows.1 > > > > > > > >=20 > > > >