public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: edk2-devel@lists.01.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH v7 edk-platforms 2/6] Platform/HiKey960: do basic initialization
Date: Thu, 31 May 2018 22:01:51 +0100	[thread overview]
Message-ID: <20180531210151.wsix7pnnd7tqwn7u@bivouac.eciton.net> (raw)
In-Reply-To: <1527736210-17133-3-git-send-email-haojian.zhuang@linaro.org>

This fixes the headers, but ignores the most important bit of feedback
on v6:

On Thu, May 31, 2018 at 11:10:06AM +0800, Haojian Zhuang wrote:
> Do some basic initliazation on peripherals, such as pins and
> regulators.
> 
> The hardcoding code is taken from non-open reference code.
> Can't fix it for lack of documents.
> 
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---

> diff --git a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
> new file mode 100644
> index 000000000000..e88bad2167c6
> --- /dev/null
> +++ b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
...
> +/**
> +  Notification function of the event defined as belonging to the
> +  EFI_END_OF_DXE_EVENT_GROUP_GUID event group that was created in
> +  the entry point of the driver.
> +
> +  This function is called when an event belonging to the
> +  EFI_END_OF_DXE_EVENT_GROUP_GUID event group is signalled. Such an
> +  event is signalled once at the end of the dispatching of all
> +  drivers (end of the so called DXE phase).
> +
> +  @param[in]  Event    Event declared in the entry point of the driver whose
> +                       notification function is being invoked.
> +  @param[in]  Context  NULL
> +**/
> +STATIC
> +VOID
> +OnEndOfDxe (
> +  IN EFI_EVENT  Event,
> +  IN VOID       *Context
> +  )
> +{
> +  UINT32        BootMode;
> +  CHAR8         Buf[64];
> +  UINTN         Count;
> +
> +  BootMode = MmioRead32 (SCTRL_BAK_DATA0) & BOOT_MODE_MASK;
> +  if (BootMode == BOOT_MODE_RECOVERY) {
> +    Count = AsciiSPrint (
> +              Buf,
> +              64,
> +              "WARNING: CAN NOT BOOT KERNEL IN RECOVERY MODE!\n"
> +              );
> +    SerialPortWrite ((UINT8 *)Buf, Count);
> +    Count = AsciiSPrint (
> +              Buf,
> +              64,
> +              "Switch to normal boot mode, then reboot to boot kernel.\n"
> +              );

I gave the following feedback on v6, which has not been addressed at all:
---
I asked for the hand-coded values to be removed, and instead they have
been replaced by a static buffer which may or may not be able to hold
updated versions of the stringsm and require changes in three places
if that happens. This is not an improvement.

The length or size of a compile time constant should always be
described through StrLen/AsciiStrLen, or where possible sizeof.

In this instance, I would suggest doing something like:

  VOID   *RecoveryString;
    VOID   *SwitchString;

  RecoveryString = "WARNING: CAN NOT BOOT KERNEL IN RECOVERY MODE!\n"
    SwitchString = "Switch to normal boot mode, then reboot to boot
    kernel.\n";

You can then use SerialPortWrite (RecoveryString,
AsciiStrLen(*RecoveryString)).

I think we should also in future look into how we can get the console
working before Dxe. Both HiKey boards are generally intended to be
used with displays, so these messages will be invisible to many users.
---

> +    SerialPortWrite ((UINT8 *)Buf, Count);
> +  }
> +}

/
    Leif


  reply	other threads:[~2018-05-31 21:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  3:10 [PATCH v7 edk-platforms 0/6] enable virtual keyboards Haojian Zhuang
2018-05-31  3:10 ` [PATCH v7 edk-platforms 1/6] Platform/Hisilicon/HiKey960: add gpio platform driver Haojian Zhuang
2018-05-31  3:10 ` [PATCH v7 edk-platforms 2/6] Platform/HiKey960: do basic initialization Haojian Zhuang
2018-05-31 21:01   ` Leif Lindholm [this message]
2018-05-31 21:03     ` Leif Lindholm
2018-05-31  3:10 ` [PATCH v7 edk-platforms 3/6] Platform/HiKey960: enable virtual keyboard Haojian Zhuang
2018-05-31  3:10 ` [PATCH v7 edk-platforms 4/6] Platform/Hisilicon/HiKey: add gpio platform driver Haojian Zhuang
2018-05-31  3:10 ` [PATCH v7 edk-platforms 5/6] Platform/HiKey: do basic initialization on hikey Haojian Zhuang
2018-05-31 20:57   ` Leif Lindholm
2018-05-31  3:10 ` [PATCH v7 edk-platforms 6/6] Platform/HiKey: enable virtual keyboard Haojian Zhuang

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=20180531210151.wsix7pnnd7tqwn7u@bivouac.eciton.net \
    --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