From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BEFF3AC1A79 for ; Mon, 11 Dec 2023 17:34:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=SQCzQge8sJuE3Kcm7wAlKvlrksdKnZNhnYeYyRFY6FE=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1702316050; v=1; b=Gm4HE9NN1A+1Ve7p69PohHnbAMCqfD4qyDtdMC70tO48y3Yp2DXutKpxPGBQ9wPFYB6kurvX v2RJwkIOV7BNknnxj1XRycivDthVMc6DIg5WGuQqYPNFoG2MEvG2Hb5jnUZRLTGonnz3+hT29l2 /qkzv+J4EMOkKbApkTANxoJk= X-Received: by 127.0.0.2 with SMTP id WSq3YY7687511xRoWtOcglN3; Mon, 11 Dec 2023 09:34:10 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.1298.1702316049363846553 for ; Mon, 11 Dec 2023 09:34:09 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="374193338" X-IronPort-AV: E=Sophos;i="6.04,268,1695711600"; d="scan'208";a="374193338" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2023 09:34:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="891228703" X-IronPort-AV: E=Sophos;i="6.04,268,1695711600"; d="scan'208";a="891228703" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Dec 2023 09:34:08 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Dec 2023 09:34:08 -0800 X-Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 11 Dec 2023 09:34:07 -0800 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2507.35 via Frontend Transport; Mon, 11 Dec 2023 09:34:07 -0800 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 11 Dec 2023 09:34:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QuGgFTCX3DfWvbxBXUxoeh3258FBgfv/LX1qH6Wh87JqWLUbMWB374aBaGwRhWzfllw7vjjUS3FNaMnPpGE2b7HyHSqSdxcszoL+Bikgg2Dh6mWIcU/z6M1/MBo1Ux//vsCLGY8xceS5hGV5XcyDAD0dMgCGqL55vttHWsZFr/T9E9Y92iRZ9OkWwWrIU8plcRpmUM4naJnfEJt72Op3aryvThvbcpz4IdfSpAqZ4GZocnEbfuRzTYaSWUGHaWf5wlqaLHDwW+kU9yHvX+nyugPVOnsnPq5SN1WxeiP+GBvK8AxZD9cK4tr1mXDVE6+Ex/zTx15j/YJUUkNgZu6Mpg== 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=NLmI/F7qwEBGkvK0JZ3aft80AMOI69nOj7Q+xwxSc1k=; b=RBp1mSXTR1zm8DFXKNZcC1TjpIjxcXm/iZjndaE7yhRtknG+P+26/QXnpMM96S1BKANarDMeZg+bkeISvAA3XtWzzyUWt9TP2ipT2PznuW4V8ndSpcUdt3tg2Q216hUaQuO/fAU1ysVeCyH3PdVIri/t7/e2xA2x1xRifO7fPJpYMo1FV170RdjKNe9xOeAxH4n/ohW50uRXsCgL5URB/+WoxIU/wWznSETU/nYp5w20Yrxt1ZDDYGU9RqEUDfZgqVY/+fSsu+zzurILz8d4gXMX840wMHdha1P3HEICxqKBPmaT7tXvr0O6Fhpyr8GECchGux1n6TUHzalMNCGlWg== 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 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by CY8PR11MB7945.namprd11.prod.outlook.com (2603:10b6:930:7b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 17:34:01 +0000 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::4382:5b03:f13:88ff]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::4382:5b03:f13:88ff%4]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 17:34:01 +0000 From: "Michael D Kinney" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Liu, Zhiguang" , "Ni, Ray" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH 2/2] MdePkg:simplify Fifo API in BaseIoLibIntrinsic Thread-Topic: [edk2-devel] [PATCH 2/2] MdePkg:simplify Fifo API in BaseIoLibIntrinsic Thread-Index: AQHaKCY7AI+ioMHw7kK4mObbiBsT2LCkYAEg Date: Mon, 11 Dec 2023 17:34:01 +0000 Message-ID: References: <20231109024958.1732-1-dun.tan@intel.com> <1795D4A7D7819C64.15940@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|CY8PR11MB7945:EE_ x-ms-office365-filtering-correlation-id: a2494fb6-bafa-4d60-0cc9-08dbfa6f5d11 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: +fOEHhC2A2I1q1AJZouJL/IqaPPPGNJOOlARRuHDwWS7rA8FkNNDPfg8ff1G5oQ+UQnSlHFcphCFp34xVeabpThx7Rl8644picAD1EA33fisAsPsP6vBjl9hJ1XigsIH1goy+G8OHB134IVIn29/T4pobmMhbnpctwAgXXXcjJEUKf4WEmBKj+YM4FNQr8aqr5Icbw/GDIZNPQNkZTdTwYeBNHvDCajyNhqb2Yq1QKZy9Fy6DsdsYsLhAscRBpPFTbouw0IajrYHayMLRvtIeKOrGe92s/VUUcZZKCzFEYysYd7vb71NE5ORVi8LU0VPYPZ6/UXVtMCZmdmRDaJCR5Q7wVmZvGQphoFwnH93ZWTLBNe9LKJE+8vL+niPuSl4ON2bGcMi4OcVnpfvPP9Yju4PE5KBoRiFUACVChw5qV8J6eiwyQJeCj7728bifrymCWwTxpbDh2Gaz3mUU98zmNeNpIEhHVzRVWm/DjBpTqnDwFRriTbjJdMk0yqCsSR6uXF4DoNt4of8+34cVuyAcf3P0joJE/7agt/3JeEdkp4o/VC/eanYJnmYU5UXUxQjZpmuD1SgJA3ndf+uNQL5tBj8yYIbbxRmd2xAmalosJa0p2d7w8h8PrangbgsuZuT8CpGhqD/UX+uq8WuRQ+tuw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?sJcgsX8rbXZNkeady/aUnllC1jcGt/IwMAb9ia1usnaVs+MEkOwnGc4Z/U4j?= =?us-ascii?Q?m5Cow9x2E+TRRUzx3biyrqiZ+Dy8gS4M/LLEOZjmWvNu3BRB5TYc5/COVNKM?= =?us-ascii?Q?9XuMbAHzwZFCiEbrJVPcUJFnICIKGhxe9bE/i3mEOhsdhk58aBsqhh/tSfKW?= =?us-ascii?Q?m83FTcN4Fhk5M8yGwn+URJc7PcjO9gHLxGTG5xl8BFUZNGw32nNucirGn37g?= =?us-ascii?Q?GH+1syElnobgGdjOuXGojO3Q9US6RTgnyJZmVxaYHdk1OC7DYBdKP9GaLtBQ?= =?us-ascii?Q?C2ydZzSUDtRDwA/YbAOO8vlXgvqQZz/+LSWM6l/O6tUuOtmHMnwpGV4xOtSP?= =?us-ascii?Q?+6N7bPZFvE9rvi9gggx2Ez2dUWGyYUsqN3b5KdVfh01xNk3GObZO+6y1qB/+?= =?us-ascii?Q?Ni4K2WFe7eoJmZpTmEFLjdQqJ35jFQWD2LS/c9H/gJMYjaXd4GKAZPLubznl?= =?us-ascii?Q?IZHEh89PvxSc1Hh11Bxs5j+1X0SIxwqgvPgBOUtkcwH9t2+fFa+xdYZvKqJv?= =?us-ascii?Q?+0dW1UrLspQxmK+vfO6Vz8+lWOMf9ELIKsoemyWX9+lY9K99a6Lu3pCwWlQF?= =?us-ascii?Q?yOYlCT7fq8FO1WUA7TWYFV4mHrE/9NykzOb74EskvaqnbVDrAqEGJfGdintp?= =?us-ascii?Q?LpQ1v9f+XKAKxjh+mlxEbUvh04ycR154k3LhmkYh9Cq+m6dhsEvp7khuH0cg?= =?us-ascii?Q?PpmAVNaBJ+Jnl6rFbNw5mAmmdMYFWlbzyfyVpLvqJA8YR/UglmVCBBXChz2L?= =?us-ascii?Q?ukge8Ky/kwjp1ItugSf5oRmrOdqLbXCxiIkffv7mPLbopo+O1SJjwC3RP4HP?= =?us-ascii?Q?s8VrMdSM4OdIWK1huC4B33JyGK2DPoUEyD6vXcMDaiZvRMm7Mo7tfuo+z8SP?= =?us-ascii?Q?4EzqUzyPcD6MpjSdVC8/8LHu7krh4xLx1ujWYb46DGhgi7tUsWT8yw2j+QrA?= =?us-ascii?Q?lwQEJUf0SMkXB8HwOoXeqPz8SwPq/PgqkHVn8Oul1duDTt9cvkjO7DdqAeME?= =?us-ascii?Q?Jz9v0GOf/00Ch6QUoLH2NO/akOSSzz2huFEl4+edbJlqY+GGSq65aS31aBsG?= =?us-ascii?Q?7wkUMhfBf78ev9RCdc1J0HkN4KIzbPgRFT3MJXsh0w8WPIsl5gwfbtoXiuOu?= =?us-ascii?Q?6vFRDekhaKrU5vCUSdU0JZqAAcFJVN6ThZBGjqfTqHnKO28AXlb2SgdjW8M6?= =?us-ascii?Q?Lx9w74YfnFcFL5tE2jGI4VASZkOQdoCtiPR5JDqLdxtRsrjRykP8rRGRLKVB?= =?us-ascii?Q?WVfMWsUu5yuotd5R0IWM/rssug53PITFverc8ESHhrtDnch4U50VfssI/lwe?= =?us-ascii?Q?HTDgsnnrDjznTbM97DLco4Pu0/dQOX0e3jE75dTvYub0ggubsEpwqbiclPDd?= =?us-ascii?Q?7v55KcGJvegcV53FQERlSMpdr63PE/c+wIlf4R53oZQv0IDLvrqoXVSGzyFH?= =?us-ascii?Q?zH0OSJ6CZNgDOxIvQOBPpRCebuCda7NaS813UXs1OAtf3jx+Ye0B0hRkHTzB?= =?us-ascii?Q?oesRw0iquinOnJ6VqC6B/BCNGJapM9Y35oUGK1duBc9WoqdaIiTdaOwX9UxG?= =?us-ascii?Q?hUwnigjq4QsXHNTHZHg7RnrG2K3FBjPFhKlcB3hI?= 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: a2494fb6-bafa-4d60-0cc9-08dbfa6f5d11 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2023 17:34:01.2268 (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: nsuSZ3oTmhpFaoSRIRblXqsbbrqwYztRqK2vWEvmnJDljnCQnn6EFxFIonXex0GivQVPchWrj7W/jo7fkwRoJMwv3hCAvuWitSLMxL3r5L0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7945 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: cVYgJyBg02iEUBKTpKUmkwwLx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Gm4HE9NN; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Acked-by: Michael D Kinney Mike > -----Original Message----- > From: Tan, Dun > Sent: Wednesday, December 6, 2023 1:26 AM > To: devel@edk2.groups.io; Tan, Dun > Cc: Kinney, Michael D ; Gao, Liming > ; Liu, Zhiguang ; Ni, > Ray > Subject: RE: [edk2-devel] [PATCH 2/2] MdePkg:simplify Fifo API in > BaseIoLibIntrinsic >=20 > Hi Mike and Liming, >=20 > Could you please help to review this patch? >=20 > Thanks, > Dun >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of duntan > Sent: Thursday, November 9, 2023 10:50 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D ; Gao, Liming > ; Liu, Zhiguang ; Ni, > Ray > Subject: [edk2-devel] [PATCH 2/2] MdePkg:simplify Fifo API in > BaseIoLibIntrinsic >=20 > Simplify IoRead/WriteFifo implement by repeatedly calling IoRead/Write > in the C code. > This can avoid calling assembly code to use string I/O instructions. > With this change Ia32/IoFifo.nasm and X64/IoFifo.nasm can be removed. > Then the source files for IA32 and X64 are the same. >=20 > Signed-off-by: Dun Tan > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu > Cc: Ray Ni > --- > MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 10 ++------ > -- > MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm | 131 -------- > ------------------------------------------------------------------------ > --------------------------------------------------- > MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c | 220 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++ > MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm | 120 -------- > ------------------------------------------------------------------------ > ---------------------------------------- > 4 files changed, 222 insertions(+), 259 deletions(-) >=20 > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > index aeb072ee95..b587e2cded 100644 > --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > +++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > @@ -38,17 +38,11 @@ > IoLibInternalTdxNull.c > IoLibTdx.h >=20 > -[Sources.IA32] > +[Sources.IA32, Sources.X64] > IoLibGcc.c | GCC > IoLibMsc.c | MSFT > IoLib.c > - Ia32/IoFifo.nasm > - > -[Sources.X64] > - IoLibGcc.c | GCC > - IoLibMsc.c | MSFT > - IoLib.c > - X64/IoFifo.nasm > + IoLibFifo.c >=20 > [Sources.EBC] > IoLibEbc.c > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > deleted file mode 100644 > index a4ae1a0053..0000000000 > --- a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > +++ /dev/null > @@ -1,131 +0,0 @@ > -;---------------------------------------------------------------------- > -------- > -; > -; Copyright (c) 2006 - 2012, Intel Corporation. All rights > reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights > reserved.
-; -; SPDX-License-Identifier: BSD-2-Clause-Patent -; > -;---------------------------------------------------------------------- > -------- > - > - SECTION .text > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoReadFifo8 ( > -; IN UINTN Port, > -; IN UINTN Size, > -; OUT VOID *Buffer > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoReadFifo8) > -ASM_PFX(IoReadFifo8): > - push edi > - cld > - mov dx, [esp + 8] > - mov ecx, [esp + 12] > - mov edi, [esp + 16] > -rep insb > - pop edi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoReadFifo16 ( > -; IN UINTN Port, > -; IN UINTN Size, > -; OUT VOID *Buffer > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoReadFifo16) > -ASM_PFX(IoReadFifo16): > - push edi > - cld > - mov dx, [esp + 8] > - mov ecx, [esp + 12] > - mov edi, [esp + 16] > -rep insw > - pop edi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoReadFifo32 ( > -; IN UINTN Port, > -; IN UINTN Size, > -; OUT VOID *Buffer > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoReadFifo32) > -ASM_PFX(IoReadFifo32): > - push edi > - cld > - mov dx, [esp + 8] > - mov ecx, [esp + 12] > - mov edi, [esp + 16] > -rep insd > - pop edi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoWriteFifo8 ( > -; IN UINTN Port, > -; IN UINTN Size, > -; IN VOID *Buffer > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoWriteFifo8) > -ASM_PFX(IoWriteFifo8): > - push esi > - cld > - mov dx, [esp + 8] > - mov ecx, [esp + 12] > - mov esi, [esp + 16] > -rep outsb > - pop esi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoWriteFifo16 ( > -; IN UINTN Port, > -; IN UINTN Size, > -; IN VOID *Buffer > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoWriteFifo16) > -ASM_PFX(IoWriteFifo16): > - push esi > - cld > - mov dx, [esp + 8] > - mov ecx, [esp + 12] > - mov esi, [esp + 16] > -rep outsw > - pop esi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoWriteFifo32 ( > -; IN UINTN Port, > -; IN UINTN Size, > -; IN VOID *Buffer > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoWriteFifo32) > -ASM_PFX(IoWriteFifo32): > - push esi > - cld > - mov dx, [esp + 8] > - mov ecx, [esp + 12] > - mov esi, [esp + 16] > -rep outsd > - pop esi > - ret > - > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c > b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c > new file mode 100644 > index 0000000000..bd1d372d0f > --- /dev/null > +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c > @@ -0,0 +1,220 @@ > +/** @file > + IoFifo read/write routines. > + > + Copyright (c) 2021 - 2023, Intel Corporation. All rights > + reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "BaseIoLibIntrinsicInternal.h" > +#include > + > +/** > + Reads an 8-bit I/O port fifo into a block of memory. > + > + Reads the 8-bit I/O fifo port specified by Port. > + The port is read Count times, and the read data is stored in the > + provided Buffer. > + > + This function must guarantee that all I/O read and write operations > + are serialized. > + > + If 8-bit I/O port operations are not supported, then ASSERT(). > + > + In TDX a serial of TdIoRead8 is invoked to read the I/O port fifo. > + > + @param Port The I/O port to read. > + @param Count The number of times to read I/O port. > + @param Buffer The buffer to store the read data into. > + > +**/ > +VOID > +EFIAPI > +IoReadFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + UINT8 *Buffer8; > + > + Buffer8 =3D (UINT8 *)Buffer; > + while (Count-- > 0) { > + *Buffer8++ =3D IoRead8 (Port); > + } > +} > + > +/** > + Writes a block of memory into an 8-bit I/O port fifo. > + > + Writes the 8-bit I/O fifo port specified by Port. > + The port is written Count times, and the write data is retrieved > + from the provided Buffer. > + > + This function must guarantee that all I/O write and write operations > + are serialized. > + > + If 8-bit I/O port operations are not supported, then ASSERT(). > + > + In TDX a serial of TdIoWrite8 is invoked to write data to the I/O > port. > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to retrieve the write data from. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + IN VOID *Buffer > + ) > +{ > + UINT8 *Buffer8; > + > + Buffer8 =3D (UINT8 *)Buffer; > + while (Count-- > 0) { > + IoWrite8 (Port, *Buffer8++); > + } > +} > + > +/** > + Reads a 16-bit I/O port fifo into a block of memory. > + > + Reads the 16-bit I/O fifo port specified by Port. > + The port is read Count times, and the read data is stored in the > + provided Buffer. > + > + This function must guarantee that all I/O read and write operations > + are serialized. > + > + If 16-bit I/O port operations are not supported, then ASSERT(). > + > + In TDX a serial of TdIoRead16 is invoked to read data from the I/O > port. > + > + @param Port The I/O port to read. > + @param Count The number of times to read I/O port. > + @param Buffer The buffer to store the read data into. > + > +**/ > +VOID > +EFIAPI > +IoReadFifo16 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + UINT16 *Buffer16; > + > + Buffer16 =3D (UINT16 *)Buffer; > + while (Count-- > 0) { > + *Buffer16++ =3D IoRead16 (Port); > + } > +} > + > +/** > + Writes a block of memory into a 16-bit I/O port fifo. > + > + Writes the 16-bit I/O fifo port specified by Port. > + The port is written Count times, and the write data is retrieved > + from the provided Buffer. > + > + This function must guarantee that all I/O write and write operations > + are serialized. > + > + If 16-bit I/O port operations are not supported, then ASSERT(). > + > + In TDX a serial of TdIoWrite16 is invoked to write data to the I/O > port. > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to retrieve the write data from. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo16 ( > + IN UINTN Port, > + IN UINTN Count, > + IN VOID *Buffer > + ) > +{ > + UINT16 *Buffer16; > + > + Buffer16 =3D (UINT16 *)Buffer; > + while (Count-- > 0) { > + IoWrite16 (Port, *Buffer16++); > + } > +} > + > +/** > + Reads a 32-bit I/O port fifo into a block of memory. > + > + Reads the 32-bit I/O fifo port specified by Port. > + The port is read Count times, and the read data is stored in the > + provided Buffer. > + > + This function must guarantee that all I/O read and write operations > + are serialized. > + > + If 32-bit I/O port operations are not supported, then ASSERT(). > + > + In TDX a serial of TdIoRead32 is invoked to read data from the I/O > port. > + > + @param Port The I/O port to read. > + @param Count The number of times to read I/O port. > + @param Buffer The buffer to store the read data into. > + > +**/ > +VOID > +EFIAPI > +IoReadFifo32 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + UINT32 *Buffer32; > + > + Buffer32 =3D (UINT32 *)Buffer; > + while (Count-- > 0) { > + *Buffer32++ =3D IoRead32 (Port); > + } > +} > + > +/** > + Writes a block of memory into a 32-bit I/O port fifo. > + > + Writes the 32-bit I/O fifo port specified by Port. > + The port is written Count times, and the write data is retrieved > + from the provided Buffer. > + > + This function must guarantee that all I/O write and write operations > + are serialized. > + > + If 32-bit I/O port operations are not supported, then ASSERT(). > + > + In TDX a serial of TdIoWrite32 is invoked to write data to the I/O > port. > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to retrieve the write data from. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo32 ( > + IN UINTN Port, > + IN UINTN Count, > + IN VOID *Buffer > + ) > +{ > + UINT32 *Buffer32; > + > + Buffer32 =3D (UINT32 *)Buffer; > + while (Count-- > 0) { > + IoWrite32 (Port, *Buffer32++); > + } > +} > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm > b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm > deleted file mode 100644 > index d459072f6e..0000000000 > --- a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm > +++ /dev/null > @@ -1,120 +0,0 @@ > -;---------------------------------------------------------------------- > -------- > -; > -; Copyright (c) 2006 - 2012, Intel Corporation. All rights > reserved.
-; Copyright (c) 2017, AMD Incorporated. All rights > reserved.
-; -; SPDX-License-Identifier: BSD-2-Clause-Patent -; > -;---------------------------------------------------------------------- > -------- > - > - DEFAULT REL > - SECTION .text > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoReadFifo8 ( > -; IN UINTN Port, // rcx > -; IN UINTN Size, // rdx > -; OUT VOID *Buffer // r8 > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoReadFifo8) > -ASM_PFX(IoReadFifo8): > - cld > - xchg rcx, rdx > - xchg rdi, r8 ; rdi: buffer address; r8: save rdi > -rep insb > - mov rdi, r8 ; restore rdi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoReadFifo16 ( > -; IN UINTN Port, // rcx > -; IN UINTN Size, // rdx > -; OUT VOID *Buffer // r8 > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoReadFifo16) > -ASM_PFX(IoReadFifo16): > - cld > - xchg rcx, rdx > - xchg rdi, r8 ; rdi: buffer address; r8: save rdi > -rep insw > - mov rdi, r8 ; restore rdi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoReadFifo32 ( > -; IN UINTN Port, // rcx > -; IN UINTN Size, // rdx > -; OUT VOID *Buffer // r8 > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoReadFifo32) > -ASM_PFX(IoReadFifo32): > - cld > - xchg rcx, rdx > - xchg rdi, r8 ; rdi: buffer address; r8: save rdi > -rep insd > - mov rdi, r8 ; restore rdi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoWriteFifo8 ( > -; IN UINTN Port, // rcx > -; IN UINTN Size, // rdx > -; IN VOID *Buffer // r8 > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoWriteFifo8) > -ASM_PFX(IoWriteFifo8): > - cld > - xchg rcx, rdx > - xchg rsi, r8 ; rsi: buffer address; r8: save rsi > -rep outsb > - mov rsi, r8 ; restore rsi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoWriteFifo16 ( > -; IN UINTN Port, // rcx > -; IN UINTN Size, // rdx > -; IN VOID *Buffer // r8 > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoWriteFifo16) > -ASM_PFX(IoWriteFifo16): > - cld > - xchg rcx, rdx > - xchg rsi, r8 ; rsi: buffer address; r8: save rsi > -rep outsw > - mov rsi, r8 ; restore rsi > - ret > - > -;---------------------------------------------------------------------- > -------- > -; VOID > -; EFIAPI > -; IoWriteFifo32 ( > -; IN UINTN Port, // rcx > -; IN UINTN Size, // rdx > -; IN VOID *Buffer // r8 > -; ); > -;---------------------------------------------------------------------- > -------- > -global ASM_PFX(IoWriteFifo32) > -ASM_PFX(IoWriteFifo32): > - cld > - xchg rcx, rdx > - xchg rsi, r8 ; rsi: buffer address; r8: save rsi > -rep outsd > - mov rsi, r8 ; restore rsi > - ret > - > -- > 2.31.1.windows.1 >=20 >=20 >=20 >=20 >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112324): https://edk2.groups.io/g/devel/message/112324 Mute This Topic: https://groups.io/mt/103009916/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-