Commit 5465fe0f authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'efi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into efi/core



Pull EFI updates from Matt Fleming:

"* Refactor the EFI memory map code into architecture neutral files
   and allow drivers to permanently reserve EFI boot services regions
   on x86, as well as ARM/arm64 - Matt Fleming

 * Add ARM support for the EFI esrt driver - Ard Biesheuvel

 * Make the EFI runtime services and efivar API interruptible by
   swapping spinlocks for semaphores - Sylvain Chouleur

 * Provide the EFI identity mapping for kexec which allows kexec to
   work on SGI/UV platforms with requiring the "noefi" kernel command
   line parameter - Alex Thorlton

 * Add debugfs node to dump EFI page tables on arm64 - Ard Biesheuvel

 * Merge the EFI test driver being carried out of tree until now in
   the FWTS project - Ivan Hu

 * Expand the list of flags for classifying EFI regions as "RAM" on
   arm64 so we align with the UEFI spec - Ard Biesheuvel

 * Optimise out the EFI mixed mode if it's unsupported (CONFIG_X86_32)
   or disabled (CONFIG_EFI_MIXED=n) and switch the early EFI boot
   services function table for direct calls, alleviating us from
   having to maintain the custom function table - Lukas Wunner

 * Miscellaneous cleanups and fixes"

Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents cbf2f8a9 0a637ee6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4583,6 +4583,13 @@ M: Peter Jones <pjones@redhat.com>
S:	Maintained
F:	drivers/video/fbdev/efifb.c

EFI TEST DRIVER
L:	linux-efi@vger.kernel.org
M:	Ivan Hu <ivan.hu@canonical.com>
M:	Matt Fleming <matt@codeblueprint.co.uk>
S:	Maintained
F:	drivers/firmware/efi/test/

EFS FILESYSTEM
W:	http://aeschi.ch.eu.org/efs/
S:	Orphan
+3 −37
Original line number Diff line number Diff line
@@ -29,22 +29,11 @@ __pure const struct efi_config *__efi_early(void)
static void setup_boot_services##bits(struct efi_config *c)		\
{									\
	efi_system_table_##bits##_t *table;				\
	efi_boot_services_##bits##_t *bt;				\
									\
	table = (typeof(table))sys_table;				\
									\
	c->boot_services = table->boottime;				\
	c->text_output = table->con_out;				\
									\
	bt = (typeof(bt))(unsigned long)(table->boottime);		\
									\
	c->allocate_pool = bt->allocate_pool;				\
	c->allocate_pages = bt->allocate_pages;				\
	c->get_memory_map = bt->get_memory_map;				\
	c->free_pool = bt->free_pool;					\
	c->free_pages = bt->free_pages;					\
	c->locate_handle = bt->locate_handle;				\
	c->handle_protocol = bt->handle_protocol;			\
	c->exit_boot_services = bt->exit_boot_services;			\
}
BOOT_SERVICES(32);
BOOT_SERVICES(64);
@@ -286,29 +275,6 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
	}
}

static void find_bits(unsigned long mask, u8 *pos, u8 *size)
{
	u8 first, len;

	first = 0;
	len = 0;

	if (mask) {
		while (!(mask & 0x1)) {
			mask = mask >> 1;
			first++;
		}

		while (mask & 0x1) {
			mask = mask >> 1;
			len++;
		}
	}

	*pos = first;
	*size = len;
}

static efi_status_t
__setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
{
@@ -578,7 +544,7 @@ setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height)
	efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
	unsigned long nr_ugas;
	u32 *handles = (u32 *)uga_handle;;
	efi_status_t status;
	efi_status_t status = EFI_INVALID_PARAMETER;
	int i;

	first_uga = NULL;
@@ -623,7 +589,7 @@ setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height)
	efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
	unsigned long nr_ugas;
	u64 *handles = (u64 *)uga_handle;;
	efi_status_t status;
	efi_status_t status = EFI_INVALID_PARAMETER;
	int i;

	first_uga = NULL;
