[PATCH 1/3] efi: Add debugging to efi_set_bootdev()
Simon Glass
sjg at chromium.org
Sat Jan 29 22:58:35 CET 2022
Hi Heinrich,
On Mon, 24 Jan 2022 at 20:54, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 1/22/22 02:16, Simon Glass wrote:
> > The operation of this function can be confusing. Add some debugging so
> > we can see what it is doing and when it is called.
> >
> > Also drop the preprocessor usage.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > cmd/bootefi.c | 32 +++++++++++++++++++++-----------
> > 1 file changed, 21 insertions(+), 11 deletions(-)
> >
> > diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> > index 3a8b2b60618..d8685f0e878 100644
> > --- a/cmd/bootefi.c
> > +++ b/cmd/bootefi.c
> > @@ -65,6 +65,9 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
> > struct efi_device_path *device, *image;
> > efi_status_t ret;
> >
> > + log_debug("dev=%s, devnr=%s, path=%s, buffer=%p, size=%zx\n", dev,
> > + devnr, path, buffer, buffer_size);
> > +
> > /* Forget overwritten image */
> > if (buffer + buffer_size >= image_addr &&
> > image_addr + image_size >= buffer)
> > @@ -72,18 +75,19 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
> >
> > /* Remember only PE-COFF and FIT images */
> > if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
> > -#ifdef CONFIG_FIT
> > - if (fit_check_format(buffer, IMAGE_SIZE_INVAL))
> > + if (IS_ENABLED(CONFIG_FIT) &&
> > + !fit_check_format(buffer, IMAGE_SIZE_INVAL)) {
>
> This looks ok.
>
> > + /*
> > + * FIT images of type EFI_OS are started via command
> > + * bootm. We should not use their boot device with the
> > + * bootefi command.
> > + */
> > + buffer = 0;
> > + buffer_size = 0;
> > + } else {
> > + log_debug("- invalid image\n");
>
> This function is called by the 'load' command. When loading a perfectly
> valid device-tree or initial RAM disk the message would confuse me.
>
OK I will reword it.
> What is that '- ' good for?
It shows that this message is related to the one at the top of the function.
[..]
Regards,
Simon
More information about the U-Boot
mailing list