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

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Nov 26 10:21:10 CET 2024


On 25.11.24 21:44, Simon Glass wrote:
> There is quite a bit of confusion in the EFI code as to whether a field
> contains an address or a pointer. As a first step towards resolving
> this, document the memory-descriptor struct, indicating that it holds
> addresses, not pointers.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>   include/efi.h | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>
> diff --git a/include/efi.h b/include/efi.h
> index c559fda3004..6f48c6569d5 100644
> --- a/include/efi.h
> +++ b/include/efi.h
> @@ -273,6 +273,21 @@ enum efi_memory_type {
>   #define EFI_PAGE_SIZE		(1ULL << EFI_PAGE_SHIFT)
>   #define EFI_PAGE_MASK		(EFI_PAGE_SIZE - 1)
>
> +/**
> + * struct efi_mem_desc - defines an EFI memory record
> + *
> + * type (enum efi_memory_type): EFI memory-type
> + * reserved: unused
> + * @physical_start: Start address of region in physical memory. Note that this
> + *	is an address, not a pointer. Use map_sysmem(physical_start) to convert
> + *	to a pointer

NAK.

EFI requires identity mapping. The value physical_start must be usable
as a pointer (void *). It cannot be a sandbox virtual address (phys_addr_t).

Sandbox virtual addresses have no meaning in UEFI. Restrict them to the CLI.

> + * @virtual_start: Start address of region in physical memory. Note that this
> + *	is an address, not a pointer. Use map_sysmem(virtual_start) to convert
> + *	to a pointer

Wrong again.

Best regards

Heinrich

> + * @num_pages: Number of EFI pages this record covers (each is EFI_PAGE_SIZE
> + *	bytes)
> + * @attribute: Memory attributes (see EFI_MEMORY_...)
> + */
>   struct efi_mem_desc {
>   	u32 type;
>   	u32 reserved;



More information about the U-Boot mailing list