1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

efi_loader: memory reservation for fdt

In copy_fdt() we allocate EFI pages for the fdt plus extra 12 KiB as
EFI_RUNTIME_SERVICES_DATA. Afterwards in efi_install_fdt() we overwrite
part of this memory allocation by marking it as EFI_BOOT_SERVICES_DATA.

Remove the code marking the fdt as EFI_BOOT_SERVICES_DATA.

Cf. commit 17ff6f02f5 ("efi_loader: store DT in EFI_RUNTIME_SERVICES_DATA
memory")

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Heinrich Schuchardt
2018-11-12 18:55:22 +01:00
committed by Alexander Graf
parent c966076cb5
commit 4574d1b3d1

View File

@@ -152,12 +152,11 @@ static void set_load_options(struct efi_loaded_image *loaded_image_info,
* An additional 12KB is added to the space in case the device tree needs to be * An additional 12KB is added to the space in case the device tree needs to be
* expanded later with fdt_open_into(). * expanded later with fdt_open_into().
* *
* @fdt_addr: On entry, address of start of FDT. On exit, address of relocated * @fdt_addr: On entry, address of start of FDT. On exit, address of relocated
* FDT start * FDT start
* @fdt_sizep: Returns new size of FDT, including * Return: status code
* @return new relocated address of FDT
*/ */
static efi_status_t copy_fdt(ulong *fdt_addrp, ulong *fdt_sizep) static efi_status_t copy_fdt(ulong *fdt_addrp)
{ {
unsigned long fdt_ram_start = -1L, fdt_pages; unsigned long fdt_ram_start = -1L, fdt_pages;
efi_status_t ret = 0; efi_status_t ret = 0;
@@ -209,7 +208,6 @@ static efi_status_t copy_fdt(ulong *fdt_addrp, ulong *fdt_sizep)
fdt_set_totalsize(new_fdt, fdt_size); fdt_set_totalsize(new_fdt, fdt_size);
*fdt_addrp = new_fdt_addr; *fdt_addrp = new_fdt_addr;
*fdt_sizep = fdt_size;
done: done:
return ret; return ret;
} }
@@ -287,7 +285,6 @@ static void efi_carve_out_dt_rsv(void *fdt)
static efi_status_t efi_install_fdt(ulong fdt_addr) static efi_status_t efi_install_fdt(ulong fdt_addr)
{ {
bootm_headers_t img = { 0 }; bootm_headers_t img = { 0 };
ulong fdt_pages, fdt_size, fdt_start;
efi_status_t ret; efi_status_t ret;
void *fdt; void *fdt;
@@ -298,13 +295,12 @@ static efi_status_t efi_install_fdt(ulong fdt_addr)
} }
/* Prepare fdt for payload */ /* Prepare fdt for payload */
ret = copy_fdt(&fdt_addr, &fdt_size); ret = copy_fdt(&fdt_addr);
if (ret) if (ret)
return ret; return ret;
unmap_sysmem(fdt); unmap_sysmem(fdt);
fdt = map_sysmem(fdt_addr, 0); fdt = map_sysmem(fdt_addr, 0);
fdt_size = fdt_totalsize(fdt);
if (image_setup_libfdt(&img, fdt, 0, NULL)) { if (image_setup_libfdt(&img, fdt, 0, NULL)) {
printf("ERROR: failed to process device tree\n"); printf("ERROR: failed to process device tree\n");
return EFI_LOAD_ERROR; return EFI_LOAD_ERROR;
@@ -317,13 +313,6 @@ static efi_status_t efi_install_fdt(ulong fdt_addr)
if (ret != EFI_SUCCESS) if (ret != EFI_SUCCESS)
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
/* And reserve the space in the memory map */
fdt_start = fdt_addr;
fdt_pages = fdt_size >> EFI_PAGE_SHIFT;
ret = efi_add_memory_map(fdt_start, fdt_pages,
EFI_BOOT_SERVICES_DATA, true);
return ret; return ret;
} }