From nobody Fri Mar 29 06:19:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+89282+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+89282+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650915738; cv=none; d=zohomail.com; s=zohoarc; b=SSVvUwFAx07e1+vHxhkrNIkuyI/6LpApWlZFtIyXez9E4OmglTTZ2OyI9foPZ0gfzUYIbFRfA46bdl8Wv7PW8Utrs6iB8z+G/Cnl+Umpjj4SJ/0Ym0Z/7fKkxdK3DY9KZg92mso7XmG8hgZNq1UfwM1zoD+0Ah/EqpRfKmHlU2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650915738; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=sIGu0kBXaIPrc68YkTaaZmDU3PyCcosj8JAesddU1+w=; b=XJSfWJxqn2NxzIxKpPOhJzfnQFVTtrQ//dcv9dyP5yvp1do7E4KcZktw2RFv+ni1IZ4Nh6gL5say+3NDN3bgRjVGCOFPnuxVpmYyYHSwTm+QGYX+PLNWuEXRJ2A65xpbV+ZE4A7UojBwDpyPAsWsk/Yep+TvgG02jlt+4maUiKA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+89282+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650915738715823.1108492077973; Mon, 25 Apr 2022 12:42:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id NeC1YY1788612xr0yddKtySI; Mon, 25 Apr 2022 12:42:18 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.31421.1650901612443854543 for ; Mon, 25 Apr 2022 08:46:53 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10328"; a="262882017" X-IronPort-AV: E=Sophos;i="5.90,288,1643702400"; d="scan'208";a="262882017" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 08:46:51 -0700 X-IronPort-AV: E=Sophos;i="5.90,288,1643702400"; d="scan'208";a="532177581" X-Received: from zchao-mobl1.ccr.corp.intel.com ([10.255.28.244]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 08:46:50 -0700 From: "Zhuoran Chao" To: devel@edk2.groups.io Cc: Zhuoran Chao , Ray Ni Subject: [edk2-devel] [PATCH] PcAtChipsetPkg: Change the flow of PcRtcInit() Date: Mon, 25 Apr 2022 23:46:35 +0800 Message-Id: <06d8bbd206495c31f5e7aaebc979b338af4264dd.1650900008.git.zhuoran.chao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,zhuoran.chao@intel.com X-Gm-Message-State: JRn4A7SxP6vexg8UQv2jjtSSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650915738; bh=OPXjdLlS/bZTFl1iCWSSAr3j0XcaRui3f/d95gC+f/0=; h=Cc:Date:From:Reply-To:Subject:To; b=jEVzUPpw4CwWJ7Bp+MJGr3BSiV6PKptF/vtr0foxbYF790WIuuJn8CmscbSZf7WPdkY cMs5xEA25lG3+tjrQP+PsHgBn2iBvmunnOEzqeVQ4NgHswlylw1s1zyI9hkIkwN4/BmlF 66EmYvmsIe80j7ZawjMuvo+GS2jmMVCmN48= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650915740858100003 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3913 The original flow of PcRtcInit() is like: 1. Guarantee atomic accesses to the RTC time registers and read out the value. 2. Program RTC register B. (adopt 12h mode or 24h mode. Current bios code sets RTC to 24h mode by default). 3. Then function ConvertRtcTimeToEfiTime converts the RTC time value to their 24h mode by checking the hour format bit (1:24h mode,0:12h mode). And here lies the problem: Step3 will fail to adjust the value if Step2 already sets RTC to 24h mode. The hour value in 12h mode will not be converted to its 24h mode. The solution is to program RTC register B a little later when all the original RTC registers' value is retrieved, adjusted and validated. Cc: Ray Ni Signed-off-by: Zhuoran Chao --- PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChips= etPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c index 0fbfa4bcee..ea56a66267 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c @@ -269,13 +269,6 @@ PcRtcInit ( Time.Month =3D RtcRead (RTC_ADDRESS_MONTH); Time.Year =3D RtcRead (RTC_ADDRESS_YEAR); =20 - // - // Set RTC configuration after get original time - // The value of bit AIE should be reserved. - // - RegisterB.Data =3D FixedPcdGet8 (PcdInitialValueRtcRegisterB) | (Registe= rB.Data & BIT5); - RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data); - // // Release RTC Lock. // @@ -330,6 +323,13 @@ PcRtcInit ( Time.Daylight =3D 0; } =20 + // + // Set RTC configuration after get original time + // The value of bit AIE should be reserved. + // + RegisterB.Data =3D FixedPcdGet8 (PcdInitialValueRtcRegisterB) | (Registe= rB.Data & BIT5); + RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data); + // // Reset time value according to new RTC configuration // --=20 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 (#89282): https://edk2.groups.io/g/devel/message/89282 Mute This Topic: https://groups.io/mt/90693358/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-