From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 80C3A81D7C for ; Sun, 15 Jan 2017 16:50:07 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 15 Jan 2017 16:50:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,236,1477983600"; d="scan'208";a="213715103" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 15 Jan 2017 16:50:07 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 15 Jan 2017 16:50:06 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 15 Jan 2017 16:50:06 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Mon, 16 Jan 2017 08:50:04 +0800 From: "Fan, Jeff" To: Leo Duran , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Kinney, Michael D" , "Justen, Jordan L" , "lersek@redhat.com" , "brijesh.singh@amd.com" Thread-Topic: [PATCH v3 04/10] IntelFrameworkModulePkg: Modify CpuIoDxe to support new IoLib library Thread-Index: AQHSbdkitfgj2pmoFEictknqN4m9OKE6STiQ Date: Mon, 16 Jan 2017 00:50:04 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4C517029@shsmsx102.ccr.corp.intel.com> References: <1484338200-31337-1-git-send-email-leo.duran@amd.com> <1484338200-31337-5-git-send-email-leo.duran@amd.com> In-Reply-To: <1484338200-31337-5-git-send-email-leo.duran@amd.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODg0NjRjNWQtNTlmMy00ZDU0LWE3ODItMWMyNzA3NmI1ZGIzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Ikh4aEhmTGNpaEwydXpwUzBVVXYxTzVuNlRHZUtibjRUQUp0XC91bjZsTWdjPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 04/10] IntelFrameworkModulePkg: Modify CpuIoDxe to support new IoLib 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: Mon, 16 Jan 2017 00:50:07 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jeff Fan -----Original Message----- From: Leo Duran [mailto:leo.duran@amd.com]=20 Sent: Saturday, January 14, 2017 4:10 AM To: edk2-devel@lists.01.org Cc: Gao, Liming; Kinney, Michael D; Fan, Jeff; Justen, Jordan L; lersek@red= hat.com; brijesh.singh@amd.com; Leo Duran Subject: [PATCH v3 04/10] IntelFrameworkModulePkg: Modify CpuIoDxe to suppo= rt new IoLib library The IO_PROTOCOL supports Fifo types by invoking the Fifo routines in the ne= w BaseIoLibIntrinsic (IoLib class) library. Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh Signed-off-by: Leo Duran --- IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c | 52 ++++++++++++++++++= ++++ 1 file changed, 52 insertions(+) diff --git a/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c b/IntelFram= eworkModulePkg/Universal/CpuIoDxe/CpuIo.c index e48b638..9db9dbe 100644 --- a/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c +++ b/IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c @@ -2,6 +2,8 @@ Uses the services of the I/O Library to produce the CPU I/O Protocol =20 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2017, AMD Incorporated. All rights reserved.
+ This program and the accompanying materials =20 are licensed and made available under the terms and conditions of the BSD = License =20 which accompanies this distribution. The full text of the license may be = found at =20 @@ -410,6 +412,31 @@ CpuIoServiceRead ( InStride =3D mInStride[Width]; OutStride =3D mOutStride[Width]; OperationWidth =3D (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03); + + // + // Fifo operations supported for (mInStride[Width] =3D=3D 0) // if=20 + (InStride =3D=3D 0) { + switch (OperationWidth) { + case EfiCpuIoWidthUint8: + IoReadFifo8 ((UINTN)Address, Count, Buffer); + return EFI_SUCCESS; + case EfiCpuIoWidthUint16: + IoReadFifo16 ((UINTN)Address, Count, Buffer); + return EFI_SUCCESS; + case EfiCpuIoWidthUint32: + IoReadFifo32 ((UINTN)Address, Count, Buffer); + return EFI_SUCCESS; + default: + // + // The CpuIoCheckParameter call above will ensure that this + // path is not taken. + // + ASSERT (FALSE); + break; + } + } + for (Uint8Buffer =3D Buffer; Count > 0; Address +=3D InStride, Uint8Buff= er +=3D OutStride, Count--) { if (OperationWidth =3D=3D EfiCpuIoWidthUint8) { *Uint8Buffer =3D IoRead8 ((UINTN)Address); @@ -492,6 +519,31 @@ CpuI= oServiceWrite ( InStride =3D mInStride[Width]; OutStride =3D mOutStride[Width]; OperationWidth =3D (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03); + + // + // Fifo operations supported for (mInStride[Width] =3D=3D 0) // if=20 + (InStride =3D=3D 0) { + switch (OperationWidth) { + case EfiCpuIoWidthUint8: + IoWriteFifo8 ((UINTN)Address, Count, Buffer); + return EFI_SUCCESS; + case EfiCpuIoWidthUint16: + IoWriteFifo16 ((UINTN)Address, Count, Buffer); + return EFI_SUCCESS; + case EfiCpuIoWidthUint32: + IoWriteFifo32 ((UINTN)Address, Count, Buffer); + return EFI_SUCCESS; + default: + // + // The CpuIoCheckParameter call above will ensure that this + // path is not taken. + // + ASSERT (FALSE); + break; + } + } + for (Uint8Buffer =3D (UINT8 *)Buffer; Count > 0; Address +=3D InStride, = Uint8Buffer +=3D OutStride, Count--) { if (OperationWidth =3D=3D EfiCpuIoWidthUint8) { IoWrite8 ((UINTN)Address, *Uint8Buffer); -- 1.9.1