]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ppc: qemu: Delete the temporary FDT virtual-physical mapping after U-Boot is relocated
authorBin Meng <bmeng.cn@gmail.com>
Thu, 25 Feb 2021 09:22:55 +0000 (17:22 +0800)
committerPriyanka Jain <priyanka.jain@nxp.com>
Fri, 5 Mar 2021 04:55:44 +0000 (10:25 +0530)
After U-Boot is relocated to RAM already, the previous temporary FDT
virtual-physical mapping that was used in the pre-relocation phase
is no longer needed. Let's delete the mapping.

get_fdt_virt() might be used before and after relocation, update it
to return different virtual address of FDT.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
board/freescale/qemu-ppce500/qemu-ppce500.c

index 9c30c12d4f92cfdb21fa1e87c38eae0518d1fc81..480776a21d1a110f0aa53d8220bcf72db606d7bc 100644 (file)
@@ -31,7 +31,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void *get_fdt_virt(void)
 {
-       return (void *)CONFIG_SYS_TMPVIRT;
+       if (gd->flags & GD_FLG_RELOC)
+               return (void *)gd->fdt_blob;
+       else
+               return (void *)CONFIG_SYS_TMPVIRT;
 }
 
 static uint64_t get_fdt_phys(void)
@@ -138,6 +141,12 @@ int misc_init_r(void)
         */
        virtio_init();
 
+       /*
+        * U-Boot is relocated to RAM already, let's delete the temporary FDT
+        * virtual-physical mapping that was used in the pre-relocation phase.
+        */
+       disable_tlb(find_tlb_idx((void *)CONFIG_SYS_TMPVIRT, 1));
+
        return 0;
 }