-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: wire up UEFI init and runtime support
This adds support to the kernel proper for booting via UEFI. It shares most of the code with arm64, so this patch mostly just wires it up for use with ARM. Note that this does not include the EFI stub, it is added in a subsequent patch. Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
- Loading branch information
Ard Biesheuvel
committed
Dec 13, 2015
1 parent
09414d0
commit da58fb6
Showing
6 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#ifndef __ASM_ARM_EFI_H | ||
#define __ASM_ARM_EFI_H | ||
|
||
#include <asm/cacheflush.h> | ||
#include <asm/cachetype.h> | ||
#include <asm/early_ioremap.h> | ||
#include <asm/fixmap.h> | ||
#include <asm/highmem.h> | ||
#include <asm/mach/map.h> | ||
#include <asm/mmu_context.h> | ||
#include <asm/pgtable.h> | ||
|
||
#ifdef CONFIG_EFI | ||
void efi_init(void); | ||
|
||
int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md); | ||
|
||
#define efi_call_virt(f, ...) \ | ||
({ \ | ||
efi_##f##_t *__f; \ | ||
efi_status_t __s; \ | ||
\ | ||
efi_virtmap_load(); \ | ||
__f = efi.systab->runtime->f; \ | ||
__s = __f(__VA_ARGS__); \ | ||
efi_virtmap_unload(); \ | ||
__s; \ | ||
}) | ||
|
||
#define __efi_call_virt(f, ...) \ | ||
({ \ | ||
efi_##f##_t *__f; \ | ||
\ | ||
efi_virtmap_load(); \ | ||
__f = efi.systab->runtime->f; \ | ||
__f(__VA_ARGS__); \ | ||
efi_virtmap_unload(); \ | ||
}) | ||
|
||
static inline void efi_set_pgd(struct mm_struct *mm) | ||
{ | ||
check_and_switch_context(mm, NULL); | ||
} | ||
|
||
void efi_virtmap_load(void); | ||
void efi_virtmap_unload(void); | ||
|
||
#else | ||
#define efi_init() | ||
#endif /* CONFIG_EFI */ | ||
|
||
#endif /* _ASM_ARM_EFI_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/efi.h> | ||
#include <asm/efi.h> | ||
#include <asm/mach/map.h> | ||
#include <asm/mmu_context.h> | ||
|
||
int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) | ||
{ | ||
struct map_desc desc = { | ||
.virtual = md->virt_addr, | ||
.pfn = __phys_to_pfn(md->phys_addr), | ||
.length = md->num_pages * EFI_PAGE_SIZE, | ||
}; | ||
|
||
/* | ||
* Order is important here: memory regions may have all of the | ||
* bits below set (and usually do), so we check them in order of | ||
* preference. | ||
*/ | ||
if (md->attribute & EFI_MEMORY_WB) | ||
desc.type = MT_MEMORY_RWX; | ||
else if (md->attribute & EFI_MEMORY_WT) | ||
desc.type = MT_MEMORY_RWX_NONCACHED; | ||
else if (md->attribute & EFI_MEMORY_WC) | ||
desc.type = MT_DEVICE_WC; | ||
else | ||
desc.type = MT_DEVICE; | ||
|
||
create_mapping_late(mm, &desc, true); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters