From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.7490.1615809788045808440 for ; Mon, 15 Mar 2021 05:03:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=B5tqW86c; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: dandan.bi@intel.com) IronPort-SDR: irptpZEOJFMgm4e7AOOP2mM8FEZ2qNjZ6eiA+C5ToOP3ipi8xLXIDLqpVuk9uBEL1VT5mPKVtT gMwhXBKLHhig== X-IronPort-AV: E=McAfee;i="6000,8403,9923"; a="189164996" X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="189164996" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2021 05:03:07 -0700 IronPort-SDR: PkRA5spG8JPjis8xMItDnc4/pjkyhHf+royYxqyta1YKlKBEvn5bQ4ucj+16MZkHfWMc+5/g8G gpnbwWg/QqGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="405151341" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 15 Mar 2021 05:03:06 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 05:03:06 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 05:03:06 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 05:03:06 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Mon, 15 Mar 2021 05:03:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n1sd0qjiyU2OJkvXhz8Ey5SiO96FakbFkUPlwFhAjgxBJanFBwOne051wtVkfabKn2mNVBUjebppHFOV63PgttmTF2qYjRFp/MJHOkqjDIDcBI+3NWk9OwrHBZGmIlFv6AxiQzLIIniK8cyYFSfc4cOC/qBpCYhBPko/DgRAIOIx0aktEmdJiTQihM0iLWfjqiAdaA6GNnYKN5XUY2XH6VnHnZxG9dXxpVHLGHhM/v+3eFTU0qNuB1q80yix3umOciPU/bvxKriIMpqEkNjtmJ2g8ePHJHjtVk+v9fuBCY34eL1jnXosSxP5px6+Ydaa91GOcOnlGMlPdjon2G87Dg== 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-SenderADCheck; bh=wletEAIGsvyzafgwCg/J2FGjMniQSrVKBNWTPK27uiw=; b=Saw/JcetKCUn+H8P5UFA92/T4ZQrWjWa4hZCzYMeo7RuKoD0q29/E0miGoSzK64QsHziPa8A8oMTMSNn8jcRVqqlmSjaRUWZ3A4Ekoo1aumTBEeUzB44gXeuR2YFukLs9FGXtNsKQBIVRYurpSlIGgUHikNwrwnGYTLVWUyKx6w3FCBtTF+QRgSeZdtUTijqLn9z6gsQRN+nrSMhFSF4hq5bitm0UP2LoLs4eb/Ren70waZ+bi+faXWkW2Ps9gQK3BQ6tC/WDS6cY5PeCkQF5X6PcevpjaNqde5LN5mVfg8dBWUXxpA6Yk/BKgc37SZu5LdyGnuNpItn8FT7/3xtGw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wletEAIGsvyzafgwCg/J2FGjMniQSrVKBNWTPK27uiw=; b=B5tqW86cqf7IXuZ1GzNhHJHP2HVDOaUVvfz8eg8yzKRwzTL5Kcov0A6FjLR12cU9MOFk9u9rGs4TwI9Dx3woBaMts04U4Y8pIvTpSeizU7GBXt+qtumdUyUBwrYdvlDL/N+4JqZM1NlkXViw5/+tdvQkdjQiqrTFGNDC+K7Gbzo= Received: from SJ0PR11MB4862.namprd11.prod.outlook.com (2603:10b6:a03:2de::16) by SJ0PR11MB4816.namprd11.prod.outlook.com (2603:10b6:a03:2ad::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Mon, 15 Mar 2021 12:03:04 +0000 Received: from SJ0PR11MB4862.namprd11.prod.outlook.com ([fe80::1928:2ae6:91e3:e431]) by SJ0PR11MB4862.namprd11.prod.outlook.com ([fe80::1928:2ae6:91e3:e431%7]) with mapi id 15.20.3933.032; Mon, 15 Mar 2021 12:03:04 +0000 From: "Dandan Bi" To: "Chang, Abner (HPS SW/FW Technologist)" , "devel@edk2.groups.io" CC: "Kinney, Michael D" , Liming Gao , "Liu, Zhiguang" Subject: Re: [edk2-devel] [patch 01/28] MdePkg: Add RegisterFilterLib class and NULL instance Thread-Topic: [edk2-devel] [patch 01/28] MdePkg: Add RegisterFilterLib class and NULL instance Thread-Index: AQHXGVsAUlRPQmCF/kyGYKmX7e1amqqE8q8g Date: Mon, 15 Mar 2021 12:03:04 +0000 Message-ID: References: <20210315035844.32756-1-dandan.bi@intel.com> <20210315035844.32756-2-dandan.bi@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a33edf9b-8a6a-4bed-6c6b-08d8e7aa4a0d x-ms-traffictypediagnostic: SJ0PR11MB4816: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:188; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gdlacwEyHZ4xLndCPLmCkFOdZwuRP3kKAXZxAIOf84iolGicWK3AqixzUl1gj+1I0CCIQPyUlxQPXaWywfqNQwGxK7x0fa+Hp5FYNqT/PnDoIQEHs5GB4p/vh7ZB9jXcPqBuGEr7rBugs0UEA0O9PZchDO3rTLWpCL7yup4kSzweruOK1TmU+2XMdHJtsUjvHjC2U/twARkw/qur7p/ND1UNNYVEe0BSs7lmra9C0Zsg8xjFT/Uc/pReu3bF5hzJfMSTS2FDjkkPKxp0zJBGCDwqJP84T/tbsft/1zyjw6PdU2n0ygDjkd5saWmqdyo0bw4sj5eZGNJ/oAGWqkkPiEf7SmnmNbpL8PFJ5KeirRxXMvmnXGSpUDqMRLd4Hj6033eWie1ejlNev78vhQtMMn2KstK0DwZp1LC93oMGP5dFOB6Y27dT1kJcK/ALR3IcY3T952IwEK0EcUwsv41xeKivy4iaxOeaCrUzuqnfPmrbogS0a7JRjiBe+GEcbTAVjbXrasDi1/zoxzsK2O9M++FANq6wE+Lx5uMagCADNAaUqiJrMvKvHTBX5zjEYNXZkkee4l3jKrr3tAMEYtPSptNWe2wUuasjOGiX/9gt0q5WpC7G8UuMK3j9IaMUmsh+yZtxlEJh2Y78+cb87udsRw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB4862.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(396003)(39860400002)(346002)(136003)(26005)(9686003)(186003)(478600001)(53546011)(966005)(110136005)(71200400001)(54906003)(76116006)(66476007)(107886003)(7696005)(55016002)(19627235002)(66946007)(6506007)(66556008)(8676002)(64756008)(66446008)(30864003)(83380400001)(8936002)(52536014)(296002)(316002)(4326008)(2906002)(86362001)(33656002)(5660300002)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?YX6RnMriI9oe0SqnEspAsJUUBugtXzAfC6HiUN9Xz6172Ei96gSaqIted9es?= =?us-ascii?Q?KqQk2pWh+6N+S3/bHpffUuhqOzE2Svba641MfeSm6QZafTdwjZOzziWBROkH?= =?us-ascii?Q?79xTPV+RLKNfnrmExln2rX2oI0sUN0eD4K2bdmxMULeRwxlUz4+a7/ICTCR6?= =?us-ascii?Q?rgQcERpqF4W/Eqmw0/Wd6B3LhfGB8ghQ7xPa9E+AwsbmBv9HW73uhLXUSN6Y?= =?us-ascii?Q?JbsOEOcpqBfJzx31aGZ/dh0HmZnjscXThxM4iUCqVCkaxoOE+DQOO8Y1RY32?= =?us-ascii?Q?m6cNFkHCr+XSGK9tr0mwYyEJUKIAdupk+Xyvwkl+Bw4KYMLHoqAxR6BI7IgV?= =?us-ascii?Q?mdIhEf1JC0y9XgKiDwoOfV5D8mDmKp/BuBhzD2B+T7pwAFXW+3lzxUfZ2Mx/?= =?us-ascii?Q?3MCm8bTdVFvo/MhEqCmBQdDSjRdDOIUzx063CgNJroFANCAoGt6293cjrQRD?= =?us-ascii?Q?HMOhRoPtYfpkdwcfuXRpYZ/XbclLnRsVmfu71ANc77eGDYSZ9854l4R/5tiQ?= =?us-ascii?Q?GN9SP83JTL6aOjE0oITJgL+ReOVxKACZRSYMZiKiVX+GyvFXksEoPJNN04OS?= =?us-ascii?Q?RVv1b3EghywJr0rbvMGVADmEYSUkSAKAEx3KeEQ9UycG/HYsjvsqcJQCvYCZ?= =?us-ascii?Q?n/5zSISs1O9g9cugGa4Cjzgs42uAo68eKL7SENq4EI9NmqeIhlol6DOdKgew?= =?us-ascii?Q?hTQhAGQxpq3sj6eyGwXq46v6JQ7VsedPX50/F5QjKEbRqATd3iVsUTKKVNvP?= =?us-ascii?Q?WBlr2lgjm0PWEpOOEjYyO84Zqqvx1Scg0Zn4HqB2a7fpGGD7+OmCUq+RIrLz?= =?us-ascii?Q?8gMJWhLMZ82PibPv9sTfKIzTWBzAU4lwAp0o3aI0GpVQsNlNCnCr82MqfsLp?= =?us-ascii?Q?JKCEMVGZS0NZPECG4ok7hkuzAbP5VdVvC8fICQ+Ky9dRFZo7kZe/0YY6YOZ7?= =?us-ascii?Q?Lh9mA0l/lpEqNNWC3MqF1p60n1ooFeOlccTqiCGnK2LLhMbp9TFTbIiKZzpu?= =?us-ascii?Q?b0fzYpC1zWC+GChUAI5LwxkE+R/Th5WfA+E4Sp0/IjHxn2x7OISrjU+mfHrA?= =?us-ascii?Q?T15mn9TjUYjZwhaAR2WFNywxdsgFUXowGg76XR50DLjsgFimPKLrTiMCCjoG?= =?us-ascii?Q?7wd3BhDkGfGVtKI24K5ry71j2xgbozsAIkJcc1XGNHk6mBf35oqabXBK2y4e?= =?us-ascii?Q?sKVBK15HvC1H9qO02qpH0WL6n+HWhLTR2emH4zD9Uu3yd0cFc06SGmvCDPNB?= =?us-ascii?Q?6f0/vBMURg0Ji+sYt1JantDp1uKUbB0L/yRbHr8BVhRhu3tcY+xQYOvYX/n7?= =?us-ascii?Q?aSA=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB4862.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a33edf9b-8a6a-4bed-6c6b-08d8e7aa4a0d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2021 12:03:04.4720 (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: X5Xl8vlCyIt9hJuL8YwpZeBf3+NMoDbndhir4Hug1kJnCl/hQqXlqnYndO1fejXUWU7H7FNmKi6HJKmuZOVXEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4816 Return-Path: dandan.bi@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Chang, Abner (HPS SW/FW Technologist) > Sent: Monday, March 15, 2021 1:21 PM > To: devel@edk2.groups.io; Bi, Dandan > Cc: Kinney, Michael D ; Liming Gao > ; Liu, Zhiguang > Subject: RE: [edk2-devel] [patch 01/28] MdePkg: Add RegisterFilterLib cl= ass > and NULL instance >=20 >=20 >=20 > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > > Dandan Bi > > Sent: Monday, March 15, 2021 11:58 AM > > To: devel@edk2.groups.io > > Cc: Michael D Kinney ; Liming Gao > > ; Zhiguang Liu > > Subject: [edk2-devel] [patch 01/28] MdePkg: Add RegisterFilterLib > > class and NULL instance > > > > REF: https://urldefense.proofpoint.com/v2/url?u=3Dhttps- > > 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid- > > > 3D3246&d=3DDwIBAg&c=3DC5b8zRQO1miGmBeVZ2LFWg&r=3D_SN6FZBN4Vgi4Ulks > > > kz6qU3NYRO03nHp9P7Z5q59A3E&m=3D2NiPCGng1TEgIa1agqNkkCSJR3rLRI9362 > > Sft59aE3A&s=3D0NN1lyRHr9srqeFrm4i9O4Y31EP4QO7TRYz8Cl8-pI8&e=3D > > > > 1. Add a new library class (RegisterFilterLib) to filter and trace > > port IO/MMIO/MSR access. > > 2. Add a NULL instance (RegisterFilterLibNull) can be used to keep > > current behavior. > > > > Cc: Michael D Kinney > > Cc: Liming Gao > > Cc: Zhiguang Liu > > Signed-off-by: Dandan Bi > > --- > > MdePkg/Include/Library/RegisterFilterLib.h | 225 ++++++++++++++++ > > .../RegisterFilterLibNull.c | 253 +++++++++++++++++= + > > .../RegisterFilterLibNull.inf | 23 ++ > > .../RegisterFilterLibNull.uni | 13 + > > MdePkg/MdePkg.dec | 7 +- > > MdePkg/MdePkg.dsc | 4 +- > > 6 files changed, 523 insertions(+), 2 deletions(-) create mode > > 100644 MdePkg/Include/Library/RegisterFilterLib.h > > create mode 100644 > > MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c > > create mode 100644 > > MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf > > create mode 100644 > > MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni > > > > diff --git a/MdePkg/Include/Library/RegisterFilterLib.h > > b/MdePkg/Include/Library/RegisterFilterLib.h > > new file mode 100644 > > index 0000000000..df0adb3a42 > > --- /dev/null > > +++ b/MdePkg/Include/Library/RegisterFilterLib.h > > @@ -0,0 +1,225 @@ > > +/** @file > > + Public include file for the Port IO/MMIO/MSR RegisterFilterLib. > > + > > +Copyright (c) 2021, Intel Corporation. All rights reserved.
> > + > > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef REGISTER_FILTER_LIB_H_ > > +#define REGISTER_FILTER_LIB_H_ > > + > > +typedef enum { > > + FilterWidth8, > > + FilterWidth16, > > + FilterWidth32, > > + FilterWidth64 > > +} FILTER_IO_WIDTH; > > + > > +/** > > + Filter IO read operation before read IO port. > > + It is used to filter IO read operation. > > + > > + It will return the flag to decide whether require read real IO port= . > > + It can be used for emulation environment. > Can we have the description of meaning of the return flag in @retval in = both > header and source files? Also for all of below functions. Sure, thanks Abner.=20 I will wait to see whether there is more comment and handle them together = in later new patch version.=20 Thanks, Dandan >=20 > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN OUT VOID *Buffer > > + ); > > + > > +/** > > + Trace IO read operation after read IO port. > > + It is used to trace IO operation. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ); > > +/** > > + Filter IO Write operation before wirte IO port. > > + It is used to filter IO operation. > > + > > + It will return the flag to decide whether require read write IO por= t. > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The source buffer from which to BeforeWri= te > data. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ); > > + > > + /** > > + Trace IO Write operation after wirte IO port. > > + It is used to trace IO operation. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The source buffer from which to BeforeWri= te > data. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ); > > + > > +/** > > + Filter memory IO before Read operation. > > + > > + It will return the flag to decide whether require read real MMIO. > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMmIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN OUT VOID *Buffer > > + ); > > + > > +/** > > + Tracer memory IO after read operation > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMmIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ); > > + > > +/** > > + Filter memory IO before write operation > > + > > + It will return the flag to decide whether require wirte real MMIO. > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The source buffer from which to BeforeWri= te > data. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMmIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ); > > + > > +/** > > + Tracer memory IO after write operation > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The source buffer from which to BeforeWri= te > data. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMmIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ); > > + > > +/** > > + Filter MSR before read operation. > > + > > + It will return the flag to decide whether require read real MSR. > > + It can be used for emulation environment. > > + > > + @param Index The 8-bit Machine Specific Regist= er index to > > BeforeWrite. > > + @param Value The 64-bit value to BeforeRead fr= om the > > Machine Specific Register. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMsrRead ( > > + IN UINT32 Index, > > + IN OUT UINT64 *Value > > + ); > > + > > +/** > > + Trace MSR after read operation > > + > > + @param Index The 8-bit Machine Specific Regist= er index to > > BeforeWrite. > > + @param Value The 64-bit value to BeforeRead fr= om the > > Machine Specific Register. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMsrRead ( > > + IN UINT32 Index, > > + IN UINT64 *Value > > + ); > > + > > +/** > > + Filter MSR before write operation > > + > > + It will return the flag to decide whether require write real MSR. > > + It can be used for emulation environment. > > + > > + @param Index The 8-bit Machine Specific Regist= er index to > > BeforeWrite. > > + @param Value The 64-bit value to BeforeWrite t= o the Machine > > Specific Register. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMsrWrite ( > > + IN UINT32 Index, > > + IN UINT64 *Value > > + ); > > + > > +/** > > + Trace MSR after write operation > > + > > + @param Index The 8-bit Machine Specific Regist= er index to > > BeforeWrite. > > + @param Value The 64-bit value to BeforeWrite t= o the Machine > > Specific Register. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMsrWrite ( > > + IN UINT32 Index, > > + IN UINT64 *Value > > + ); > > + > > +#endif // REGISTER_FILTER_LIB_H_ > > diff --git > > a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c > > b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c > > new file mode 100644 > > index 0000000000..5c2bc2864a > > --- /dev/null > > +++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c > > @@ -0,0 +1,253 @@ > > +/** @file > > + Null instance of RegisterFilterLib. > > + > > + Copyright (c) 2021 Intel Corporation. All rights reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include > > + > > +/** > > + Filter IO read operation before read IO port. > > + It is used to filter IO read operation. > > + > > + It will return the flag to decide whether require read real IO port= . > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in,out] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN OUT VOID *Buffer > > + ) > > +{ > > + return TRUE; > > +} > > + > > +/** > > + Trace IO read operation after read IO port. > > + It is used to trace IO operation. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ) > > +{ > > + return; > > +} > > + > > +/** > > + Filter IO Write operation before wirte IO port. > > + It is used to filter IO operation. > > + > > + It will return the flag to decide whether require read write IO por= t. > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The source buffer from which to write dat= a. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ) > > +{ > > + return TRUE; > > +} > > + > > + /** > > + Trace IO Write operation after wirte IO port. > > + It is used to trace IO operation. > > + > > + @param[in] Width Signifies the width of the I/O operation. > > + @param[in] Address The base address of the I/O operation. > > + @param[in] Buffer The source buffer from which to Write dat= a. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ) > > +{ > > + return; > > +} > > + > > +/** > > + Filter memory IO before Read operation. > > + > > + It will return the flag to decide whether require read real MMIO. > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in,out] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMmIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN OUT VOID *Buffer > > + ) > > +{ > > + return TRUE; > > +} > > + > > +/** > > + Tracer memory IO after read operation. > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The destination buffer to store the resul= ts. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMmIoRead ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ) > > +{ > > + return; > > +} > > + > > +/** > > + Filter memory IO before write operation. > > + > > + It will return the flag to decide whether require wirte real MMIO. > > + It can be used for emulation environment. > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The source buffer from which to write dat= a. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMmIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ) > > +{ > > + return TRUE; > > +} > > + > > +/** > > + Tracer memory IO after write operation. > > + > > + @param[in] Width Signifies the width of the memory I/O ope= ration. > > + @param[in] Address The base address of the memory I/O operat= ion. > > + @param[in] Buffer The source buffer from which to write dat= a. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMmIoWrite ( > > + IN FILTER_IO_WIDTH Width, > > + IN UINTN Address, > > + IN VOID *Buffer > > + ) > > +{ > > + return; > > +} > > + > > +/** > > + Filter MSR before read operation. > > + > > + It will return the flag to decide whether require read real MSR. > > + It can be used for emulation environment. > > + > > + @param Index The Register index of the MSR. > > + @param Value Point to the data will be read fr= om the MSR. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMsrRead ( > > + IN UINT32 Index, > > + IN OUT UINT64 *Value > > + ) > > +{ > > + return TRUE; > > +} > > + > > +/** > > + Trace MSR after read operation. > > + > > + @param Index The Register index of the MSR. > > + @param Value Point to the data has been be rea= d from the > MSR. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMsrRead ( > > + IN UINT32 Index, > > + IN UINT64 *Value > > + ) > > +{ > > + return; > > +} > > + > > +/** > > + Filter MSR before write operation. > > + > > + It will return the flag to decide whether require write real MSR. > > + It can be used for emulation environment. > > + > > + @param Index The Register index of the MSR. > > + @param Value Point to the data want to be writ= ten to the > MSR. > > + > > +**/ > > +BOOLEAN > > +EFIAPI > > +FilterBeforeMsrWrite ( > > + IN UINT32 Index, > > + IN UINT64 *Value > > + ) > > +{ > > + return TRUE; > > +} > > + > > +/** > > + Trace MSR after write operation. > > + > > + @param Index The Register index of the MSR. > > + @param Value Point to the data has been be wri= tten to the > MSR. > > + > > +**/ > > +VOID > > +EFIAPI > > +FilterAfterMsrWrite ( > > + IN UINT32 Index, > > + IN UINT64 *Value > > + ) > > +{ > > + return; > > +} > > + > > diff --git > > a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf > > b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf > > new file mode 100644 > > index 0000000000..a7fc7497ed > > --- /dev/null > > +++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf > > @@ -0,0 +1,23 @@ > > +## @file > > +# Null instance of RegisterFilterLib. > > +# > > +# Copyright (c) 2021, Intel Corporation. All rights reserved.
# > > +# > > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > > + > > +[Defines] > > + INF_VERSION =3D 0x00010005 > > + BASE_NAME =3D FilterLibNull > > + MODULE_UNI_FILE =3D FilterLibNull.uni > > + FILE_GUID =3D 9F555194-A410-4AD6-B3FC-53F6E10F= A793 > > + MODULE_TYPE =3D BASE > > + VERSION_STRING =3D 1.0 > > + LIBRARY_CLASS =3D RegisterFilterLib > > + > > +[Sources] > > + RegisterFilterLibNull.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > diff --git > > a/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni > > b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni > > new file mode 100644 > > index 0000000000..8a8f1c4a77 > > --- /dev/null > > +++ b/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni > > @@ -0,0 +1,13 @@ > > +// /** @file > > +// Null instance of RegisterFilterLib. > > +// > > +// Copyright (c) 2021, Intel Corporation. All rights reserved.
// > > +// SPDX-License-Identifier: BSD-2-Clause-Patent // // **/ > > + > > + > > +#string STR_MODULE_ABSTRACT #language en-US "Null instan= ce of > > RegisterFilterLib. > > +#string STR_MODULE_DESCRIPTION #language en-US "Null instan= ce > of > > RegisterFilterLib." > > + > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index > > 1d2637acc2..c437e2a065 100644 > > --- a/MdePkg/MdePkg.dec > > +++ b/MdePkg/MdePkg.dec > > @@ -2,11 +2,11 @@ > > # This Package provides all definitions, library classes and librarie= s instances. > > # > > # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of > > # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards. > > # > > -# Copyright (c) 2007 - 2020, Intel Corporation. All rights > > reserved.
> > +# Copyright (c) 2007 - 2021, Intel Corporation. All rights > > +reserved.
> > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > reserved.
# (C) Copyright 2016 - 2020 Hewlett Packard Enterprise > > Development LP
# # SPDX-License-Identifier: BSD-2-Clause-Patent > > # @@ -255,10 +255,15 @@ > > ## @libraryclass Extension to BaseLib for host based unit tests tha= t allows > a > > # subset of BaseLib services to be hooked for emulat= ion. > > # > > > > UnitTestHostBaseLib|Test/UnitTest/Include/Library/UnitTestHostBaseLib. > > h > > > > + ## @libraryclass > > + # > > + # > > + RegisterFilterLib|Include/Library/RegisterFilterLib.h > > + > > ## @libraryclass This library provides an interface to request > > non-MMRAM pages to be mapped > > # or unblocked from inside MM environment. > > # > > MmUnblockMemoryLib|Include/Library/MmUnblockMemoryLib.h > > > > diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index > > 79629e3f93..be89e28eef 100644 > > --- a/MdePkg/MdePkg.dsc > > +++ b/MdePkg/MdePkg.dsc > > @@ -1,9 +1,9 @@ > > ## @file > > # EFI/PI MdePkg Package > > # > > -# Copyright (c) 2007 - 2020, Intel Corporation. All rights > > reserved.
> > +# Copyright (c) 2007 - 2021, Intel Corporation. All rights > > +reserved.
> > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > reserved.
# (C) Copyright 2020 Hewlett Packard Enterprise > > Development LP
# > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > # > > @@ -125,10 +125,12 @@ > > > > > MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib. > > inf > > > > > > > MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntry > > Point.inf > > > > > MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTab > > leLib.inf > > > > + MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf > > + > > [Components.IA32, Components.X64, Components.ARM, > Components.AARCH64] > > # > > # Add UEFI Target Based Unit Tests > > # > > MdePkg/Test/UnitTest/Library/BaseLib/BaseLibUnitTestsUefi.inf > > -- > > 2.18.0.windows.1 > > > > > > > >=20 > > >=20