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

Commit f2001bd5 authored by Will Deacon's avatar Will Deacon
Browse files

Merge tag 'for-3.19' of git://git.linaro.org/people/ard.biesheuvel/linux-arm into ard/efi-for-3.19



Pull UEFI updates from Ard Biesheuvel:

  - fixes for compliance with PE/COFF and UEFI specs
  - added support for SMBIOS, including upcoming version 3.0
  - cleanups and diagnostic output improvements

Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parents cac7f242 0bcaa904
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -401,6 +401,17 @@ config EFI
	  allow the kernel to be booted as an EFI application. This
	  is only useful on systems that have UEFI firmware.

config DMI
	bool "Enable support for SMBIOS (DMI) tables"
	depends on EFI
	default y
	help
	  This enables SMBIOS/DMI feature for systems.

	  This option is only useful on systems that have UEFI firmware.
	  However, even with this option, the resultant kernel should
	  continue to boot on existing non-UEFI platforms.

endmenu

menu "Userspace binary formats"
+31 −0
Original line number Diff line number Diff line
/*
 * arch/arm64/include/asm/dmi.h
 *
 * Copyright (C) 2013 Linaro Limited.
 * Written by: Yi Li (yi.li@linaro.org)
 *
 * based on arch/ia64/include/asm/dmi.h
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */

#ifndef __ASM_DMI_H
#define __ASM_DMI_H

#include <linux/io.h>
#include <linux/slab.h>

/*
 * According to section 2.3.6 of the UEFI spec, the firmware should not
 * request a virtual mapping for configuration tables such as SMBIOS.
 * This means we have to map them before use.
 */
#define dmi_early_remap(x, l)		ioremap_cache(x, l)
#define dmi_early_unmap(x, l)		iounmap(x)
#define dmi_remap(x, l)			ioremap_cache(x, l)
#define dmi_unmap(x)			iounmap(x)
#define dmi_alloc(l)			kzalloc(l, GFP_KERNEL)

#endif
+2 −1
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ ENTRY(efi_stub_entry)
	 */
	mov	x20, x0		// DTB address
	ldr	x0, [sp, #16]	// relocated _text address
	mov	x21, x0
	ldr	x21, =stext_offset
	add	x21, x0, x21

	/*
	 * Flush dcache covering current runtime addresses
+25 −12
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
 *
 */

#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/export.h>
#include <linux/memblock.h>
@@ -112,8 +113,6 @@ static int __init uefi_init(void)
		efi.systab->hdr.revision & 0xffff, vendor);

	retval = efi_config_init(NULL);
	if (retval == 0)
		set_bit(EFI_CONFIG_TABLES, &efi.flags);

out:
	early_memunmap(efi.systab,  sizeof(efi_system_table_t));
@@ -125,17 +124,17 @@ static int __init uefi_init(void)
 */
static __init int is_reserve_region(efi_memory_desc_t *md)
{
	if (!is_normal_ram(md))
		return 0;

	if (md->attribute & EFI_MEMORY_RUNTIME)
		return 1;

	if (md->type == EFI_ACPI_RECLAIM_MEMORY ||
	    md->type == EFI_RESERVED_TYPE)
		return 1;

	switch (md->type) {
	case EFI_LOADER_CODE:
	case EFI_LOADER_DATA:
	case EFI_BOOT_SERVICES_CODE:
	case EFI_BOOT_SERVICES_DATA:
	case EFI_CONVENTIONAL_MEMORY:
		return 0;
	default:
		break;
	}
	return is_normal_ram(md);
}

static __init void reserve_regions(void)
@@ -471,3 +470,17 @@ static int __init arm64_enter_virtual_mode(void)
	return -1;
}
early_initcall(arm64_enter_virtual_mode);

static int __init arm64_dmi_init(void)
{
	/*
	 * On arm64, DMI depends on UEFI, and dmi_scan_machine() needs to
	 * be called early because dmi_id_init(), which is an arch_initcall
	 * itself, depends on dmi_scan_machine() having been called already.
	 */
	dmi_scan_machine();
	if (dmi_available)
		dmi_set_dump_stack_arch_desc();
	return 0;
}
core_initcall(arm64_dmi_init);
+17 −7
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ efi_head:
#endif

#ifdef CONFIG_EFI
	.globl	stext_offset
	.set	stext_offset, stext - efi_head
	.align 3
pe_header:
	.ascii	"PE"
@@ -155,12 +157,12 @@ optional_header:
	.long	0				// SizeOfInitializedData
	.long	0				// SizeOfUninitializedData
	.long	efi_stub_entry - efi_head	// AddressOfEntryPoint
	.long	stext - efi_head		// BaseOfCode
	.long	stext_offset			// BaseOfCode

extra_header_fields:
	.quad	0				// ImageBase
	.long	0x20				// SectionAlignment
	.long	0x8				// FileAlignment
	.long	0x1000				// SectionAlignment
	.long	PECOFF_FILE_ALIGNMENT		// FileAlignment
	.short	0				// MajorOperatingSystemVersion
	.short	0				// MinorOperatingSystemVersion
	.short	0				// MajorImageVersion
@@ -172,7 +174,7 @@ extra_header_fields:
	.long	_end - efi_head			// SizeOfImage

	// Everything before the kernel image is considered part of the header
	.long	stext - efi_head		// SizeOfHeaders
	.long	stext_offset			// SizeOfHeaders
	.long	0				// CheckSum
	.short	0xa				// Subsystem (EFI application)
	.short	0				// DllCharacteristics
@@ -217,16 +219,24 @@ section_table:
	.byte	0
	.byte	0        		// end of 0 padding of section name
	.long	_end - stext		// VirtualSize
	.long	stext - efi_head	// VirtualAddress
	.long	stext_offset		// VirtualAddress
	.long	_edata - stext		// SizeOfRawData
	.long	stext - efi_head	// PointerToRawData
	.long	stext_offset		// PointerToRawData

	.long	0		// PointerToRelocations (0 for executables)
	.long	0		// PointerToLineNumbers (0 for executables)
	.short	0		// NumberOfRelocations  (0 for executables)
	.short	0		// NumberOfLineNumbers  (0 for executables)
	.long	0xe0500020	// Characteristics (section flags)
	.align 5

	/*
	 * EFI will load stext onwards at the 4k section alignment
	 * described in the PE/COFF header. To ensure that instruction
	 * sequences using an adrp and a :lo12: immediate will function
	 * correctly at this alignment, we must ensure that stext is
	 * placed at a 4k boundary in the Image to begin with.
	 */
	.align 12
#endif

ENTRY(stext)
Loading