summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/kernel/efi.c
diff options
context:
space:
mode:
authorBinbin Zhou <zhoubinbin@loongson.cn>2022-12-10 15:40:05 +0100
committerHuacai Chen <chenhuacai@loongson.cn>2022-12-14 01:41:53 +0100
commit88d4d957edc707e037449ef71a58c6530a39d01e (patch)
treeac4ac6210684cfd8162eb850f1f46f63e8208d8c /arch/loongarch/kernel/efi.c
parentLoongArch: Use alternative to optimize libraries (diff)
downloadlinux-88d4d957edc707e037449ef71a58c6530a39d01e.tar.xz
linux-88d4d957edc707e037449ef71a58c6530a39d01e.zip
LoongArch: Add FDT booting support from efi system table
Since commit 40cd01a9c324("efi/loongarch: libstub: remove dependency on flattened DT"), we can parse the FDT from efi system table. And now, LoongArch is coming to support booting with FDT, so we add the relevant booting support as well as parameter parsing. Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/efi.c')
-rw-r--r--arch/loongarch/kernel/efi.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index a31329971133..ea485b0e1e7f 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -28,16 +28,29 @@ static unsigned long efi_nr_tables;
static unsigned long efi_config_table;
static unsigned long __initdata boot_memmap = EFI_INVALID_TABLE_ADDR;
+static unsigned long __initdata fdt_pointer = EFI_INVALID_TABLE_ADDR;
static efi_system_table_t *efi_systab;
static efi_config_table_type_t arch_tables[] __initdata = {
{LINUX_EFI_BOOT_MEMMAP_GUID, &boot_memmap, "MEMMAP" },
+ {DEVICE_TREE_GUID, &fdt_pointer, "FDTPTR" },
{},
};
+void __init *efi_fdt_pointer(void)
+{
+ if (!efi_systab)
+ return NULL;
+
+ if (fdt_pointer == EFI_INVALID_TABLE_ADDR)
+ return NULL;
+
+ return early_memremap_ro(fdt_pointer, SZ_64K);
+}
+
void __init efi_runtime_init(void)
{
- if (!efi_enabled(EFI_BOOT))
+ if (!efi_enabled(EFI_BOOT) || !efi_systab->runtime)
return;
if (efi_runtime_disabled()) {