From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0605.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::605]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7F08381BFF for ; Wed, 11 Jan 2017 17:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BdWBWlnz5iLDE7t38s7hMJN92FhEmVzfaAjcibwEIYU=; b=qJvYbyD1T7YtU9V3MgPJtsACiuC52ehQCZQzcqp6gDUKLf1GWHBPRzZJ+aSNGt4OZJ5BMbGt0wD6JveqwdRDK1ISqqLb4nKxxlNh8hoqorkXAV+bqTUJdtq4k2Du7bY1nhV/Pt/omD4wYpnOBHpqiF4OTE7NsqpbvAXGQrRnBOo= Received: from DM5PR12MB1243.namprd12.prod.outlook.com (10.168.237.22) by BLUPR12MB0660.namprd12.prod.outlook.com (10.163.217.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Thu, 12 Jan 2017 01:36:05 +0000 Received: from DM5PR12MB1243.namprd12.prod.outlook.com ([10.168.237.22]) by DM5PR12MB1243.namprd12.prod.outlook.com ([10.168.237.22]) with mapi id 15.01.0829.017; Thu, 12 Jan 2017 01:36:04 +0000 From: "Duran, Leo" To: "Fan, Jeff" , "edk2-devel@lists.01.org" CC: "Singh, Brijesh" , "Justen, Jordan L" , "Gao, Liming" , "Kinney, Michael D" , "lersek@redhat.com" Thread-Topic: [edk2] [PATCH 1/8] MdePkg: Expand BaseIoLibIntrinsic (IoLib class) library Thread-Index: AQHSa50f4VwUxvn0H0KI5fsl+pxcxaE0EHcAgAAAfwA= Date: Thu, 12 Jan 2017 01:36:04 +0000 Message-ID: References: <1484092554-26224-1-git-send-email-leo.duran@amd.com> <1484092554-26224-2-git-send-email-leo.duran@amd.com> <542CF652F8836A4AB8DBFAAD40ED192A4C51324D@shsmsx102.ccr.corp.intel.com> In-Reply-To: <542CF652F8836A4AB8DBFAAD40ED192A4C51324D@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leo.duran@amd.com; x-originating-ip: [2605:6000:e7c4:2000:104a:99c0:3acf:2f2a] x-microsoft-exchange-diagnostics: 1; BLUPR12MB0660; 7:F0Yf4X9FwP35HR3MEhyDF5NBiFgFFpv4aF/exhkUPD/aZw+P49bwGAZ1vI/wlHDCiigc0Cb3C2Ut8w5rvRpj23ni5pAhUCXoHBA661/mugkjyeVM4mYPut44ilchCy6WtaZ4TqgyPLU2E0etHCNH6Dp8RBGdvTpEkTpfFFrkyXiT09AKBTx5Y3ENR5imhA3HZKFzyZFuUVXOQgXOYo46lTKzBQ2Ph8RF2PIF1tgMSfT7OKB7V1MyNC3PByVdmFXxi4Jz2C8Wa8DJM8yCJB3T0J3D7neBS8svE0n/6kFo4T7h2RZT+hsi6nm0o+R8aTckKO4kLJMN71xC0mrSARzgANUFq7QKrL3CwLO2MaQVNtzh1yH7Vq0RSQ1IETtAFCU6JBtoGWiHwpPAp3iz4x0Wrv3ELVvtfAAz/7XFVvyXOmLoVb/biOoTQa/RIYrv5JiRBGFxMdPAkPoTaw9Vo1aDYg==; 20:dFoh6Vrb6iJUtmMlwJ7odMJiuqaAIMwLy3EwCoymfyhlwVzfBtAxI8+htuYVPig8UrWSB4N51Ufpafk3m/nvgVB+hEfIXd8vMCtXQOVPnp2qPUz4frWtXEVV4v91gVV/re9ENj/0wIDhgYL/n1rIwTvCg/BElhwgroA+0H8sluD0aWFduJgvfv15F4t6AgYne0LcLXwDLnrz6th3scOPZKCf/MXc209coDTPV8W4YMNh+mvyzyD4hc4aGl3pUv1C x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10009020)(6029001)(6009001)(7916002)(39450400003)(39840400002)(39850400002)(39410400002)(39860400002)(189002)(43544003)(199003)(377454003)(13464003)(101416001)(15395725005)(6306002)(54906002)(33656002)(74316002)(92566002)(305945005)(9686003)(102836003)(97736004)(6116002)(5660300001)(68736007)(5001770100001)(7736002)(2501003)(55016002)(86362001)(99286003)(575784001)(25786008)(3660700001)(6436002)(6506006)(2950100002)(38730400001)(2900100001)(189998001)(81156014)(81166006)(3280700002)(8676002)(2906002)(77096006)(4326007)(105586002)(76176999)(8936002)(106116001)(229853002)(106356001)(50986999)(7696004)(122556002)(54356999)(569005); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0660; H:DM5PR12MB1243.namprd12.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: c4867229-f06c-40ec-1179-08d43a8b5fac x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BLUPR12MB0660; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(767451399110)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123558021)(20161123555025)(20161123564025)(20161123562025)(6072148); SRVR:BLUPR12MB0660; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0660; x-forefront-prvs: 018577E36E received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2017 01:36:04.4948 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0660 Subject: Re: [PATCH 1/8] MdePkg: Expand BaseIoLibIntrinsic (IoLib class) library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2017 01:36:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jeff, Please see inline below. Leo > -----Original Message----- > From: Fan, Jeff [mailto:jeff.fan@intel.com] > Sent: Wednesday, January 11, 2017 7:33 PM > To: Duran, Leo ; edk2-devel@lists.01.org > Cc: Singh, Brijesh ; Justen, Jordan L > ; Gao, Liming ; Kinney, > Michael D ; lersek@redhat.com > Subject: RE: [edk2] [PATCH 1/8] MdePkg: Expand BaseIoLibIntrinsic (IoLib > class) library >=20 > Leo, >=20 > +VOID > +EFIAPI > +IoWriteFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ); >=20 > Buffer should be "IN" instead of "OUT". I understand you just copied orig= inal > code from UefiCpuPkg. >=20 > It's better you could update it in your v2 patch serial. [Duran, Leo] You bet, I'll take care of that. Thanks. >=20 > Thanks! > Jeff >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Leo Duran > Sent: Wednesday, January 11, 2017 7:56 AM > To: edk2-devel@lists.01.org > Cc: brijesh.singh@amd.com; Justen, Jordan L; Gao, Liming; Leo Duran; > Kinney, Michael D; lersek@redhat.com; Fan, Jeff > Subject: [edk2] [PATCH 1/8] MdePkg: Expand BaseIoLibIntrinsic (IoLib clas= s) > library >=20 > The UefiCpuPkg/CpuIo2Dxe driver and the QemuCfgLib library have > duplicate implementations of I/O Fifo routines. This patch ports the I/O = Fifo > routines into the BaseIoLibIntrinsic library and expand the IoLib class t= o > include the ported I/O Fifo routines. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Brijesh Singh > Signed-off-by: Leo Duran > --- > MdePkg/Include/Library/IoLib.h | 158 +++++++++++++++= + > .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 6 +- > MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm | 141 > +++++++++++++++ MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm | > 137 ++++++++++++++ > MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c | 182 > +++++++++++++++++++ > MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c | 179 > ++++++++++++++++++ > MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c | 201 > +++++++++++++++++++++ > MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm | 127 +++++++++++++ > MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm | 126 +++++++++++++ > 9 files changed, 1256 insertions(+), 1 deletion(-) create mode 100644 > MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm > create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm > create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm >=20 > diff --git a/MdePkg/Include/Library/IoLib.h > b/MdePkg/Include/Library/IoLib.h index a0dd16b..708612e 100644 > --- a/MdePkg/Include/Library/IoLib.h > +++ b/MdePkg/Include/Library/IoLib.h > @@ -2,6 +2,8 @@ > Provide services to access I/O Ports and MMIO registers. >=20 > Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
> +Copyright (c) 2017, AMD Incorporated. All rights reserved.
> + > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be found= at > @@ -324,6 +326,58 @@ IoBitFieldAndThenOr8 ( > ); >=20 > /** > + 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(). > + > + @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 > + ); > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ); > + > +/** > Reads a 16-bit I/O port. >=20 > Reads the 16-bit I/O port specified by Port. The 16-bit read value is > returned. > @@ -625,6 +679,58 @@ IoBitFieldAndThenOr16 ( > ); >=20 > /** > + 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(). > + > + @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 > + ); > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo16 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ); > + > +/** > Reads a 32-bit I/O port. >=20 > Reads the 32-bit I/O port specified by Port. The 32-bit read value is > returned. > @@ -926,6 +1032,58 @@ IoBitFieldAndThenOr32 ( > ); >=20 > /** > + 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(). > + > + @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 > + ); > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo32 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ); > + > +/** > Reads a 64-bit I/O port. >=20 > Reads the 64-bit I/O port specified by Port. The 64-bit read value is > returned. > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > index 29b9e8b..8844b1c 100644 > --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > +++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf > @@ -8,6 +8,7 @@ > # > # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved. # > Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> +# Copyright (c) 2017, AMD Incorporated. All rights reserved.
> # > # This program and the accompanying materials # are licensed and made > available under the terms and conditions of the BSD License @@ -16,7 +17,= 6 > @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS > IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER EXPRESS OR IMPLIED. > # > -# > ## >=20 > [Defines] > @@ -43,12 +43,16 @@ [Sources.IA32] > IoLibMsc.c | MSFT > IoLibIcc.c | INTEL > IoLib.c > + Ia32/IoFifo.nasm > + Ia32/IoFifo.asm >=20 > [Sources.X64] > IoLibGcc.c | GCC > IoLibMsc.c | MSFT > IoLibIcc.c | INTEL > IoLib.c > + X64/IoFifo.nasm > + X64/IoFifo.asm >=20 > [Sources.EBC] > IoLibEbc.c > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm > b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm > new file mode 100644 > index 0000000..d490308 > --- /dev/null > +++ b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.asm > @@ -0,0 +1,141 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2006 - 2012, Intel Corporation. All rights > +reserved.
; Copyright (c) 2017, AMD Incorporated. All rights > +reserved.
; ; This program and the accompanying materials are > +licensed and made available ; under the terms and conditions of the BSD > +License which accompanies this ; distribution. The full text of the > +license may be found at ; > +http://opensource.org/licenses/bsd-license.php. > +; > +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +; > +;---------------------------------------------------------------------- > +-------- > + > + .586P > + .model flat,C > + .code > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo8 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN VOID *Buffer > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoReadFifo8 PROC > + push edi > + cld > + mov dx, [esp + 8] > + mov ecx, [esp + 12] > + mov edi, [esp + 16] > +rep insb > + pop edi > + ret > +IoReadFifo8 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo16 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN VOID *Buffer > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoReadFifo16 PROC > + push edi > + cld > + mov dx, [esp + 8] > + mov ecx, [esp + 12] > + mov edi, [esp + 16] > +rep insw > + pop edi > + ret > +IoReadFifo16 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo32 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN VOID *Buffer > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoReadFifo32 PROC > + push edi > + cld > + mov dx, [esp + 8] > + mov ecx, [esp + 12] > + mov edi, [esp + 16] > +rep insd > + pop edi > + ret > +IoReadFifo32 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoWriteFifo8 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN VOID *Buffer > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoWriteFifo8 PROC > + push esi > + cld > + mov dx, [esp + 8] > + mov ecx, [esp + 12] > + mov esi, [esp + 16] > +rep outsb > + pop esi > + ret > +IoWriteFifo8 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoWriteFifo16 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN VOID *Buffer > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoWriteFifo16 PROC > + push esi > + cld > + mov dx, [esp + 8] > + mov ecx, [esp + 12] > + mov esi, [esp + 16] > +rep outsw > + pop esi > + ret > +IoWriteFifo16 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoWriteFifo32 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN VOID *Buffer > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoWriteFifo32 PROC > + push esi > + cld > + mov dx, [esp + 8] > + mov ecx, [esp + 12] > + mov esi, [esp + 16] > +rep outsd > + pop esi > + ret > +IoWriteFifo32 ENDP > + > + END > + > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > new file mode 100644 > index 0000000..a09e75b > --- /dev/null > +++ b/MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm > @@ -0,0 +1,137 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2006 - 2012, Intel Corporation. All rights > +reserved.
; Copyright (c) 2017, AMD Incorporated. All rights > +reserved.
; ; This program and the accompanying materials are > +licensed and made available ; under the terms and conditions of the BSD > +License which accompanies this ; distribution. The full text of the > +license may be found at ; > +http://opensource.org/licenses/bsd-license.php. > +; > +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +; > +;---------------------------------------------------------------------- > +-------- > + > + SECTION .text > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo8 ( > +; IN UINTN Port, > +; IN UINTN Size, > +; IN 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, > +; IN 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, > +; IN 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/IoLibArm.c > b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c > index b9f4c5e..301b215 100644 > --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c > +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c > @@ -3,6 +3,8 @@ >=20 > Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved. > + Copyright (c) 2017, AMD Incorporated. All rights reserved.
> + > This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at @@ -221,6 +223,186 @@ IoWrite64 ( > return 0; > } >=20 > +/** > + 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(). > + > + @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 > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @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 > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo16 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @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 > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo32 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + ASSERT (FALSE); > +} >=20 > /** > Reads an 8-bit MMIO register. > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c > b/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c > index e12a5ae..5bc539b 100644 > --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c > +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibEbc.c > @@ -4,6 +4,8 @@ > EBC does not support port I/O. All APIs in this file ASSERT(). >=20 > Copyright (c) 2015, Intel Corporation. All rights reserved.
> + Copyright (c) 2017, AMD Incorporated. All rights reserved.
> + > This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at @@ -169,3 +171,180 @@ IoWrite32 ( > ASSERT (FALSE); > return 0; > } > + > +/** > + 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(). > + > + @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 > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @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 > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo16 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + ASSERT (FALSE); > +} > +/** > + 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(). > + > + @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 > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo32 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + ASSERT (FALSE); > +} > + > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c > b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c > index 6b0bf6a..a2e183c 100644 > --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c > +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibIpf.c > @@ -2,6 +2,8 @@ > Common I/O Library routines. >=20 > Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
> + Copyright (c) 2017, AMD Incorporated. All rights reserved.
> + > This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at @@ -147,6 +149,7 @@ IoRead64 ( > return 0; > } >=20 > + > /** > Writes an 8-bit I/O port. >=20 > @@ -252,6 +255,204 @@ IoWrite64 ( > } >=20 > /** > + 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(). > + > + @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 =3D (UINT8 *)Buffer; > + > + while (Count--) { > + *Buffer8++ =3D IoRead8 (Port); > + } > +} > + > +/** > + 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(). > + > + @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 =3D (UINT16 *)Buffer; > + > + while (Count--) { > + *Buffer16++ =3D IoRead16 (Port); > + } > +} > + > +/** > + 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(). > + > + @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 =3D (UINT32 *)Buffer; > + > + while (Count--) { > + *Buffer32++ =3D IoRead32 (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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo8 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + UINT8 *Buffer8 =3D (UINT8 *)Buffer; > + > + while (Count--) { > + IoWrite8 (Port, *Buffer8++); > + } > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo16 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + UINT16 *Buffer16 =3D (UINT16 *)Buffer; > + > + while (Count--) { > + IoWrite16 (Port, *Buffer16++); > + } > +} > + > +/** > + 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(). > + > + @param Port The I/O port to write. > + @param Count The number of times to write I/O port. > + @param Buffer The buffer to store the write data into. > + > +**/ > +VOID > +EFIAPI > +IoWriteFifo32 ( > + IN UINTN Port, > + IN UINTN Count, > + OUT VOID *Buffer > + ) > +{ > + UINT32 *Buffer32 =3D (UINT32 *)Buffer; > + > + while (Count--) { > + IoWrite32 (Port, *Buffer32++); > + } > +} > + > +/** > Reads an 8-bit MMIO register. >=20 > Reads the 8-bit MMIO register specified by Address. The 8-bit read val= ue is > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm > b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm > new file mode 100644 > index 0000000..71ce6e8 > --- /dev/null > +++ b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.asm > @@ -0,0 +1,127 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2006 - 2012, Intel Corporation. All rights > +reserved.
; Copyright (c) 2017, AMD Incorporated. All rights > +reserved.
; ; This program and the accompanying materials are > +licensed and made available ; under the terms and conditions of the BSD > +License which accompanies this ; distribution. The full text of the > +license may be found at ; > +http://opensource.org/licenses/bsd-license.php. > +; > +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +; > +;---------------------------------------------------------------------- > +-------- > + > + .code > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo8 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN VOID *Buffer // r8 > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoReadFifo8 PROC > + cld > + xchg rcx, rdx > + xchg rdi, r8 ; rdi: buffer address; r8: save rdi > +rep insb > + mov rdi, r8 ; restore rdi > + ret > +IoReadFifo8 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo16 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN VOID *Buffer // r8 > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoReadFifo16 PROC > + cld > + xchg rcx, rdx > + xchg rdi, r8 ; rdi: buffer address; r8: save rdi > +rep insw > + mov rdi, r8 ; restore rdi > + ret > +IoReadFifo16 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo32 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN VOID *Buffer // r8 > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoReadFifo32 PROC > + cld > + xchg rcx, rdx > + xchg rdi, r8 ; rdi: buffer address; r8: save rdi > +rep insd > + mov rdi, r8 ; restore rdi > + ret > +IoReadFifo32 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoWriteFifo8 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN VOID *Buffer // r8 > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoWriteFifo8 PROC > + cld > + xchg rcx, rdx > + xchg rsi, r8 ; rsi: buffer address; r8: save rsi > +rep outsb > + mov rsi, r8 ; restore rsi > + ret > +IoWriteFifo8 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoWriteFifo16 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN VOID *Buffer // r8 > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoWriteFifo16 PROC > + cld > + xchg rcx, rdx > + xchg rsi, r8 ; rsi: buffer address; r8: save rsi > +rep outsw > + mov rsi, r8 ; restore rsi > + ret > +IoWriteFifo16 ENDP > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoWriteFifo32 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN VOID *Buffer // r8 > +; ); > +;---------------------------------------------------------------------- > +-------- > +IoWriteFifo32 PROC > + cld > + xchg rcx, rdx > + xchg rsi, r8 ; rsi: buffer address; r8: save rsi > +rep outsd > + mov rsi, r8 ; restore rsi > + ret > +IoWriteFifo32 ENDP > + > + END > + > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm > b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm > new file mode 100644 > index 0000000..7ca2ba3 > --- /dev/null > +++ b/MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm > @@ -0,0 +1,126 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2006 - 2012, Intel Corporation. All rights > +reserved.
; Copyright (c) 2017, AMD Incorporated. All rights > +reserved.
; ; This program and the accompanying materials are > +licensed and made available ; under the terms and conditions of the BSD > +License which accompanies this ; distribution. The full text of the > +license may be found at ; > +http://opensource.org/licenses/bsd-license.php. > +; > +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +; > +;---------------------------------------------------------------------- > +-------- > + > + DEFAULT REL > + SECTION .text > + > +;---------------------------------------------------------------------- > +-------- > +; VOID > +; EFIAPI > +; IoReadFifo8 ( > +; IN UINTN Port, // rcx > +; IN UINTN Size, // rdx > +; IN 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 > +; IN 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 > +; IN 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 > + > -- > 1.9.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel