Restore the ability to use EARLY_PRINTF support during most of initarm().

The real kernel page tables are set up much earlier in initarm() now than
they were when early printf support was first added, and they end up undoing
the mapping made in locore.S for early printf support.  This re-adds the
mapping after switching to the new/real kernel page tables, making early
printf work again right after switching to them.
This commit is contained in:
ian 2017-12-20 20:46:12 +00:00
parent 231505e8c9
commit 3f841c9e89

View File

@ -1128,6 +1128,19 @@ initarm(struct arm_boot_params *abp)
pmap_set_tex();
pmap_bootstrap_prepare(lastaddr);
/*
* If EARLY_PRINTF support is enabled, we need to re-establish the
* mapping after pmap_bootstrap_prepare() switches to new page tables.
* Note that we can only do the remapping if the VA is outside the
* kernel, now that we have real virtual (not VA=PA) mappings in effect.
* Early printf does not work between the time pmap_set_tex() does
* cp15_prrr_set() and this code remaps the VA.
*/
#if defined(EARLY_PRINTF) && defined(SOCDEV_PA) && defined(SOCDEV_VA) && SOCDEV_VA < KERNBASE
pmap_preboot_map_attr(SOCDEV_PA, SOCDEV_VA, 1024 * 1024,
VM_PROT_READ | VM_PROT_WRITE, VM_MEMATTR_DEVICE);
#endif
/*
* Now that proper page tables are installed, call cpu_setup() to enable
* instruction and data caches and other chip-specific features.