From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.4755.1615785681976413418 for ; Sun, 14 Mar 2021 22:21:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=UBxrIG0+; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=07087943f4=abner.chang@hpe.com) Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12F5HkDd022209; Mon, 15 Mar 2021 05:21:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=nZtz9BJ+2cgqCnAwCO8tsAn1SBT+hfOLm/3XWkX3pGk=; b=UBxrIG0+R38URQAZrXYyKkccSHEWrFXcQG6WsfUiOq66QL1Uu6AykYC4KDDejOGYAAVU BMyuXpUavdpFbMKAOotON5eVlAiKEc/A3l6qobke4YVIgayOb7tDumPsC9ftlQzEq4WF XvjrQq06DcKBSciCZDvxj8Z4GXzLWN6UTDRCTd2rZEuFMTXNgz29TzI8SVmzDts3h88Z IGxI2DPV0H8kSFSlXtOhy0mSgwFM0zCT7NflSnLI5EmXRNA81wirrxZ67gVpAZVZGL6p pgGhYNYUyA/eLGWCXOzGEzxkodA4HWekbw2LV8Ia1Fu6mF2QKe0K3f1JuNinO7kRyeKc IA== Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) by mx0a-002e3701.pphosted.com with ESMTP id 379757pk4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Mar 2021 05:21:11 +0000 Received: from G4W9120.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.210.21.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2353.austin.hpe.com (Postfix) with ESMTPS id 1FF9594; Mon, 15 Mar 2021 05:21:10 +0000 (UTC) Received: from G2W6310.americas.hpqcorp.net (2002:10c5:4034::10c5:4034) by G4W9120.americas.hpqcorp.net (2002:10d2:150f::10d2:150f) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Mar 2021 05:21:09 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (15.241.52.11) by G2W6310.americas.hpqcorp.net (16.197.64.52) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 15 Mar 2021 05:21:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nxNynhODY5w08dKaNp5IAECZi+zjEgDI7/wPChqO8tWXcMSqhaeeDwueC1vn+MBfLwAkmgV9A461Ob1aWBXKzQD9PrHrsqS13KvYykTiiextKiG+LnG+5OHZzugonOJ3xVBbGf/eomAcpynJmCoLRh2EXpT1BOc9wAKVH8/UFeXr5rsxydPzg6sG4hMgN5iNpZxH7FOPmFv+oQkLb3LfgOQJLIOQaGScdj514+YKpU8BL5lydzdE5B3G76P7VDAbdfUzaq5w20orDSFeQPIjPL+k3OhBnxhTd+FVou1NvgTL6ei+yeQwTsP47/bl7AsRYwRxRR7fPNFd1sgUYz13qg== 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=CFOLgA84/h+M1WZ95WRElrImk7x+w/5YAwMLlenPwOk=; b=MV/nK5oIvDvpN73HCyW2bUFgulyueTWA/WUk6IodGDLJkHsdozL/nmQhWORsLfVxuLnNbQ/DnBF7tOkRaE7N3sfpj7HSaKMCo4rby0MgWUJT8yWHL+h12fUxso8a/iELkLAf7M/pB939KOqAp0T9UH0vA9goQcWddFF4q79MeujXh6vaJlDrij6nYLC+3zMNP1qAcJRGuH7GPtEHeqZDEdLPRII/HHj6uW2GeuryCcwv7SZUb9tq3bvGi9DP66rNBPYG09y+4vIOVZWFnX/61iUt6Ppu+stWUIKyEhN7bsvKl7RcP+rjy2bYpTzt5gzPTFGCFHLs1f2gRgyGpZqOig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7508::16) by CS1PR8401MB0709.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Mon, 15 Mar 2021 05:21:07 +0000 Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::adb6:a875:93ca:b54a]) by CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::adb6:a875:93ca:b54a%12]) with mapi id 15.20.3933.032; Mon, 15 Mar 2021 05:21:07 +0000 From: "Abner Chang" To: "devel@edk2.groups.io" , "dandan.bi@intel.com" CC: Michael D Kinney , Liming Gao , Zhiguang Liu 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: AQHXGU+h9cJmV9i8KUuOl6lUO6q7zKqEglEw Date: Mon, 15 Mar 2021 05:21:07 +0000 Message-ID: References: <20210315035844.32756-1-dandan.bi@intel.com> <20210315035844.32756-2-dandan.bi@intel.com> In-Reply-To: <20210315035844.32756-2-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=hpe.com; x-originating-ip: [16.242.247.131] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3f41b6a6-984a-4bd4-f1aa-08d8e7722317 x-ms-traffictypediagnostic: CS1PR8401MB0709: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:128; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UaBqk+Ba6mcjdRTHmOuq2Xcy16LoZ5sN+UdNpLYTKkDUfe1UcWvplMbV3agQZbRAgkYU/AtK/3eMDlewCJNDopAlyauE+PawCvJmotJdCyX5Aa2oSnf1WAdQwbmTjo5eZRPnact/Wp+1CLi9tRm1NW6K+1k2IVpWp+Y6iBa2tCERDTUHTrktOC1p+qsS8eVzOiFxxOuu/trS9v4CvuJ7wIjDeWGdEnPwdLAY6vOKCe3MANFPi7hdU4zj6JpR2zFysugr6Sb0SAHYXLis0hWbF7ZxykmSIserjagnzCjAMJqScvV7qfPtsPtA/6I7LbCxt51SCazwjI5BGMndYjYO0InVtWpLMc1Ed6J+OaU8zhwyr9C4eXMPRv4e3toQ1mYF5OQtQBIsXc2PoaDOLqQxs9f0sT4gJa9aTUpuEu3eM68mCS6Sj9fevEvDVUK151iiOGGNaoNJ+jf9MUCsxSaIZ76V3eUxvaStvFlAHXqt6bklF5feA7VFbY5LXpIfVeHZWmKMG6HBE39eclcjGAMbYPupRe9ijYh7Fsgnu0lOEEQcuJT/Jm1Co4km6KJzbVkfPzuClpom9KEHBIwk4ssLnOcJ9uoqIPQ3G6OgjKuGoBoB0BLCp1akXB3jl94B66IfAzaCJHDMnThxJY1Zkn566g== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(136003)(376002)(396003)(39860400002)(71200400001)(54906003)(110136005)(6506007)(9686003)(53546011)(64756008)(55016002)(966005)(7696005)(66556008)(66476007)(19627235002)(66946007)(66446008)(478600001)(5660300002)(52536014)(4326008)(8676002)(76116006)(86362001)(186003)(316002)(26005)(8936002)(30864003)(2906002)(83380400001)(33656002)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?KvJjt13f1n98L0bJz6pmz46okLbKoDMSEAgb97nsi0+PsfddQQqB9MIJQBqH?= =?us-ascii?Q?k9awV5IWrID2HqKHBbKp/cnzEH+bmHnIzXgI0IG8720vQvQ+MvJN9113R2ux?= =?us-ascii?Q?QOLUrEnoPj15wXrcWVP6IGecE9dr2nQQ9cRCWNWC/GJAzH9rGbvQqmCytkMj?= =?us-ascii?Q?HXAIHS3mKee/JlNHCfQVGk/V2KEdc6/9aFwAx3dTeiGz+MlZZfV0gO4ZX6aG?= =?us-ascii?Q?BqLUlizn4C79lM4PjBFEFV5/rnZAduKO3Rm2ikoVSagW9Hb+EoP3pAznpMJQ?= =?us-ascii?Q?Tm6DcP18D1kl5v65eSUVrngqOtKwfK58Qjd8u9N9EQZJown+3PfbPkFAtCet?= =?us-ascii?Q?kDLSyP5HTBulapED3WpDrhoNaFGaRoPaKPJ3rANPiIomiaSrBp7uIp4HyOq+?= =?us-ascii?Q?T+NR4T6cwaq8CqsUBPNsW0ngblK9te+b7z1NIrTmzv5U44+5GZxEOaj1LCiH?= =?us-ascii?Q?N76dR/eUOxqjw8BteBg+Dua0xZQFBH7u5RRDkT4lNicnn3POv9QFIQckBj2k?= =?us-ascii?Q?qUFtu9vAXFxTieycURU1LizjacMnpNmVDKSy6pE7jX4Cn4DxhtnnQUK44pkh?= =?us-ascii?Q?Cqufk8OEhg1mz62XkKCUgN7wAUVx7TyAKY6NqJ0CoicRhczFtK0kZGm4uCnu?= =?us-ascii?Q?+ABU6aOD1SIzpi1jMfaYdOAgjxG0r2mbU5YiNtfNcSySjgx6GVHHZuhp6UCO?= =?us-ascii?Q?t7jJdIlVupxqwPV8DMQ8AkEEBPxb6Y5cgrsqAu2K/5Ud3gFweNhX83i/NN9j?= =?us-ascii?Q?vHMMANtG22cOkTgN8bw+PvZ43eK4sxjS4Yrj7aeaZp+JUrIkfyJrBroudOt6?= =?us-ascii?Q?wYtn0nOo3aXFYJGAowiIZ+ItBIvq1UAkZ5U4KfNo4xVKNeunGeAL5ici5S9M?= =?us-ascii?Q?c80qWXSHZYJwzIONlWjvamsQpkZ6+Lx7ajU6cBW2nFFAM2ouv2arc6aqE8mm?= =?us-ascii?Q?sd2sG9Hqx33psPJ32l92cis015B1Q6iu02qOog0Igkl5wQsmhVdU1ElJxK9E?= =?us-ascii?Q?MsiW0CwNGqWAwxk8B9cRwEicHLQDytXQH/pieupm1bwJ0vFo2WnyLqBRsTVR?= =?us-ascii?Q?cl4LxUv3rb58JT/HdQRgeTgmNO1E9PWb6tF5z43Ojo9nmhHc13p0Rg8GaD3q?= =?us-ascii?Q?tJIk5s5/REpPS09iWCZ5Op549GJFQCdwXgfbQ+zOi/6m87W8tYkQvNIMseMq?= =?us-ascii?Q?s/yDeTYcFnSjk2TaxZ+e7TU3LQ7t3IN0hJQExbflcjEQhOFhg1KgMGsfzWj6?= =?us-ascii?Q?ZCkk86G7uqsiekWHe6g7G1S6ZTKR2vZCpizEzeCfPTpe/wdgq24CaITASumj?= =?us-ascii?Q?EIZfJm7Hb9DcpPp3izif7du6?= x-ms-exchange-transport-forked: True X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 3f41b6a6-984a-4bd4-f1aa-08d8e7722317 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2021 05:21:07.3135 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: A3uJPP4zJsWP8LRGsy9mRlFMbW3jmQAGr2VLCFPkbw2nrFiVl6XmV03nZNVAOBgODNz6eLiEnO2FCR7QwpFE6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0709 X-OriginatorOrg: hpe.com X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-15_01:2021-03-15,2021-03-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103150035 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----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 >=20 > REF: INVALID URI REMOVED > 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 >=20 > 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 curre= nt > behavior. >=20 > 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 >=20 > 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 bo= th header and source files? Also for all of below functions. > + > + @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 results= . > + > +**/ > +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 results= . > + > +**/ > +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 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] Buffer The source buffer from which to BeforeWrite= 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 BeforeWrite= 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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The destination buffer to store the results= . > + > +**/ > +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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The destination buffer to store the results= . > + > +**/ > +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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The source buffer from which to BeforeWrite= 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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The source buffer from which to BeforeWrite= 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 Register= index to > BeforeWrite. > + @param Value The 64-bit value to BeforeRead from= 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 Register= index to > BeforeWrite. > + @param Value The 64-bit value to BeforeRead from= 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 Register= index to > BeforeWrite. > + @param Value The 64-bit value to BeforeWrite to = 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 Register= index to > BeforeWrite. > + @param Value The 64-bit value to BeforeWrite to = 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 results= . > + > +**/ > +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 results= . > + > +**/ > +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 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] Buffer The source buffer from which to write data. > + > +**/ > +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 data. > + > +**/ > +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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in,out] Buffer The destination buffer to store the results= . > + > +**/ > +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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The destination buffer to store the results= . > + > +**/ > +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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The source buffer from which to write data. > + > +**/ > +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 opera= tion. > + @param[in] Address The base address of the memory I/O operatio= n. > + @param[in] Buffer The source buffer from which to write data. > + > +**/ > +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 from= 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 read = 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 writte= n 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 writt= en 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-53F6E10FA7= 93 > + 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 instance= of > RegisterFilterLib. > +#string STR_MODULE_DESCRIPTION #language en-US "Null instance= 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 libraries = 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 that = allows a > # subset of BaseLib services to be hooked for emulatio= n. > # > UnitTestHostBaseLib|Test/UnitTest/Include/Library/UnitTestHostBaseLib= .h >=20 > + ## @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 >=20 > 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 @@ >=20 > MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib. > inf >=20 >=20 > MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntry > Point.inf >=20 > MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTab > leLib.inf >=20 > + 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 >=20 >=20 >=20