* 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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWbuWUAAoJEC84WcCNIz1VJpcQAKqs09lCyZ3scgusZwk0MM4x
 fnDiJ9BW6GjWskY9AJzgcQLmb/pJJtbenQNIioVeeLEy93Vsn5+JCiJWs3BVC4o6
 T3caYbObL5gJiKoqxIsKemXIPJpzVzjlGrz1JWB9M6dQFj89y9pMa2Vx2/oNT40x
 sEp8MlNrgGm0Zy6wSZBBj/qk6tVYNQfaUoIYiCtyvTRFsyw1MA+mX47qLj/W9KSp
 9XYN6Cfy8EfKl0ioNxhD+JtH3MPqk6ao7TRfJQoL5RLMa5/hAnI6dUJnfoeWyGgI
 NpXmPCHcRQiLEbrpYXu2Rm5E5u244VuJaczmMKNvBHAdhAlpVD9airM7u8tedrzr
 DWe1uKSDr5sfyNHJHevFDuVOD2Uarut0YOZe69/hQN39aFSe8VoFtquGrBJpACwQ
 6zWB97t2u0ZlxNFUN/6wy+g3HxPItJZglGlAuzACqmtjtZ6jYyGu7d/QIPZ73CCK
 gyQFoedr6Gnm8wEgCTkEyVLssdSz9t1rchUR2s710hp9V/wptgzG+dorwJzDAzLb
 Q1xrH1wPZPqmfNL9Yn7RoEiSlz/Tk4y4i1jGsNuzEYxn0g4ElwYCJ/n8v1SEhIEk
 c4mUZLRJ4RssjQ5LqarVJE7bWvhhQLiiORNXiUeWFi8zoO0KU8lBXUiedfAunYwo
 /yzndz6k6sahdDTuhfa+
 =VYPl
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Thomas Gleixner 2015-12-19 21:24:52 +01:00
commit 98f9127690
6 changed files with 25 additions and 64 deletions

View File

@ -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

View File

@ -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);
image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
if (!image) {
image = early_ioremap(bgrt_tab->image_address,
sizeof(bmp_header));
ioremapped = true;
if (!image) {
pr_err("Ignoring BGRT: failed to map image header memory\n");
return;
}
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);
if (!image) {
pr_err("Ignoring BGRT: failed to map image memory\n");
kfree(bgrt_image);
bgrt_image = NULL;
return;
}
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);
}

View File

@ -15,6 +15,8 @@
*
*/
#define pr_fmt(fmt) "efi: " fmt
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mm.h>

View File

@ -1,3 +1,5 @@
#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();
}

View File

@ -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},

View File

@ -167,14 +167,11 @@ static struct kset *esrt_kset;
static int esre_create_sysfs_entry(void *esre, int entry_num)
{
struct esre_entry *entry;
char name[20];
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
sprintf(name, "entry%d", entry_num);
entry->kobj.kset = esrt_kset;
if (esrt->fw_resource_version == 1) {
@ -182,7 +179,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
entry->esre.esre1 = esre;
rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
"%s", name);
"entry%d", entry_num);
if (rc) {
kfree(entry);
return rc;