From: "Rebecca Cran via groups.io" <rebecca=os.amperecomputing.com@groups.io>
To: Leif Lindholm <quic_llindhol@quicinc.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>
Cc: Rebecca Cran <rebecca@os.amperecomputing.com>, devel@edk2.groups.io
Subject: [edk2-devel] [PATCH 2/3] ArmPkg: Fix the calculation of the timer period in GenericWatchdogDxe
Date: Wed, 3 Jan 2024 13:43:52 -0700 [thread overview]
Message-ID: <20240103204353.361541-3-rebecca@os.amperecomputing.com> (raw)
In-Reply-To: <20240103204353.361541-1-rebecca@os.amperecomputing.com>
Fix the calculation of the timer period in GenericWatchdogDxe: we need
to multiply before dividing to keep the values as integers.
Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com>
---
ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
index 05df101d5f4b..8f02f38c64e3 100644
--- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
+++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
@@ -119,7 +119,7 @@ WatchdogInterruptHandler (
// the timer period plus 1.
//
if (mWatchdogNotify != NULL) {
- TimerPeriod = ((TIME_UNITS_PER_SECOND / mTimerFrequencyHz) * mNumTimerTicks);
+ TimerPeriod = ((TIME_UNITS_PER_SECOND * mNumTimerTicks) / mTimerFrequencyHz);
mWatchdogNotify (TimerPeriod + 1);
}
@@ -260,7 +260,7 @@ WatchdogGetTimerPeriod (
return EFI_INVALID_PARAMETER;
}
- *TimerPeriod = ((TIME_UNITS_PER_SECOND / mTimerFrequencyHz) * mNumTimerTicks);
+ *TimerPeriod = ((TIME_UNITS_PER_SECOND * mNumTimerTicks) / mTimerFrequencyHz);
return EFI_SUCCESS;
}
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113105): https://edk2.groups.io/g/devel/message/113105
Mute This Topic: https://groups.io/mt/103510102/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-03 20:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 20:43 [edk2-devel] [PATCH 0/3] ArmPkg: GenericWatchdogDxe fixes and improvements Rebecca Cran via groups.io
2024-01-03 20:43 ` [edk2-devel] [PATCH 1/3] ArmPkg: Update GenericWatchdogDxe to allow setting full 48-bit offset Rebecca Cran via groups.io
2024-01-04 10:01 ` Sami Mujawar
2024-01-03 20:43 ` Rebecca Cran via groups.io [this message]
2024-01-03 22:56 ` [edk2-devel] [PATCH 2/3] ArmPkg: Fix the calculation of the timer period in GenericWatchdogDxe Ard Biesheuvel
2024-01-05 4:38 ` Rebecca Cran via groups.io
2024-01-03 20:43 ` [edk2-devel] [PATCH 3/3] ArmPkg: Disable watchdog interaction after exiting boot services Rebecca Cran via groups.io
2024-01-04 10:01 ` Sami Mujawar
2024-01-05 4:38 ` Rebecca Cran via groups.io
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240103204353.361541-3-rebecca@os.amperecomputing.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox