public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit
@ 2018-08-02 14:49 Marcin Wojtas
  2018-08-02 14:59 ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Wojtas @ 2018-08-02 14:49 UTC (permalink / raw)
  To: edk2-devel
  Cc: feng.tian, michael.d.kinney, liming.gao, leif.lindholm,
	ard.biesheuvel, nadavh, mw, jsd

EDK2 code uses a single 64bit write to update SBSA watchdog
compare registers, however an access to mmio registers should
be 32bit for some SoCs. Current usage of MmioWrite64 resulted
in an unpredicted behavior. Fix this by modifying
WatchdogWriteCompareRegister routine to use two consecutive
32bit writes to Watchdog Compare Register Low and High.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
index 3180f01..b25d210 100644
--- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
+++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
@@ -56,7 +56,11 @@ WatchdogWriteCompareRegister (
   UINT64  Value
   )
 {
-  MmioWrite64 (GENERIC_WDOG_COMPARE_VALUE_REG, Value);
+  MmioWrite32 (GENERIC_WDOG_COMPARE_VALUE_REG, Value & MAX_UINT32);
+  MmioWrite32 (
+    GENERIC_WDOG_COMPARE_VALUE_REG + sizeof (UINT32),
+    (Value >> 32) & MAX_UINT32
+    );
 }
 
 VOID
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-02 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-02 14:49 [PATCH] ArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit Marcin Wojtas
2018-08-02 14:59 ` Ard Biesheuvel
2018-08-02 15:12   ` Marcin Wojtas
2018-08-02 18:32     ` Ard Biesheuvel
2018-08-02 20:14       ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox