From nobody Fri Apr 19 22:58:31 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+105099+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+105099+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1684721698; cv=none; d=zohomail.com; s=zohoarc; b=W04vPf50KVyRKkaVdh72MuEvOT0QixWrPp3FFeLc7Wl1bjUTnGRKzAOZZuGzq/yumt3100abJ1aGq+lm1eWfv2wut2okLf9CRZm17hUWHZi/cuGevJzP0X86qFQ7/Q4XdaV3zl/BZiAl5Pux+UIhRrlWV+KpRLa9Pah2B0rH1hU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684721698; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cwXUGmGyJ8sqZTtaoT1dNRDFjX1pEka/RtzXffOqQ54=; b=l9gzGdxE+3jiptA7wIHNa6UzMt+IwWY5F85U+xLSm2jJWToMSk5q64OLSDJvY2IXG7Fr3dGxHPicjNU6Uv7cER8C6ln7yRYTK+nHT+/b8ZA+pu0Ay6T8kcVcoOKMnMh93UpCqvmmdZ/tDLJ/Swh+VuhFtj0YDyf29hXf8gPKqto= 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+105099+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 1684721698303734.066644324879; Sun, 21 May 2023 19:14:58 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id s5E4YY1788612x7zTzibLRss; Sun, 21 May 2023 19:14:58 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.3789.1684721696505517694 for ; Sun, 21 May 2023 19:14:57 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10717"; a="351654984" X-IronPort-AV: E=Sophos;i="6.00,183,1681196400"; d="scan'208";a="351654984" X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2023 19:14:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10717"; a="1033428067" X-IronPort-AV: E=Sophos;i="6.00,183,1681196400"; d="scan'208";a="1033428067" X-Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by fmsmga005.fm.intel.com with ESMTP; 21 May 2023 19:14:56 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: gua.guo@intel.com, Ray Ni , Michael D Kinney Subject: [edk2-devel] [PATCH v1 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD Date: Mon, 22 May 2023 10:14:51 +0800 Message-Id: <20230522021451.439-2-gua.guo@intel.com> In-Reply-To: <20230522021451.439-1-gua.guo@intel.com> References: <20230522021451.439-1-gua.guo@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,gua.guo@intel.com X-Gm-Message-State: zfClktcdxfMmMhK1kLB4HP65x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684721698; bh=8m+8bPcDtCabKp/H4YSKJ5yDcJxSKS4mlbEeN8sX/Z4=; h=Cc:Date:From:Reply-To:Subject:To; b=RTnz5PhluHLSQgj84XAQCSuge8vtBZ6XIqdxil68AmxHvWLeguz7bgrefR3Gi+NNeRg Se/7TzIjtDTT/xIovGGxRuAupC2LhonyCRtx4tvj7LrsR7kBha2cys883qs43BY2Ch9vP badaXBcwUl0f3PPmpuxBJzM1tfVnwPldQpE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684721698801100001 Content-Type: text/plain; charset="utf-8" From: Gua Guo RTC runtime is unable to get dynamic PCD value after booting to OS using runtime services. Resolution: Cache the dynamic PCD value in RTC driver entry point Cc: Ray Ni Cc: Michael D Kinney Signed-off-by: Gua Guo --- .../PcatRealTimeClockRuntimeDxe/PcRtc.c | 15 ++++++++------- .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c | 5 +++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChips= etPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c index d8b9fa8376..3f114dce5d 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c @@ -13,7 +13,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 extern UINTN mRtcIndexRegister; extern UINTN mRtcTargetRegister; - +extern UINTN mRtcIndexRegisterIo; +extern UINTN mRtcTargetRegisterIo; // // Days of month. // @@ -72,10 +73,10 @@ IoRtcRead ( ) { IoWrite8 ( - PcdGet8 (PcdRtcIndexRegister), - (UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x= 80)) + mRtcIndexRegisterIo, + (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80)) ); - return IoRead8 (PcdGet8 (PcdRtcTargetRegister)); + return IoRead8 (mRtcTargetRegisterIo); } =20 /** @@ -94,10 +95,10 @@ IoRtcWrite ( ) { IoWrite8 ( - PcdGet8 (PcdRtcIndexRegister), - (UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x= 80)) + mRtcIndexRegisterIo, + (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80)) ); - IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data); + IoWrite8 (mRtcTargetRegisterIo, Data); } =20 /** diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c b/PcAt= ChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c index e6e9458d75..23e87978bf 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c @@ -18,6 +18,8 @@ STATIC EFI_EVENT mVirtualAddrChangeEvent; =20 UINTN mRtcIndexRegister; UINTN mRtcTargetRegister; +UINTN mRtcIndexRegisterIo; +UINTN mRtcTargetRegisterIo; =20 /** Returns the current time and date information, and the time-keeping capa= bilities @@ -164,6 +166,9 @@ InitializePcRtc ( if (FeaturePcdGet (PcdRtcUseMmio)) { mRtcIndexRegister =3D (UINTN)PcdGet64 (PcdRtcIndexRegister64); mRtcTargetRegister =3D (UINTN)PcdGet64 (PcdRtcTargetRegister64); + } else { + mRtcIndexRegisterIo =3D (UINTN)PcdGet8 (PcdRtcIndexRegister); + mRtcTargetRegisterIo =3D (UINTN)PcdGet8 (PcdRtcTargetRegister); } =20 Status =3D PcRtcInit (&mModuleGlobal); --=20 2.39.2.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 (#105099): https://edk2.groups.io/g/devel/message/105099 Mute This Topic: https://groups.io/mt/99057517/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-