From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D5AFC1A1E24 for ; Wed, 28 Sep 2016 03:17:59 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 28 Sep 2016 03:17:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,409,1470726000"; d="scan'208";a="766759189" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.9]) by FMSMGA003.fm.intel.com with ESMTP; 28 Sep 2016 03:17:58 -0700 From: Star Zeng To: edk2-devel@lists.01.org Cc: Star Zeng , Jiewen Yao , Liming Gao Date: Wed, 28 Sep 2016 18:17:55 +0800 Message-Id: <1475057875-338864-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [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 10:18:00 -0000 Clear bits [31:24] when reading ACPI timer count by IoRead32(), also add comments "Note: The library only supports 24Bits ACPI timer" in INF. 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 ++++-- PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf | 8 +++++--- 3 files changed, 13 insertions(+), 9 deletions(-) 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 = IoRead32 (Port) + Delay; + Ticks = (IoRead32 (Port) & (BIT24 - 1)) + Delay; Delay = BIT22; // // Wait until time out // Delay >= 2^23 could not be handled by this function // Timer wrap-arounds are handled correctly by this function // - while (((Ticks - IoRead32 (Port)) & BIT23) == 0) { + while (((Ticks - (IoRead32 (Port) & (BIT24 - 1))) & BIT23) == 0) { CpuPause (); } } while (Times-- > 0); @@ -371,7 +371,7 @@ InternalCalculateTscFrequency ( // Use 363 * 9861 = 3579543 Hz which is within 2 Hz of ACPI_TIMER_FREQUENCY. // 363 counts is a calibration time of 101.4 uS. // - Ticks = IoRead32 (TimerAddr) + 363; + Ticks = (IoRead32 (TimerAddr) & (BIT24 - 1)) + 363; StartTSC = 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) == 0) { + while (((Ticks - (IoRead32 (TimerAddr) & (BIT24 - 1))) & BIT23) == 0) { CpuPause(); } EndTSC = 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 performance -# counter features are provided by the processors time stamp counter. +# counter features are provided by the processors time stamp counter. # -# Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+# Note: The library only supports 24Bits ACPI timer. +# +# Copyright (c) 2013 - 2016, Intel Corporation. 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 diff --git 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 performance -# counter features are provided by the processors time stamp counter. +# counter features are provided by the processors time stamp counter. # -# Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+# Note: The library only supports 24Bits ACPI timer. +# +# Copyright (c) 2013 - 2016, Intel Corporation. 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 @@ -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