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 Lepore 2017-12-20 20:46:12 +00:00
parent 5d83601f1f
commit df1e0a51ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327048

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.