From: "Vladimir Olovyannikov" <vladimir.olovyannikov@broadcom.com>
To: Laszlo Ersek <lersek@redhat.com>,
"Rabeda, Maciej" <maciej.rabeda@linux.intel.com>,
devel@edk2.groups.io, Zhichao Gao <zhichao.gao@intel.com>,
Ray Ni <ray.ni@intel.com>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
Jiaxin Wu <jiaxin.wu@intel.com>, Siyuan Fu <siyuan.fu@intel.com>,
Liming Gao <liming.gao@intel.com>, Nd <nd@arm.com>
Subject: Re: [PATCH v10 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand
Date: Wed, 9 Sep 2020 10:15:40 -0700 [thread overview]
Message-ID: <4aa7caa168ad8a2ea48d65722f63f33a@mail.gmail.com> (raw)
In-Reply-To: <5534f1de-b9b7-0981-e8c6-de0e4c25c617@redhat.com>
> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, September 9, 2020 3:51 AM
> To: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>;
> Rabeda, Maciej <maciej.rabeda@linux.intel.com>; devel@edk2.groups.io;
> Zhichao Gao <zhichao.gao@intel.com>; Ray Ni <ray.ni@intel.com>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; Jiaxin Wu
> <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Liming Gao
> <liming.gao@intel.com>; Nd <nd@arm.com>
> Subject: Re: [PATCH v10 1/1] ShellPkg/DynamicCommand: add
> HttpDynamicCommand
>
> On 09/08/20 23:04, Vladimir Olovyannikov wrote:
> >> -----Original Message-----
> >> From: Laszlo Ersek <lersek@redhat.com>
> >> Sent: Monday, September 7, 2020 2:37 AM
> >> To: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>;
> >> Rabeda, Maciej <maciej.rabeda@linux.intel.com>;
> devel@edk2.groups.io;
> >> Zhichao Gao <zhichao.gao@intel.com>; Ray Ni <ray.ni@intel.com>
> >> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; Jiaxin
> Wu
> >> <jiaxin.wu@intel.com>; Siyuan Fu <siyuan.fu@intel.com>; Liming Gao
> >> <liming.gao@intel.com>; Nd <nd@arm.com>
> >> Subject: Re: [PATCH v10 1/1] ShellPkg/DynamicCommand: add
> >> HttpDynamicCommand
> >>
> >> On 09/04/20 19:55, Vladimir Olovyannikov wrote:
> >>
> >>> There is also another issue with the TimebaseLib: inconsistency in
> >>> return values of the EfiTimeToEpoch (returns UINT32, should return
> >>> UINTN, as Zhichao pointed out earlier in the previous
> >>> HttpDynamicCommand patchset).
> >>> If this one is fixed, I can just use the TimeBaseLib.h header for
> >>> constants.
> >>
> >> Consuming TimeBaseLib.h in this patch would be really nice.
> > OK, if this can be fixed, I will definitely use TimeBaseLib.h header
> > for constants, and will drop duplicate definitions in Http.c/Http.h
> >>
> >> There are two EfiTimeToEpoch() call sites in edk2:
> >>
> >> ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
> >> EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.c
> >>
> >> The latter stores the return value in a UINTN variable, so that seems
> >> OK.
> >> The
> >> former is a bit messier, but it seems to ensure that the result fits
> >> in 32 bits for HW reasons anyway:
> >>
> >> // Because the PL031 is a 32-bit counter counting seconds,
> >> // the maximum time span is just over 136 years.
> >> // Time is stored in Unix Epoch format, so it starts in 1970,
> >> // Therefore it can not exceed the year 2106.
> >> if ((Time->Year < 1970) || (Time->Year >= 2106)) {
> >> return EFI_UNSUPPORTED;
> >> }
> >> ...
> >> EpochSeconds = EfiTimeToEpoch (Time); ...
> >> MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER,
> >> EpochSeconds);
> >>
> >> So I think we'd need two patches:
> >>
> >> (1) add an explicit (UINT32) cast to the EfiTimeToEpoch() call in
> >>
> "ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
> >> ",
> >>
> >> (2) change the return value to UINTN in
> >> "EmbeddedPkg/Include/Library/TimeBaseLib.h" and
> >> "EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c".
> >>
> >> Hmm wait... There are five more call sites in edk2-platforms. :( OK,
> >> I give up here. Sorry.
> > OK, so what are the next steps, what do you suggest?
>
> You'd have to audit, and if necessary, clean up, the EfiTimeToEpoch() call
> sites in edk2-platforms. And you'd need to establish a global order
> between
> the patch series (plural) such that both edk2 and edk2-platforms should
> build
> at any stage across those series.
I looked through the platforms, and all of them use UINT32 for
EfiTimeToEpoch() return value, so IMHO it is sufficient to
change EfiTimeToEpoch's variables to UINTN, and then return
(UINT32)(EpochSeconds) in EfiTimeToEpoch().
>
> Thanks
> Laszlo
Thank you,
Vladimir
>
> > I saw today that unused macros like SEC_PER_MONTH, etc. were removed
> > from TimeBaseLib.h.
> >
> > Thank you,
> > Vladimir
> >>
> >> Laszlo
> >
next prev parent reply other threads:[~2020-09-09 17:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 4:08 [PATCH v10 0/1] ShellPkg/DynamicCommand: add HttpDynamicCommand Vladimir Olovyannikov
2020-09-02 4:08 ` [PATCH v10 1/1] " Vladimir Olovyannikov
2020-09-04 13:10 ` Maciej Rabeda
2020-09-04 15:20 ` Laszlo Ersek
2020-09-04 17:55 ` Vladimir Olovyannikov
2020-09-07 9:36 ` Laszlo Ersek
2020-09-08 21:04 ` Vladimir Olovyannikov
2020-09-09 10:50 ` Laszlo Ersek
2020-09-09 17:15 ` Vladimir Olovyannikov [this message]
2020-09-10 6:25 ` [edk2-devel] " Laszlo Ersek
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=4aa7caa168ad8a2ea48d65722f63f33a@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