From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 EB2701A1E24 for ; Wed, 28 Sep 2016 05:52:15 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 28 Sep 2016 05:52:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,410,1470726000"; d="scan'208";a="1037612078" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 28 Sep 2016 05:52:15 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 28 Sep 2016 05:52:14 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 28 Sep 2016 05:52:14 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.15]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.234]) with mapi id 14.03.0248.002; Wed, 28 Sep 2016 20:52:12 +0800 From: "Zeng, Star" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Laszlo Ersek (lersek@redhat.com)" Thread-Topic: [PATCH] PcAtChipsetPkg AcpiTimerLib: Clear bits [31:24] after reading by IoRead32() Thread-Index: AQHSGXGaJlip3RarRUyxYJUa2elUF6CORlSAgACUeHA= Date: Wed, 28 Sep 2016 12:52:11 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB04831039568525@shsmsx102.ccr.corp.intel.com> References: <1475057875-338864-1-git-send-email-star.zeng@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503869A6FB@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503869A6FB@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODRmODY0YjktYTBiMi00ZGZkLWI1M2EtMDRlMDhlY2FiMmIzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjBqZlQrM2xlUWFvSVJoXC9mK0RSdWlPQWczR3oxN2UwQmhodkRuSU9ZMzhZPSJ9 x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] PcAtChipsetPkg AcpiTimerLib: Clear bits [31:24] after reading by IoRead32() 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: Wed, 28 Sep 2016 12:52:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jiewen, Thanks for the Rb, I just send the V2 patch that follows Laszlo's suggestio= n to use IoBitFieldRead32 (Port, 0, 23), could you help review the patch ag= ain? Star -----Original Message----- From: Yao, Jiewen=20 Sent: Wednesday, September 28, 2016 7:59 PM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Gao, Liming Subject: RE: [PATCH] PcAtChipsetPkg AcpiTimerLib: Clear bits [31:24] after = reading by IoRead32() Reviewed-by: jiewen.yao@intel.com > -----Original Message----- > From: Zeng, Star > Sent: Wednesday, September 28, 2016 6:18 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Yao, Jiewen=20 > ; Gao, Liming > Subject: [PATCH] PcAtChipsetPkg AcpiTimerLib: Clear bits [31:24] after=20 > reading by IoRead32() >=20 > Clear bits [31:24] when reading ACPI timer count by IoRead32(), also=20 > add comments "Note: The library only supports 24Bits ACPI timer" in=20 > INF. >=20 > Cc: Jiewen Yao > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng > --- > PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c | 8 ++++---- > PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf | 6 ++++-- =20 > PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf | 8 +++++--- > 3 files changed, 13 insertions(+), 9 deletions(-) >=20 > diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c > b/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c > index 020031e3f4a5..67f165ed20ac 100644 > --- a/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c > +++ b/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c > @@ -162,14 +162,14 @@ InternalAcpiDelay ( > // > // The target timer count is calculated here > // > - Ticks =3D IoRead32 (Port) + Delay; > + Ticks =3D (IoRead32 (Port) & (BIT24 - 1)) + Delay; > Delay =3D BIT22; > // > // Wait until time out > // Delay >=3D 2^23 could not be handled by this function > // Timer wrap-arounds are handled correctly by this function > // > - while (((Ticks - IoRead32 (Port)) & BIT23) =3D=3D 0) { > + while (((Ticks - (IoRead32 (Port) & (BIT24 - 1))) & BIT23) =3D=3D 0)= =20 > + { > CpuPause (); > } > } while (Times-- > 0); > @@ -371,7 +371,7 @@ InternalCalculateTscFrequency ( > // Use 363 * 9861 =3D 3579543 Hz which is within 2 Hz of=20 > ACPI_TIMER_FREQUENCY. > // 363 counts is a calibration time of 101.4 uS. > // > - Ticks =3D IoRead32 (TimerAddr) + 363; > + Ticks =3D (IoRead32 (TimerAddr) & (BIT24 - 1)) + 363; >=20 > StartTSC =3D AsmReadTsc (); > // Get base value for the TSC > // > @@ -380,7 +380,7 @@ InternalCalculateTscFrequency ( > // When the current ACPI timer value is greater than 'Ticks', > // the while loop will exit. > // > - while (((Ticks - IoRead32 (TimerAddr)) & BIT23) =3D=3D 0) { > + while (((Ticks - (IoRead32 (TimerAddr) & (BIT24 - 1))) & BIT23) =3D=3D= =20 > + 0) { > CpuPause(); > } > EndTSC =3D AsmReadTsc (); > // TSC value 101.4 us later > diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf > b/PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf > index 48caebff1354..913fbfe7d30e 100644 > --- a/PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf > +++ b/PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf > @@ -2,9 +2,11 @@ > # Base ACPI Timer Library > # > # Provides basic timer support using the ACPI timer hardware. The=20 > performance -# counter features are provided by the processors time=20 > stamp counter. > +# counter features are provided by the processors time stamp counter. > # > -# Copyright (c) 2013 - 2015, Intel Corporation. All rights=20 > reserved.
> +# Note: The library only supports 24Bits ACPI timer. > +# > +# Copyright (c) 2013 - 2016, Intel Corporation. All rights=20 > +reserved.
> # This program and the accompanying materials # are licensed and=20 > made available under the terms and conditions of the BSD License # =20 > which accompanies this distribution. The full text of the license may=20 > be found at diff --git=20 > a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf > b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf > index 3446c03eda21..33d4970afc57 100644 > --- a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf > +++ b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf > @@ -2,9 +2,11 @@ > # DXE ACPI Timer Library > # > # Provides basic timer support using the ACPI timer hardware. The=20 > performance -# counter features are provided by the processors time=20 > stamp counter. > +# counter features are provided by the processors time stamp counter. > # > -# Copyright (c) 2013 - 2015, Intel Corporation. All rights=20 > reserved.
> +# Note: The library only supports 24Bits ACPI timer. > +# > +# Copyright (c) 2013 - 2016, Intel Corporation. All rights=20 > +reserved.
> # This program and the accompanying materials # are licensed and=20 > made available under the terms and conditions of the BSD License # =20 > which accompanies this distribution. The full text of the license may=20 > be found at @@ -49,4 +51,4 @@ [Pcd] > gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoPciBarRegisterOffset ## > CONSUMES > gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoPortBaseAddress > ## CONSUMES > gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiPm1TmrOffset > ## CONSUMES > - gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoPortBaseAddressMask > ## CONSUMES > \ No newline at end of file > + gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoPortBaseAddressMask > ## CONSUMES > -- > 2.7.0.windows.1