Unverified Commit b91540d5 authored by Atish Patra's avatar Atish Patra Committed by Palmer Dabbelt
Browse files

RISC-V: Add EFI runtime services



This patch adds EFI runtime service support for RISC-V.

Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
[ardb: - Remove the page check]
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent d7071743
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -412,7 +412,9 @@ config EFI
	select EFI_PARAMS_FROM_FDT
	select EFI_STUB
	select EFI_GENERIC_STUB
	select EFI_RUNTIME_WRAPPERS
	select RISCV_ISA_C
	depends on MMU
	default y
	help
	  This option provides support for runtime services provided
+20 −0
Original line number Diff line number Diff line
@@ -5,11 +5,28 @@
#ifndef _ASM_EFI_H
#define _ASM_EFI_H

#include <asm/csr.h>
#include <asm/io.h>
#include <asm/mmu_context.h>
#include <asm/ptrace.h>
#include <asm/tlbflush.h>

#ifdef CONFIG_EFI
extern void efi_init(void);
#else
#define efi_init()
#endif

int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);

#define arch_efi_call_virt_setup()      efi_virtmap_load()
#define arch_efi_call_virt_teardown()   efi_virtmap_unload()

#define arch_efi_call_virt(p, f, args...) p->f(args)

#define ARCH_EFI_IRQ_FLAGS_MASK (SR_IE | SR_SPIE)

/* on RISC-V, the FDT may be located anywhere in system RAM */
static inline unsigned long efi_get_max_fdt_addr(unsigned long image_addr)
{
@@ -32,4 +49,7 @@ static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
{
}

void efi_virtmap_load(void);
void efi_virtmap_unload(void);

#endif /* _ASM_EFI_H */
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ typedef struct {
#endif
} mm_context_t;

void __init create_pgd_mapping(pgd_t *pgdp, uintptr_t va, phys_addr_t pa,
			       phys_addr_t sz, pgprot_t prot);
#endif /* __ASSEMBLY__ */

#endif /* _ASM_RISCV_MMU_H */
+4 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@

#define PAGE_KERNEL		__pgprot(_PAGE_KERNEL)
#define PAGE_KERNEL_EXEC	__pgprot(_PAGE_KERNEL | _PAGE_EXEC)
#define PAGE_KERNEL_READ	__pgprot(_PAGE_KERNEL & ~_PAGE_WRITE)
#define PAGE_KERNEL_EXEC	__pgprot(_PAGE_KERNEL | _PAGE_EXEC)
#define PAGE_KERNEL_READ_EXEC	__pgprot((_PAGE_KERNEL & ~_PAGE_WRITE) \
					 | _PAGE_EXEC)

#define PAGE_TABLE		__pgprot(_PAGE_TABLE)

+2 −0
Original line number Diff line number Diff line
@@ -55,4 +55,6 @@ obj-$(CONFIG_KGDB) += kgdb.o

obj-$(CONFIG_JUMP_LABEL)	+= jump_label.o

obj-$(CONFIG_EFI)		+= efi.o

clean:
Loading