From: Marcin Wojtas <mw@semihalf.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
"Tian, Feng" <feng.tian@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"Gao, Liming" <liming.gao@intel.com>,
Leif Lindholm <leif.lindholm@linaro.org>,
nadavh@marvell.com, "jsd@semihalf.com" <jsd@semihalf.com>
Subject: Re: [PATCH v2 1/1] ArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit
Date: Fri, 3 Aug 2018 11:41:17 +0200 [thread overview]
Message-ID: <CAPv3WKdT1rvcOQh+rGUm1Jq8AJauuPA2zbXhc5GP4cYq-erS+w@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu_10LLKErSSJtdmGr1=GnF5hZ3dv-mLWpRpGKb60kT0vA@mail.gmail.com>
pt., 3 sie 2018 o 09:33 Ard Biesheuvel <ard.biesheuvel@linaro.org> napisał(a):
>
> On 2 August 2018 at 22:50, Marcin Wojtas <mw@semihalf.com> wrote:
> > According to the SBSA specification the Watchdog Compare
> > Register is split into two separate 32bit registers.
> > EDK2 code uses a single 64bit transaction to update
> > them, which can be problematic, depending on the SoC
> > implementation and could result in an unpredicted behavior.
> >
> > Fix this by modifying WatchdogWriteCompareRegister routine to
> > use two consecutive 32bit writes to the Watchdog Compare Register
> > Low and High, using new dedicated macros.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> > Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>
> Pushed as dd4cae4d82c7
>
Thanks a lot!
Marcin
>
> > ---
> > Changelog v1 -> v2:
> > - use separate macros for WCV register low and high
> > - improve commit message
> > - add Leif's RB
> >
> > ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h | 3 ++-
> > ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 3 ++-
> > 2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h
> > index 9e2aebc..4f42c56 100644
> > --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h
> > +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdog.h
> > @@ -20,7 +20,8 @@
> > // Control Frame:
> > #define GENERIC_WDOG_CONTROL_STATUS_REG ((UINTN)FixedPcdGet64 (PcdGenericWatchdogControlBase) + 0x000)
> > #define GENERIC_WDOG_OFFSET_REG ((UINTN)FixedPcdGet64 (PcdGenericWatchdogControlBase) + 0x008)
> > -#define GENERIC_WDOG_COMPARE_VALUE_REG ((UINTN)FixedPcdGet64 (PcdGenericWatchdogControlBase) + 0x010)
> > +#define GENERIC_WDOG_COMPARE_VALUE_REG_LOW ((UINTN)FixedPcdGet64 (PcdGenericWatchdogControlBase) + 0x010)
> > +#define GENERIC_WDOG_COMPARE_VALUE_REG_HIGH ((UINTN)FixedPcdGet64 (PcdGenericWatchdogControlBase) + 0x014)
> >
> > // Values of bit 0 of the Control/Status Register
> > #define GENERIC_WDOG_ENABLED 1
> > diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
> > index 3180f01..8ccf153 100644
> > --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
> > +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
> > @@ -56,7 +56,8 @@ WatchdogWriteCompareRegister (
> > UINT64 Value
> > )
> > {
> > - MmioWrite64 (GENERIC_WDOG_COMPARE_VALUE_REG, Value);
> > + MmioWrite32 (GENERIC_WDOG_COMPARE_VALUE_REG_LOW, Value & MAX_UINT32);
> > + MmioWrite32 (GENERIC_WDOG_COMPARE_VALUE_REG_HIGH, (Value >> 32) & MAX_UINT32);
> > }
> >
> > VOID
> > --
> > 2.7.4
> >
prev parent reply other threads:[~2018-08-03 9:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 20:50 [PATCH v2 1/1] ArmPkg/GenericWatchdogDxe: Split 64bit register write to 2x32bit Marcin Wojtas
2018-08-03 7:33 ` Ard Biesheuvel
2018-08-03 9:41 ` Marcin Wojtas [this message]
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=CAPv3WKdT1rvcOQh+rGUm1Jq8AJauuPA2zbXhc5GP4cYq-erS+w@mail.gmail.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