Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Sep 2012 02:02:00 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240845 - in head/sys/arm: broadcom/bcm2835 lpc tegra ti
Message-ID:  <201209230202.q8N220e4089058@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sun Sep 23 02:01:59 2012
New Revision: 240845
URL: http://svn.freebsd.org/changeset/base/240845

Log:
  Update different versions of physmap_init to be identical in preparation
  for merging them.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/lpc/lpc_machdep.c
  head/sys/arm/tegra/tegra2_machdep.c
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c	Sat Sep 22 22:41:38 2012	(r240844)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c	Sun Sep 23 02:01:59 2012	(r240845)
@@ -281,9 +281,19 @@ physmap_init(void)
 		    availmem_regions[i].mr_start + availmem_regions[i].mr_size,
 		    availmem_regions[i].mr_size);
 
-		phys_avail[j] = availmem_regions[i].mr_start;
-		phys_avail[j + 1] = availmem_regions[i].mr_start +
-		    availmem_regions[i].mr_size;
+		/*
+		 * We should not map the page at PA 0x0000000, the VM can't
+		 * handle it, as pmap_extract() == 0 means failure.
+		 */
+		if (availmem_regions[i].mr_start > 0 ||
+		    availmem_regions[i].mr_size > PAGE_SIZE) {
+			phys_avail[j] = availmem_regions[i].mr_start;
+			if (phys_avail[j] == 0)
+				phys_avail[j] += PAGE_SIZE;
+			phys_avail[j + 1] = availmem_regions[i].mr_start +
+			    availmem_regions[i].mr_size;
+		} else
+			j -= 2;
 	}
 	phys_avail[j] = 0;
 	phys_avail[j + 1] = 0;

Modified: head/sys/arm/lpc/lpc_machdep.c
==============================================================================
--- head/sys/arm/lpc/lpc_machdep.c	Sat Sep 22 22:41:38 2012	(r240844)
+++ head/sys/arm/lpc/lpc_machdep.c	Sun Sep 23 02:01:59 2012	(r240845)
@@ -282,9 +282,19 @@ physmap_init(void)
 		    availmem_regions[i].mr_start + availmem_regions[i].mr_size,
 		    availmem_regions[i].mr_size);
 
-		phys_avail[j] = availmem_regions[i].mr_start;
-		phys_avail[j + 1] = availmem_regions[i].mr_start +
-		    availmem_regions[i].mr_size;
+		/*
+		 * We should not map the page at PA 0x0000000, the VM can't
+		 * handle it, as pmap_extract() == 0 means failure.
+		 */
+		if (availmem_regions[i].mr_start > 0 ||
+		    availmem_regions[i].mr_size > PAGE_SIZE) {
+			phys_avail[j] = availmem_regions[i].mr_start;
+			if (phys_avail[j] == 0)
+				phys_avail[j] += PAGE_SIZE;
+			phys_avail[j + 1] = availmem_regions[i].mr_start +
+			    availmem_regions[i].mr_size;
+		} else
+			j -= 2;
 	}
 	phys_avail[j] = 0;
 	phys_avail[j + 1] = 0;

Modified: head/sys/arm/tegra/tegra2_machdep.c
==============================================================================
--- head/sys/arm/tegra/tegra2_machdep.c	Sat Sep 22 22:41:38 2012	(r240844)
+++ head/sys/arm/tegra/tegra2_machdep.c	Sun Sep 23 02:01:59 2012	(r240845)
@@ -273,9 +273,19 @@ physmap_init(void)
 		    availmem_regions[i].mr_start + availmem_regions[i].mr_size,
 		    availmem_regions[i].mr_size);
 
-		phys_avail[j] = availmem_regions[i].mr_start;
-		phys_avail[j + 1] = availmem_regions[i].mr_start +
-		    availmem_regions[i].mr_size;
+		/*
+		 * We should not map the page at PA 0x0000000, the VM can't
+		 * handle it, as pmap_extract() == 0 means failure.
+		 */
+		if (availmem_regions[i].mr_start > 0 ||
+		    availmem_regions[i].mr_size > PAGE_SIZE) {
+			phys_avail[j] = availmem_regions[i].mr_start;
+			if (phys_avail[j] == 0)
+				phys_avail[j] += PAGE_SIZE;
+			phys_avail[j + 1] = availmem_regions[i].mr_start +
+			    availmem_regions[i].mr_size;
+		} else
+			j -= 2;
 	}
 	phys_avail[j] = 0;
 	phys_avail[j + 1] = 0;

Modified: head/sys/arm/ti/ti_machdep.c
==============================================================================
--- head/sys/arm/ti/ti_machdep.c	Sat Sep 22 22:41:38 2012	(r240844)
+++ head/sys/arm/ti/ti_machdep.c	Sun Sep 23 02:01:59 2012	(r240845)
@@ -205,7 +205,6 @@ physmap_init(void)
 
 	phys_kernelend = KERNPHYSADDR + (virtual_avail - KERNVIRTADDR);
 	kernload = KERNPHYSADDR;
-	ti_cpu_reset = NULL;
 
 	/*
 	 * Remove kernel physical address range from avail
@@ -282,9 +281,19 @@ physmap_init(void)
 		    availmem_regions[i].mr_start + availmem_regions[i].mr_size,
 		    availmem_regions[i].mr_size);
 
-		phys_avail[j] = availmem_regions[i].mr_start;
-		phys_avail[j + 1] = availmem_regions[i].mr_start +
-		    availmem_regions[i].mr_size;
+		/*
+		 * We should not map the page at PA 0x0000000, the VM can't
+		 * handle it, as pmap_extract() == 0 means failure.
+		 */
+		if (availmem_regions[i].mr_start > 0 ||
+		    availmem_regions[i].mr_size > PAGE_SIZE) {
+			phys_avail[j] = availmem_regions[i].mr_start;
+			if (phys_avail[j] == 0)
+				phys_avail[j] += PAGE_SIZE;
+			phys_avail[j + 1] = availmem_regions[i].mr_start +
+			    availmem_regions[i].mr_size;
+		} else
+			j -= 2;
 	}
 	phys_avail[j] = 0;
 	phys_avail[j + 1] = 0;
@@ -336,6 +345,7 @@ initarm(struct arm_boot_params *abp)
 
 	/* Platform-specific initialisation */
 	pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE;
+	ti_cpu_reset = NULL;
 
 	pcpu0_init();
 



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