[PATCH 01/13] efi: Define fields in struct efi_mem_desc
Simon Glass
sjg at chromium.org
Mon Nov 25 21:44:40 CET 2024
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
+ * @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
+ * @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;
--
2.43.0
More information about the U-Boot
mailing list