Commit 3b2e4b4c authored by Ard Biesheuvel's avatar Ard Biesheuvel

efi/arm: Move FDT specific definitions into fdtparams.c

Push the FDT params specific types and definition into fdtparams.c,
and instead, pass a reference to the memory map data structure and
populate it directly, and return the system table address as the
return value.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent ac5abc70
......@@ -205,17 +205,13 @@ static __init void reserve_regions(void)
void __init efi_init(void)
{
struct efi_memory_map_data data;
struct efi_fdt_params params;
u64 efi_system_table;
/* Grab UEFI information placed in FDT by stub */
if (!efi_get_fdt_params(&params))
efi_system_table = efi_get_fdt_params(&data);
if (!efi_system_table)
return;
data.desc_version = params.desc_ver;
data.desc_size = params.desc_size;
data.size = params.mmap_size;
data.phys_map = params.mmap;
if (efi_memmap_init_early(&data) < 0) {
/*
* If we are booting via UEFI, the UEFI memory map is the only
......@@ -229,7 +225,7 @@ void __init efi_init(void)
"Unexpected EFI_MEMORY_DESCRIPTOR version %ld",
efi.memmap.desc_version);
if (uefi_init(params.system_table) < 0) {
if (uefi_init(efi_system_table) < 0) {
efi_memmap_unmap();
return;
}
......@@ -237,9 +233,8 @@ void __init efi_init(void)
reserve_regions();
efi_esrt_init();
memblock_reserve(params.mmap & PAGE_MASK,
PAGE_ALIGN(params.mmap_size +
(params.mmap & ~PAGE_MASK)));
memblock_reserve(data.phys_map & PAGE_MASK,
PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK)));
init_screen_info();
......
......@@ -18,6 +18,14 @@
sizeof_field(struct efi_fdt_params, field) \
}
struct efi_fdt_params {
u64 system_table;
u64 mmap;
u32 mmap_size;
u32 desc_size;
u32 desc_ver;
};
struct params {
const char name[32];
const char propname[32];
......@@ -121,22 +129,30 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname,
return 0;
}
int __init efi_get_fdt_params(struct efi_fdt_params *params)
u64 __init efi_get_fdt_params(struct efi_memory_map_data *memmap)
{
struct efi_fdt_params params;
struct param_info info;
int ret;
pr_info("Getting EFI parameters from FDT:\n");
info.found = 0;
info.params = params;
info.params = &params;
ret = of_scan_flat_dt(fdt_find_uefi_params, &info);
if (!info.found)
if (!info.found) {
pr_info("UEFI not found.\n");
else if (!ret)
pr_err("Can't find '%s' in device tree!\n",
info.missing);
return 0;
} else if (!ret) {
pr_err("Can't find '%s' in device tree!\n", info.missing);
return 0;
}
memmap->desc_version = params.desc_ver;
memmap->desc_size = params.desc_size;
memmap->size = params.mmap_size;
memmap->phys_map = params.mmap;
return ret;
return params.system_table;
}
......@@ -477,14 +477,6 @@ struct efi_mem_range {
u64 attribute;
};
struct efi_fdt_params {
u64 system_table;
u64 mmap;
u32 mmap_size;
u32 desc_size;
u32 desc_ver;
};
typedef struct {
u32 version;
u32 length;
......@@ -631,7 +623,7 @@ extern void efi_mem_reserve(phys_addr_t addr, u64 size);
extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size);
extern void efi_initialize_iomem_resources(struct resource *code_resource,
struct resource *data_resource, struct resource *bss_resource);
extern int efi_get_fdt_params(struct efi_fdt_params *params);
extern u64 efi_get_fdt_params(struct efi_memory_map_data *data);
extern struct kobject *efi_kobj;
extern int efi_reboot_quirk_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment