From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mx.groups.io with SMTP id smtpd.web10.6117.1687914966170238503 for ; Tue, 27 Jun 2023 18:16:06 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@ventanamicro.com header.s=google header.b=RW6yt9XL; spf=pass (domain: ventanamicro.com, ip: 209.85.214.178, mailfrom: tphan@ventanamicro.com) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1b7e6512973so20483145ad.3 for ; Tue, 27 Jun 2023 18:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1687914965; x=1690506965; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nchXOAdp1C7gEqIkVMmNRW5tzkfNcqBrdGchZg5lINU=; b=RW6yt9XLxSaP+d4MieiDK/zUYue7+9fMAmBjz5CaPY8EftjiEuK7AjBSb3YF5KUtP+ bwWhlBWV1Cr5H4B5AKbENpvgxaIiHzWG8wPkPGleB3uUTTcOirjp99XobyGYRSyL5/zC hcbXwhBRnJrFm+GQ1SBqD9prIJ9uix7CHctOQ6aLOD9yqWeH1qpg4+YpQ81ApcLF4vqA VugcBQi+h+lx6VPu9w9QU62hTqqeBAc0QxBR9491xECJl7DkANeecKASZSv5NksxCIis 57jVt9uEl9Awp4L57r2yfaZZZ1tuSAIOxInnQTDEVDl8zofVcn6ZDW5gokvCTQZ+Y/Yy oKuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687914965; x=1690506965; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nchXOAdp1C7gEqIkVMmNRW5tzkfNcqBrdGchZg5lINU=; b=VWFnordi4/6TfF7J3N2u6zIeFffPAWJJeS2Blb93BOt4llIuqycu6p9ORWZVD2xJdg 4fie9Bx1P/6bN4SXiRyS81GNk2QXyAx1NRR6b1yMXnZSfJqS6xBby5FWtIeHlOOX7Qty Y9bwh6CWI3xV9Xreie3hFOQ0cefwP3Gavx7hGUKprShjextKQvkD43g5kEiMMj7U4TJJ 7T5UGDNu+SjunXGcUiEm5vcO3pVO8rmrqwNueEQMSocopGOQhqIsRncf3C2nJ7izCvVQ I+EJW3iDcjdQNPrJUTFdSMxlrQktW6iMnHWSznnptiM/vG91jyMgjKB3y8XOT5LbubWW zZAQ== X-Gm-Message-State: AC+VfDwVTEouooopufJ/9kxHI7Jj44KvdKV6ZJ4zjkUWy1ZpdE1CfTAn QR1OcJqAmPLPfU2P4Y2PrY2OxEuLraOc7R0J8nk8tQ== X-Google-Smtp-Source: ACHHUZ4EG2ns02gdD8jxnRDFJqqVdpZjbc4cb5l67CqsDl0ws8EafR5NzDO8vf93YMmHF4dKSfAGRg== X-Received: by 2002:a17:902:c40c:b0:1b2:450f:9b6 with SMTP id k12-20020a170902c40c00b001b2450f09b6mr10197131plk.8.1687914965239; Tue, 27 Jun 2023 18:16:05 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-174-50-177-95.hsd1.ca.comcast.net. [174.50.177.95]) by smtp.gmail.com with ESMTPSA id n13-20020a170903110d00b001b5656b0bf9sm6487599plh.286.2023.06.27.18.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 18:16:04 -0700 (PDT) From: "Tuan Phan" To: devel@edk2.groups.io Cc: sunilvl@ventanamicro.com, andrei.warkentin@intel.com, Tuan Phan Subject: [PATCH] UefiCpuPkg: CpuTimerDxeRiscV64: Fix timer event not working correctly Date: Tue, 27 Jun 2023 18:15:57 -0700 Message-Id: <20230628011557.4713-1-tphan@ventanamicro.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The timer notify function should be called with timer period, not the value read from timer register. Signed-off-by: Tuan Phan --- UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c b/UefiCpuPkg/CpuTimerDxe= RiscV64/Timer.c index 358057e7c6a4..30e48061cd06 100644 --- a/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c +++ b/UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c @@ -9,6 +9,7 @@ =0D #include =0D #include =0D +#include =0D #include "Timer.h"=0D =0D //=0D @@ -71,7 +72,12 @@ TimerInterruptHandler ( // time to increment slower. So when we take an interrupt,=0D // account for the actual time passed.=0D //=0D - mTimerNotifyFunction (PeriodStart - mLastPeriodStart);=0D + mTimerNotifyFunction (=0D + DivU64x32 (=0D + EFI_TIMER_PERIOD_SECONDS (PeriodStart - mLastPeriodStart),=0D + PcdGet64 (PcdCpuCoreCrystalClockFrequency)=0D + )=0D + );=0D }=0D =0D if (mTimerPeriod =3D=3D 0) {=0D --=20 2.25.1