efi_loader: update virtual address in efi_mem_carve_out
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 11 Apr 2019 18:08:54 +0000 (20:08 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 12 Apr 2019 20:00:42 +0000 (22:00 +0200)
Handle virtual address in efi_mem_carve_out() function
when a new region is created to avoid issue in EFI memory map.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
At boottime physical and virtual addressed have to be the same.
This allowed to simplify the proposed logic.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_memory.c

index dbe29b89603e4898abef1a72b842964f3e56c3f2..46681dc2082b120edd4f4c160eac3cb25f323f54 100644 (file)
@@ -193,6 +193,7 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
                        free(map);
                } else {
                        map->desc.physical_start = carve_end;
+                       map->desc.virtual_start = carve_end;
                        map->desc.num_pages = (map_end - carve_end)
                                              >> EFI_PAGE_SHIFT;
                }
@@ -211,6 +212,7 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
        newmap = calloc(1, sizeof(*newmap));
        newmap->desc = map->desc;
        newmap->desc.physical_start = carve_start;
+       newmap->desc.virtual_start = carve_start;
        newmap->desc.num_pages = (map_end - carve_start) >> EFI_PAGE_SHIFT;
        /* Insert before current entry (descending address order) */
        list_add_tail(&newmap->link, &map->link);