2022-05-31 18:04:11 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
|
|
|
|
*/
|
|
|
|
#ifndef _ASM_LOONGARCH_EFI_H
|
|
|
|
#define _ASM_LOONGARCH_EFI_H
|
|
|
|
|
|
|
|
#include <linux/efi.h>
|
|
|
|
|
|
|
|
void __init efi_init(void);
|
|
|
|
void __init efi_runtime_init(void);
|
2022-12-10 22:40:05 +08:00
|
|
|
void __init *efi_fdt_pointer(void);
|
2022-05-31 18:04:11 +08:00
|
|
|
void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
|
|
|
|
|
|
|
|
#define ARCH_EFI_IRQ_FLAGS_MASK 0x00000004 /* Bit 2: CSR.CRMD.IE */
|
|
|
|
|
2022-06-28 15:18:21 +01:00
|
|
|
#define arch_efi_call_virt_setup()
|
|
|
|
#define arch_efi_call_virt_teardown()
|
2022-05-31 18:04:11 +08:00
|
|
|
|
|
|
|
#define EFI_ALLOC_ALIGN SZ_64K
|
efi/loongarch: Add efistub booting support
This patch adds efistub booting support, which is the standard UEFI boot
protocol for LoongArch to use.
We use generic efistub, which means we can pass boot information (i.e.,
system table, memory map, kernel command line, initrd) via a light FDT
and drop a lot of non-standard code.
We use a flat mapping to map the efi runtime in the kernel's address
space. In efi, VA = PA; in kernel, VA = PA + PAGE_OFFSET. As a result,
flat mapping is not identity mapping, SetVirtualAddressMap() is still
needed for the efi runtime.
Tested-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
[ardb: change fpic to fpie as suggested by Xi Ruoyao]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2022-08-19 18:20:37 +08:00
|
|
|
#define EFI_RT_VIRTUAL_OFFSET CSR_DMW0_BASE
|
2022-05-31 18:04:11 +08:00
|
|
|
|
|
|
|
static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
|
|
|
|
{
|
|
|
|
return ULONG_MAX;
|
|
|
|
}
|
|
|
|
|
2022-10-12 14:57:32 +02:00
|
|
|
static inline unsigned long efi_get_kimg_min_align(void)
|
|
|
|
{
|
|
|
|
return SZ_2M;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EFI_KIMG_PREFERRED_ADDRESS PHYSADDR(VMLINUX_LOAD_ADDRESS)
|
|
|
|
|
2022-05-31 18:04:11 +08:00
|
|
|
#endif /* _ASM_LOONGARCH_EFI_H */
|