+3 −3
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ ENTRY(efi_pe_entry)

	/* Relocate efi_config->call() */
	leal	efi32_config(%esi), %eax
	add	%esi, 88(%eax)
	add	%esi, 32(%eax)
	pushl	%eax

	call	make_boot_params
@@ -108,7 +108,7 @@ ENTRY(efi32_stub_entry)

	/* Relocate efi_config->call() */
	leal	efi32_config(%esi), %eax
	add	%esi, 88(%eax)
	add	%esi, 32(%eax)
	pushl	%eax
2:
	call	efi_main
@@ -264,7 +264,7 @@ relocated:
#ifdef CONFIG_EFI_STUB
	.data
efi32_config:
	.fill 11,8,0
	.fill 4,8,0
	.long efi_call_phys
	.long 0
	.byte 0
+4 −4
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ ENTRY(efi_pe_entry)
	/*
	 * Relocate efi_config->call().
	 */
	addq	%rbp, efi64_config+88(%rip)
	addq	%rbp, efi64_config+32(%rip)

	movq	%rax, %rdi
	call	make_boot_params
@@ -285,7 +285,7 @@ handover_entry:
	 * Relocate efi_config->call().
	 */
	movq	efi_config(%rip), %rax
	addq	%rbp, 88(%rax)
	addq	%rbp, 32(%rax)
2:
	movq	efi_config(%rip), %rdi
	call	efi_main
@@ -457,14 +457,14 @@ efi_config:
#ifdef CONFIG_EFI_MIXED
	.global efi32_config
efi32_config:
	.fill	11,8,0
	.fill	4,8,0
	.quad	efi64_thunk
	.byte	0
#endif

	.global efi64_config
efi64_config:
	.fill	11,8,0
	.fill	4,8,0
	.quad	efi_call
	.byte	1
#endif /* CONFIG_EFI_STUB */
+17 −12
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ extern int __init efi_memblock_x86_reserve_range(void);
extern pgd_t * __init efi_call_phys_prolog(void);
extern void __init efi_call_phys_epilog(pgd_t *save_pgd);
extern void __init efi_print_memmap(void);
extern void __init efi_unmap_memmap(void);
extern void __init efi_memory_uc(u64 addr, unsigned long size);
extern void __init efi_map_region(efi_memory_desc_t *md);
extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
@@ -192,14 +191,7 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
struct efi_config {
	u64 image_handle;
	u64 table;
	u64 allocate_pool;
	u64 allocate_pages;
	u64 get_memory_map;
	u64 free_pool;
	u64 free_pages;
	u64 locate_handle;
	u64 handle_protocol;
	u64 exit_boot_services;
	u64 boot_services;
	u64 text_output;
	efi_status_t (*call)(unsigned long, ...);
	bool is64;
@@ -207,14 +199,27 @@ struct efi_config {

__pure const struct efi_config *__efi_early(void);

static inline bool efi_is_64bit(void)
{
	if (!IS_ENABLED(CONFIG_X86_64))
		return false;

	if (!IS_ENABLED(CONFIG_EFI_MIXED))
		return true;

	return __efi_early()->is64;
}

#define efi_call_early(f, ...)						\
	__efi_early()->call(__efi_early()->f, __VA_ARGS__);
	__efi_early()->call(efi_is_64bit() ?				\
		((efi_boot_services_64_t *)(unsigned long)		\
			__efi_early()->boot_services)->f :		\
		((efi_boot_services_32_t *)(unsigned long)		\
			__efi_early()->boot_services)->f, __VA_ARGS__)

#define __efi_call_early(f, ...)					\
	__efi_early()->call((unsigned long)f, __VA_ARGS__);

#define efi_is_64bit()		__efi_early()->is64

extern bool efi_reboot_required(void);

#else
Loading