Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98f91276 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

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

Pull efi changes from Matt Fleming:

 * We don't need to carry our own formatting code in the esrt driver
   because the kobject API can do that for us - Rasmus Villemoes

 * Update the arm64 file paths in Documentation/efi-stub.txt to match
   the current tree - Alan Ott

 * Consistently preface all print statements with "efi" arch/x86 so
   that it's more obvious to users reporting problems which statements
   in the kernel log are relevant for EFI - Matt Fleming

 * Fix a boot crash in the ACPI BGRT driver and delete
   efi_lookup_mapped_addr() since it's useless now that the EFI
   mappings *only* exist in the 'efi_pgd' page table. Instead we
   always early_memremap() the BGRT memory - Sai Praneeth Prakhya
parents ff3d0a12 50a0cb56
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -10,12 +10,12 @@ arch/x86/boot/header.S and arch/x86/boot/compressed/eboot.c,
respectively. For ARM the EFI stub is implemented in
arch/arm/boot/compressed/efi-header.S and
arch/arm/boot/compressed/efi-stub.c. EFI stub code that is shared
between architectures is in drivers/firmware/efi/efi-stub-helper.c.
between architectures is in drivers/firmware/efi/libstub.

For arm64, there is no compressed kernel support, so the Image itself
masquerades as a PE/COFF image and the EFI stub is linked into the
kernel. The arm64 EFI stub lives in arch/arm64/kernel/efi-entry.S
and arch/arm64/kernel/efi-stub.c.
and drivers/firmware/efi/libstub/arm64-stub.c.

By using the EFI boot stub it's possible to boot a Linux kernel
without the use of a conventional EFI boot loader, such as grub or
+17 −25
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/acpi.h>
@@ -28,8 +31,7 @@ struct bmp_header {
void __init efi_bgrt_init(void)
{
	acpi_status status;
	void __iomem *image;
	bool ioremapped = false;
	void *image;
	struct bmp_header bmp_header;

	if (acpi_disabled)
@@ -70,20 +72,14 @@ void __init efi_bgrt_init(void)
		return;
	}

	image = efi_lookup_mapped_addr(bgrt_tab->image_address);
	if (!image) {
		image = early_ioremap(bgrt_tab->image_address,
				       sizeof(bmp_header));
		ioremapped = true;
	image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
	if (!image) {
		pr_err("Ignoring BGRT: failed to map image header memory\n");
		return;
	}
	}

	memcpy_fromio(&bmp_header, image, sizeof(bmp_header));
	if (ioremapped)
		early_iounmap(image, sizeof(bmp_header));
	memcpy(&bmp_header, image, sizeof(bmp_header));
	early_memunmap(image, sizeof(bmp_header));
	bgrt_image_size = bmp_header.size;

	bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@@ -93,18 +89,14 @@ void __init efi_bgrt_init(void)
		return;
	}

	if (ioremapped) {
		image = early_ioremap(bgrt_tab->image_address,
				       bmp_header.size);
	image = early_memremap(bgrt_tab->image_address, bmp_header.size);
	if (!image) {
		pr_err("Ignoring BGRT: failed to map image memory\n");
		kfree(bgrt_image);
		bgrt_image = NULL;
		return;
	}
	}

	memcpy_fromio(bgrt_image, image, bgrt_image_size);
	if (ioremapped)
		early_iounmap(image, bmp_header.size);
	memcpy(bgrt_image, image, bgrt_image_size);
	early_memunmap(image, bmp_header.size);
}
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 *
 */

#define pr_fmt(fmt) "efi: " fmt

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mm.h>
+3 −1
Original line number Diff line number Diff line
#define pr_fmt(fmt) "efi: " fmt

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
@@ -256,7 +258,7 @@ void __init efi_apply_memmap_quirks(void)
	 * services.
	 */
	if (!efi_runtime_supported()) {
		pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
		pr_info("Setup done, disabling due to 32/64-bit mismatch\n");
		efi_unmap_memmap();
	}

+0 −32
Original line number Diff line number Diff line
@@ -324,38 +324,6 @@ u64 __init efi_mem_desc_end(efi_memory_desc_t *md)
	return end;
}

/*
 * We can't ioremap data in EFI boot services RAM, because we've already mapped
 * it as RAM.  So, look it up in the existing EFI memory map instead.  Only
 * callable after efi_enter_virtual_mode and before efi_free_boot_services.
 */
void __iomem *efi_lookup_mapped_addr(u64 phys_addr)
{
	struct efi_memory_map *map;
	void *p;
	map = efi.memmap;
	if (!map)
		return NULL;
	if (WARN_ON(!map->map))
		return NULL;
	for (p = map->map; p < map->map_end; p += map->desc_size) {
		efi_memory_desc_t *md = p;
		u64 size = md->num_pages << EFI_PAGE_SHIFT;
		u64 end = md->phys_addr + size;
		if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
		    md->type != EFI_BOOT_SERVICES_CODE &&
		    md->type != EFI_BOOT_SERVICES_DATA)
			continue;
		if (!md->virt_addr)
			continue;
		if (phys_addr >= md->phys_addr && phys_addr < end) {
			phys_addr += md->virt_addr - md->phys_addr;
			return (__force void __iomem *)(unsigned long)phys_addr;
		}
	}
	return NULL;
}

static __initdata efi_config_table_type_t common_tables[] = {
	{ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20},
	{ACPI_TABLE_GUID, "ACPI", &efi.acpi},
Loading