From c5cc6da855c10d762c492d390b1e4059910259d1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 19 Mar 2023 16:18:08 +0100 Subject: efi_loader: support for Ctrl() device path node * Add the definitions for Ctrl() device path nodes. * Implement Ctrl() nodes in the device path to text protocol. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas --- include/efi_api.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/efi_api.h b/include/efi_api.h index 2d18d25a713..c57868abbd9 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -570,6 +570,7 @@ struct efi_mac_addr { #define DEVICE_PATH_TYPE_HARDWARE_DEVICE 0x01 # define DEVICE_PATH_SUB_TYPE_MEMORY 0x03 # define DEVICE_PATH_SUB_TYPE_VENDOR 0x04 +# define DEVICE_PATH_SUB_TYPE_CONTROLLER 0x05 struct efi_device_path_memory { struct efi_device_path dp; @@ -584,6 +585,11 @@ struct efi_device_path_vendor { u8 vendor_data[]; } __packed; +struct efi_device_path_controller { + struct efi_device_path dp; + u32 controller_number; +} __packed; + #define DEVICE_PATH_TYPE_ACPI_DEVICE 0x02 # define DEVICE_PATH_SUB_TYPE_ACPI_DEVICE 0x01 -- cgit v1.2.3 From 92b931b8ef3b08068f8911ecfd7482b3c4660320 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 19 Mar 2023 08:59:33 +0100 Subject: efi_loader: move struct efi_device_path to efi.h Avoid forward declaration of struct efi_device_path. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas --- include/efi.h | 13 ++++++++++++- include/efi_api.h | 6 ------ 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/efi.h b/include/efi.h index c3087d3da28..2f312da3cba 100644 --- a/include/efi.h +++ b/include/efi.h @@ -52,7 +52,18 @@ #define EFI32_LOADER_SIGNATURE "EL32" #define EFI64_LOADER_SIGNATURE "EL64" -struct efi_device_path; +/** + * struct efi_device_path - device path protocol + * + * @type: device path type + * @sub_type: device path sub-type + * @length: length of the device path node including the header + */ +struct efi_device_path { + u8 type; + u8 sub_type; + u16 length; +} __packed; /* * The EFI spec defines the EFI_GUID as diff --git a/include/efi_api.h b/include/efi_api.h index c57868abbd9..7f092538a02 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -557,12 +557,6 @@ struct efi_loaded_image { # define DEVICE_PATH_SUB_TYPE_INSTANCE_END 0x01 # define DEVICE_PATH_SUB_TYPE_END 0xff -struct efi_device_path { - u8 type; - u8 sub_type; - u16 length; -} __packed; - struct efi_mac_addr { u8 addr[32]; } __packed; -- cgit v1.2.3 From f606fab8dada798da801684bd6f53ddfb50494e2 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 19 Mar 2023 09:20:22 +0100 Subject: efi_loader: move dp_alloc() to efi_alloc() The incumbent function efi_alloc() is unused. Replace dp_alloc() by a new function efi_alloc() that we can use more widely. Signed-off-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- include/efi_loader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 1542b4b625c..cee04cbb9dc 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -724,8 +724,8 @@ efi_status_t efi_next_variable_name(efi_uintn_t *size, u16 **buf, * Return: size in pages */ #define efi_size_in_pages(size) (((size) + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT) -/* Generic EFI memory allocator, call this to get memory */ -void *efi_alloc(uint64_t len, int memory_type); +/* Allocate boot service data pool memory */ +void *efi_alloc(size_t len); /* Allocate pages on the specified alignment */ void *efi_alloc_aligned_pages(u64 len, int memory_type, size_t align); /* More specific EFI memory allocator, called by EFI payloads */ -- cgit v1.2.3 From ac93275d79f85a169006a07e6a669b78970f381d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 20 Mar 2023 08:30:11 +1300 Subject: efi: Add another tranch of GUIDs Provide information about the GUIDs supplied by QEMU, so far as it is known. These values are used in the 'efi table' command as well as the printf format string %sU Signed-off-by: Simon Glass --- include/efi_api.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/efi_api.h b/include/efi_api.h index 7f092538a02..c4512eeb862 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1909,6 +1909,25 @@ struct efi_system_resource_table { EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \ 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) +#define EFI_LZMA_COMPRESSED \ + EFI_GUID(0xee4e5898, 0x3914, 0x4259, 0x9d, 0x6e, \ + 0xdc, 0x7b, 0xd7, 0x94, 0x03, 0xcf) +#define EFI_DXE_SERVICES \ + EFI_GUID(0x05ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, \ + 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9) +#define EFI_HOB_LIST \ + EFI_GUID(0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a, \ + 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +#define EFI_MEMORY_TYPE \ + EFI_GUID(0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, \ + 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa) +#define EFI_MEM_STATUS_CODE_REC \ + EFI_GUID(0x060cc026, 0x4c0d, 0x4dda, 0x8f, 0x41, \ + 0x59, 0x5f, 0xef, 0x00, 0xa5, 0x02) +#define EFI_GUID_EFI_ACPI1 \ + EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, \ + 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) + /** * struct win_certificate_uefi_guid - A certificate that encapsulates * a GUID-specific signature -- cgit v1.2.3 From 041840eeeb129ab979cbc05d6c5fb80162f50add Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 20 Mar 2023 08:30:14 +1300 Subject: efi: Split out table-listing code into a new file This code is used with EFI_LOADER but is also useful (with some modifications) for the EFI app and payload. Move it into a shared file. Show the address of the table so it can be examined if needed. Also show the table name as unknown if necessary. Our list of GUIDs is fairly small. Signed-off-by: Simon Glass --- include/efi.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/efi.h b/include/efi.h index 2f312da3cba..f0e5faa7549 100644 --- a/include/efi.h +++ b/include/efi.h @@ -648,4 +648,13 @@ int efi_call_exit_boot_services(void); int efi_get_mmap(struct efi_mem_desc **descp, int *sizep, uint *keyp, int *desc_sizep, uint *versionp); +/** + * efi_show_tables() - Show a list of available tables + * + * Shows the address, GUID (and name where known) for each table + * + * @systab: System table containing the list of tables + */ +void efi_show_tables(struct efi_system_table *systab); + #endif /* _LINUX_EFI_H */ -- cgit v1.2.3