From f30ca6ba0bb2b7d050f24682bb8639c939c79859 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 15 Nov 2011 12:56:32 +0000 Subject: efi.h: Add struct definition for boot time services With the forthcoming efi stub code we're gonna need to access boot time services so let's define a struct so we can access the functions. Cc: Matthew Garrett Signed-off-by: Matt Fleming Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin --- include/linux/efi.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/efi.h b/include/linux/efi.h index 2362a0bc7f0..9547597ad6b 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -138,6 +138,57 @@ typedef struct { u8 sets_to_zero; } efi_time_cap_t; +/* + * EFI Boot Services table + */ +typedef struct { + efi_table_hdr_t hdr; + void *raise_tpl; + void *restore_tpl; + void *allocate_pages; + void *free_pages; + void *get_memory_map; + void *allocate_pool; + void *free_pool; + void *create_event; + void *set_timer; + void *wait_for_event; + void *signal_event; + void *close_event; + void *check_event; + void *install_protocol_interface; + void *reinstall_protocol_interface; + void *uninstall_protocol_interface; + void *handle_protocol; + void *__reserved; + void *register_protocol_notify; + void *locate_handle; + void *locate_device_path; + void *install_configuration_table; + void *load_image; + void *start_image; + void *exit; + void *unload_image; + void *exit_boot_services; + void *get_next_monotonic_count; + void *stall; + void *set_watchdog_timer; + void *connect_controller; + void *disconnect_controller; + void *open_protocol; + void *close_protocol; + void *open_protocol_information; + void *protocols_per_handle; + void *locate_handle_buffer; + void *locate_protocol; + void *install_multiple_protocol_interfaces; + void *uninstall_multiple_protocol_interfaces; + void *calculate_crc32; + void *copy_mem; + void *set_mem; + void *create_event_ex; +} efi_boot_services_t; + /* * Types and defines for EFI ResetSystem */ @@ -261,7 +312,7 @@ typedef struct { unsigned long stderr_handle; unsigned long stderr; efi_runtime_services_t *runtime; - unsigned long boottime; + efi_boot_services_t *boottime; unsigned long nr_tables; unsigned long tables; } efi_system_table_t; -- cgit v1.2.3 From 8e84f345e2f2189a37492c77c566c7494b7b6b23 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 15 Nov 2011 12:56:50 +0000 Subject: efi.h: Add efi_image_loaded_t Add the EFI loaded image structure and protocol guid which are required by the x86 EFI boot stub. The EFI boot stub uses the structure to figure out where it was loaded in memory and to pass command line arguments to the kernel. Cc: Matthew Garrett Signed-off-by: Matt Fleming Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin --- include/linux/efi.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/linux/efi.h b/include/linux/efi.h index 9547597ad6b..e35005f451d 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -287,6 +287,9 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, #define LINUX_EFI_CRASH_GUID \ EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 ) +#define LOADED_IMAGE_PROTOCOL_GUID \ + EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) + typedef struct { efi_guid_t guid; unsigned long table; @@ -326,6 +329,22 @@ struct efi_memory_map { unsigned long desc_size; }; +typedef struct { + u32 revision; + void *parent_handle; + efi_system_table_t *system_table; + void *device_handle; + void *file_path; + void *reserved; + u32 load_options_size; + void *load_options; + void *image_base; + __aligned_u64 image_size; + unsigned int image_code_type; + unsigned int image_data_type; + unsigned long unload; +} efi_loaded_image_t; + #define EFI_INVALID_TABLE_ADDR (~0UL) /* -- cgit v1.2.3 From bb05e4ba452ada7966fbced4e829aa029f546445 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 15 Nov 2011 12:57:03 +0000 Subject: efi.h: Add allocation types for boottime->allocate_pages() Add the allocation types detailed in section 6.2 - "AllocatePages()" of the UEFI 2.3 specification. These definitions will be used by the x86 EFI boot stub which needs to allocate memory during boot. Cc: Matthew Garrett Signed-off-by: Matt Fleming Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin --- include/linux/efi.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/linux/efi.h b/include/linux/efi.h index e35005f451d..378f2cd1f7c 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -109,6 +109,14 @@ typedef struct { u32 imagesize; } efi_capsule_header_t; +/* + * Allocation types for calls to boottime->allocate_pages. + */ +#define EFI_ALLOCATE_ANY_PAGES 0 +#define EFI_ALLOCATE_MAX_ADDRESS 1 +#define EFI_ALLOCATE_ADDRESS 2 +#define EFI_MAX_ALLOCATE_TYPE 3 + typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); /* -- cgit v1.2.3 From 0f7c5d477f2ce552997831d80e2c872cca1b9054 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 15 Nov 2011 12:57:16 +0000 Subject: efi.h: Add graphics protocol guids The x86 EFI boot stub uses the Graphics Output Protocol and Universal Graphics Adapter (UGA) protocol guids when initialising graphics during boot. Cc: Matthew Garrett Signed-off-by: Matt Fleming Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin --- include/linux/efi.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/linux/efi.h b/include/linux/efi.h index 378f2cd1f7c..e46d771f87e 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -298,6 +298,15 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, #define LOADED_IMAGE_PROTOCOL_GUID \ EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) +#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ + EFI_GUID( 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a ) + +#define EFI_UGA_PROTOCOL_GUID \ + EFI_GUID( 0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 ) + +#define EFI_PCI_IO_PROTOCOL_GUID \ + EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a ) + typedef struct { efi_guid_t guid; unsigned long table; -- cgit v1.2.3 From e2527a7cbec073b69a251193f200a88efbced7ad Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 15 Nov 2011 12:57:26 +0000 Subject: efi.h: Add boottime->locate_handle search types The x86 EFI boot stub needs to locate handles for various protocols. Cc: Matthew Garrett Signed-off-by: Matt Fleming Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin --- include/linux/efi.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/efi.h b/include/linux/efi.h index e46d771f87e..d407c88f955 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -471,6 +471,13 @@ extern int __init efi_setup_pcdp_console(char *); #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 +/* + * The type of search to perform when calling boottime->locate_handle + */ +#define EFI_LOCATE_ALL_HANDLES 0 +#define EFI_LOCATE_BY_REGISTER_NOTIFY 1 +#define EFI_LOCATE_BY_PROTOCOL 2 + /* * EFI Device Path information */ -- cgit v1.2.3 From 55839d515495e766605d7aaabd9c2758370a8d27 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 11 Aug 2011 10:28:06 +0100 Subject: efi: Add EFI file I/O data types The x86 EFI stub needs to access files, for example when loading initrd's. Add the required data types. Cc: Matthew Garrett Signed-off-by: Matt Fleming Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin --- include/linux/efi.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'include') diff --git a/include/linux/efi.h b/include/linux/efi.h index d407c88f955..37c300712e0 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -307,6 +307,12 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, #define EFI_PCI_IO_PROTOCOL_GUID \ EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a ) +#define EFI_FILE_INFO_ID \ + EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) + +#define EFI_FILE_SYSTEM_GUID \ + EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) + typedef struct { efi_guid_t guid; unsigned long table; @@ -362,6 +368,40 @@ typedef struct { unsigned long unload; } efi_loaded_image_t; +typedef struct { + u64 revision; + void *open_volume; +} efi_file_io_interface_t; + +typedef struct { + u64 size; + u64 file_size; + u64 phys_size; + efi_time_t create_time; + efi_time_t last_access_time; + efi_time_t modification_time; + __aligned_u64 attribute; + efi_char16_t filename[1]; +} efi_file_info_t; + +typedef struct { + u64 revision; + void *open; + void *close; + void *delete; + void *read; + void *write; + void *get_position; + void *set_position; + void *get_info; + void *set_info; + void *flush; +} efi_file_handle_t; + +#define EFI_FILE_MODE_READ 0x0000000000000001 +#define EFI_FILE_MODE_WRITE 0x0000000000000002 +#define EFI_FILE_MODE_CREATE 0x8000000000000000 + #define EFI_INVALID_TABLE_ADDR (~0UL) /* -- cgit v1.2.3