[PATCH v5 01/23] efi: Define fields in struct efi_mem_desc

Simon Glass sjg at chromium.org
Wed Dec 11 16:53:27 CET 2024


Hi Ilias,

On Wed, 11 Dec 2024 at 07:45, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> Hi Simon,
>
> [...]
>
> >         u32 reserved;
> > diff --git a/include/efi_loader.h b/include/efi_loader.h
> > index 39809eac1bc..ee0cdd36500 100644
> > --- a/include/efi_loader.h
> > +++ b/include/efi_loader.h
> > @@ -788,8 +788,10 @@ efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type);
> >  /**
> >   * efi_add_memory_map_pg() - add pages to the memory map
> >   *
> > - * @start:                     start address, must be a multiple of
> > - *                             EFI_PAGE_SIZE
> > + * @start: start address, must be a multiple of EFI_PAGE_SIZE. Note that this
> > + * is actually a pointer provided as an integer. To pass in an address, pass
> > + * in (ulong)map_to_sysmem(addr)
>
> Why is this a pointer? This is the physical address of the hardware.

The distinction between pointer and address is to make it clear
whether you need to map_sysmem() or not. That is the purpose of this
series - to clean up the confusion about translating back and forth.
There definitely is quite a bit of confusion in the EFI_LOADER code.

Generally in U-Boot ulong is used for an address and void * for a
pointer. In the case of EFI_LOADER, the original author may not have
been aware of that. Incidentally, it was also written without sandbox
support (which I added) and tests[1] (which Heinrich added).

If you like we could arrange a call to go over how sandbox works with memory.

Regards,
Simon

[1] https://lore.kernel.org/u-boot/7fbaabab-5d82-4670-eab6-edb9d27f0bb9@suse.de/


More information about the U-Boot mailing list