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 D7FDAD8118F for ; Wed, 6 Dec 2023 09:26:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=4+7UmHBC9evyNfo5v1/qodQH8YKE+qmAOjp/Z81GBRU=; 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=1701854774; v=1; b=WWuAZV/5FOKaAOphieOGkYz1akEZFknUy7GqOmbLNwlXFXqhsUnFt0B4IqPg7LQ9DM1Newn3 Jv6gS7/Di8RszJF4uFJOSj1YXt6/H4WO+amy18K5evaJ34o0WFoTgTNcpSv6n6udAHQ8NMqV7T2 Fs6eXnhI49MqEu8VsnZhSp88= X-Received: by 127.0.0.2 with SMTP id AetSYY7687511xIrsaILTBkD; Wed, 06 Dec 2023 01:26:14 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.27775.1701854773594259695 for ; Wed, 06 Dec 2023 01:26:14 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10915"; a="393762355" X-IronPort-AV: E=Sophos;i="6.04,254,1695711600"; d="scan'208";a="393762355" X-Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2023 01:26:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,254,1695711600"; d="scan'208";a="19269150" X-Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 06 Dec 2023 01:26:06 -0800 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 6 Dec 2023 01:26:05 -0800 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 6 Dec 2023 01:26:04 -0800 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.35 via Frontend Transport; Wed, 6 Dec 2023 01:26:04 -0800 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 6 Dec 2023 01:26:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GsjR9uvmZdDp44eAkEiAeSGJp0W/5WUvj0g0dhVHo7THPBUYbGq630UHe45vo4HNaFXsSs97eA/NSpHwoZSNyFJzQsX+2oZLzJuFlWLq1+++u50GbEGGsV6q6lFdjG8NHGfs4g04UUvSqjo1Rf5E5zTvnBiK7mk4j3U677a+6ocLlv9E4iuW2qyd+v8qHOhQ+Ec3cj/4QzOABTPT0udvsn+2a0gT2RXr/MQZyTohVX3C1z0A6pk43F6hEDkv4oLUNFVRjgTNr7VnhzXsbcuRygh6FE3QqFaTg3V/FkrfC3RRd8qaDDISHJY/SvtIhv63+pV8OR/MRxy13zX5fClKnw== 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=qRko7wfQGB5RWunTZwqGI+4EMiQ7gDLAcGti4eZSucI=; b=ZUe1s1jjvyB0Cyn+2JRB0O5z9XyklcZuQKs/C8FkeF1OBG9a7eEXo/1TwC3/sm8tdMX/oycWbrC9GjCJmbyy0QFTrO/QFkWQW3nM8j04/XUYdNDW0jLvvuWMa1AYaAsiFPmi35DQGrfeTEQb6kh37YT2NJ/sl6CuhzbzMh5bcF9Tbvaqe/RVL84QqedJ6JApjW6ebHFhYXVHdptHGrZuRKDTaWa+/A0FfUTu9TCEm/pzraU9uvuOd8E1zu0X4890YUrpgnA+u/lzB8/eteLXUMFEw1sXKrwoJHsO7v9V0jxyu5DL7Mh4lRjsKHXMiQXeGmzX7qBDpkoQ3EnbSgTHRQ== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by MN0PR11MB6087.namprd11.prod.outlook.com (2603:10b6:208:3cd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Wed, 6 Dec 2023 09:26:01 +0000 X-Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::6da1:a4b7:4771:14e1]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::6da1:a4b7:4771:14e1%5]) with mapi id 15.20.7068.025; Wed, 6 Dec 2023 09:26:01 +0000 From: "duntan" 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 Thread-Topic: [edk2-devel] [PATCH 2/2] MdePkg:simplify Fifo API in BaseIoLibIntrinsic Thread-Index: AQHaErgErbjjjeFHYkq1uw7Q0z1sPbCcJtrA Date: Wed, 6 Dec 2023 09:26:01 +0000 Message-ID: References: <20231109024958.1732-1-dun.tan@intel.com> <1795D4A7D7819C64.15940@groups.io> In-Reply-To: <1795D4A7D7819C64.15940@groups.io> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5483:EE_|MN0PR11MB6087:EE_ x-ms-office365-filtering-correlation-id: 4b544eae-088f-404d-a4cc-08dbf63d5cdd 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: vBXOBEdSBxuksPLS/mQ//Ieb5b9ui3c52qdSX07T23tp5kfseXMwiAzh1dwEtPhTFmahgIUkFxz9Ekn2PQvJ2JhoIsuI07fqtTmOKOAMgwZtJE5B1rCUJzhPB9SpG69nqmpKKvcj0ciuaPH67ywpgQj+SG3OxY/tGWwMbbQEDqbmOxz4YV6BXbZ3oNQP8sVVKQHPvIPl2iMLBt7mQB7d150MV/V0Q8sgfvOh/DW2XOWh5Msi03A3O0YPRetHrUE4npC7GWDtD9jOP17RgZD3gxOAaBTKAAoSbzAi2rkj8Ki4CJfNeM2LTtfsQBiNAgNSPcNiMQcE+mdJI+igQPc90nDJjodaxKWJdjVCB1UsS/kZXxAx/3s27zqO5ar7D1gN+t/0L3spo6MEr0fr3ANiEEGj30Nufb9meHITfHtOp1YNm/Vwpsacg+XGDN+TG089e+SIvcd9XVDXG/J6TPISlXJQ7urjjC2kcK0yJ9mO2XbDvTBzPESFa4DjnsuRYKLHum9E48PY/19yJ9gI10UV9ygLyGiaX91g8uyPJyCDD6ayv4ZvMQCmVIE+KrAIzjPFuTue/IJGov9cpEsdOGOmOYVt6T14vnRWQdDc9rc0HwTHUbtQPD+lqmLoW3k0O+xyKZ2LOdvKY8yjYtFWmZ+p0A== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TxVjDcQ1bMDiSm333a057fie+l9R3hBYS/wjSkmq1wpIi+fsB3mxFXqXIGTW?= =?us-ascii?Q?PDEyCtvhVIt6zGnybNdqoQZyGGB22WeuhXl45WYnwm+6AeafiJf4xl6zq7Xr?= =?us-ascii?Q?kGJyPp3ToXDU5P5qD8J4hxHYp/xMOfhPJImaEpfqB+HR6Q6tdIdnzW1AoRD2?= =?us-ascii?Q?eYuEeg/d57+G+snwQfyErewiMK4UXzMhTLDmRNcTnMcCd1Fdokh0komL18pR?= =?us-ascii?Q?b4T7FP9JzX/RXERHI/+UThZiaPmuMsBCmIwlu7l/m2hPHKiP7B4um8Nm34Sk?= =?us-ascii?Q?fxM9eJCUeITmDA9/QXPLmpalELd8Iz1sUMxze3wChB5SLDoN2XSHd+5QVCgH?= =?us-ascii?Q?U4fCZh8ccAgiVfeGIDwlvi9qMCXf7kJisG2lb3jXac49SuVU7GTsOXumUuzW?= =?us-ascii?Q?6QxCnmwWiS+Qamlydt0jY1yo/7aA5PxKFIo8CihXzAbn+pmktCOH3wseLx02?= =?us-ascii?Q?mu/SCtXMqqmYUsH4swO+vzQazRvq1QB0PvIQJxbaqFvib0m1lpoOBTnZ+kCM?= =?us-ascii?Q?B9Pc/GkwL7fXLJGUFnXnaCUOWBIedO+wUSzqRKoXAvczrSKVjPDQ++xGLcCZ?= =?us-ascii?Q?DWvkHgCwgB9bwA/uVhj08rHw+aiS87FkOKaH9OqCTT5pqKddTl/lHMVyo4A3?= =?us-ascii?Q?aqgS2S3/daKuoNGe5dkhp6ibIhpEYczivvZ5R4a5BW2Z1ot2jcgJAXr5yOJS?= =?us-ascii?Q?jzp7qD3hc6r/7fZHC1B9nW4g45HFPWYZvP+B4I7w8sWsPkwVSRDLdSQY9m4+?= =?us-ascii?Q?TGlB5wd1WGALQMBYo66pLjZha81C4zCPh6EJgCr6mq75PEmv3r1oT7YYcJGI?= =?us-ascii?Q?rzIE9UHOGMzkkyu77etb3dQbjmLO3P5sF/wFkoxkrNUXiRtAMjprG61+z2rP?= =?us-ascii?Q?/Lvr3J0QCt59KmF1djXo8ny6LUr9XzJCtKKoLU8eIg3d5t2mYSB9mylntEUz?= =?us-ascii?Q?q6y6sQrS55U8EnOTb3FVfwdduRbFtJWpfBh1ruxPjV+9NfuJ9TytzDPwWlU8?= =?us-ascii?Q?PeCaRg1AxL7iT32krYXbxOyizJ2h6pddBlhDSuRt6UrP4Pu0UALUAD959l9D?= =?us-ascii?Q?v3RHsJyugboFfZBfqdsmrcTd73UgZ9tAqf6vBBHtMfKGB1KO6ki5SkC4EEoy?= =?us-ascii?Q?iUz5H4/QUlIt4cVNAe/6XevY4L2ZCZLk7bazQqy2sH76c1cWDixWYpOiCVym?= =?us-ascii?Q?jgM/2DBugDwwKDM46wCLx7gblPBasR2Wpusw2JbfoklAP0odSbyIwd0eCid6?= =?us-ascii?Q?7K52vNYbUP3DoQDq5TwEpIrgZKvzRpDeDp7iVpyqpJFB1jZVCPld9SaGoXY+?= =?us-ascii?Q?rc8LqboJrjCE04qkVVbaLbWGuznwi7euMhsIq1YFJC/EHPeolAttC/XH0gnk?= =?us-ascii?Q?TboGb9p6lx0JK4h592itFboRUv+Jt0/w2zUbl4Mc47bmH270A2dEdmN2Xcm6?= =?us-ascii?Q?qbqSFUl3Xl9RIYvsL+IpxY1or7THOQ+3y/EerFAEao4hRs2u6SGtsKCYFTV6?= =?us-ascii?Q?0t/I/rCzoiNkHiIxyFF5Z+tD43n9sZnxiaGKz8VVXhrdaWea9U9FqRGAuhq7?= =?us-ascii?Q?Hg4/W73r7QPVARmEkr8=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b544eae-088f-404d-a4cc-08dbf63d5cdd X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2023 09:26:01.4487 (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: 1zRzc/YiXGr0HzYwGnR+qUs3Pd0oIpoo3Grtm01TDi7aMrca9/uEpmgOlBqPpz+Q5W3GuEBSTggTBz8gPdPFjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR11MB6087 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,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: BuRHDSvvCrqdM3wY5edsh0Y9x7686176AA= 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="WWuAZV/5"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi Mike and Liming,=20 Could you please help to review this patch? Thanks, Dun -----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 BaseIoLibIntr= insic Simplify IoRead/WriteFifo implement by repeatedly calling IoRead/Write in t= he C code. This can avoid calling assembly code to use string I/O instructions. With t= his change Ia32/IoFifo.nasm and X64/IoFifo.nasm can be removed. Then the so= urce files for IA32 and X64 are the same. 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(-) diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf b/Mde= Pkg/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/Li= brary/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=20 + 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=20 + provided Buffer. + + This function must guarantee that all I/O read and write operations=20 + 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=20 + from the provided Buffer. + + This function must guarantee that all I/O write and write operations=20 + 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=20 + provided Buffer. + + This function must guarantee that all I/O read and write operations=20 + 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=20 + from the provided Buffer. + + This function must guarantee that all I/O write and write operations=20 + 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=20 + provided Buffer. + + This function must guarantee that all I/O read and write operations=20 + 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=20 + from the provided Buffer. + + This function must guarantee that all I/O write and write operations=20 + 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/Lib= rary/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 -=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 (#112104): https://edk2.groups.io/g/devel/message/112104 Mute This Topic: https://groups.io/mt/103009916/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-