Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Dec 2017 20:46:13 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327048 - head/sys/arm/arm
Message-ID:  <201712202046.vBKKkD0N027723@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Wed Dec 20 20:46:12 2017
New Revision: 327048
URL: https://svnweb.freebsd.org/changeset/base/327048

Log:
  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.

Modified:
  head/sys/arm/arm/machdep.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Wed Dec 20 20:41:51 2017	(r327047)
+++ head/sys/arm/arm/machdep.c	Wed Dec 20 20:46:12 2017	(r327048)
@@ -1129,6 +1129,19 @@ initarm(struct arm_boot_params *abp)
 	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.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712202046.vBKKkD0N027723>