Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Nov 2008 16:25:12 +0000 (UTC)
From:      Rafal Jaworowski <raj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184729 - head/sys/arm/mv
Message-ID:  <200811061625.mA6GPCRg060046@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: raj
Date: Thu Nov  6 16:25:12 2008
New Revision: 184729
URL: http://svn.freebsd.org/changeset/base/184729

Log:
  Auto-size kernel page tables allocation on Marvell systems.
  
  This allows mini dumps to fully work for these platforms.
  
  Obtained from:	Juniper Networks, Semihalf

Modified:
  head/sys/arm/mv/mv_machdep.c

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c	Thu Nov  6 16:20:27 2008	(r184728)
+++ head/sys/arm/mv/mv_machdep.c	Thu Nov  6 16:25:12 2008	(r184729)
@@ -93,9 +93,6 @@ __FBSDID("$FreeBSD$");
 #define debugf(fmt, args...)
 #endif
 
-#define KERNEL_PT_SYS	0	/* Page table for mapping proc0 zero page */
-#define KERNEL_PT_KERN	1
-
 /*
  * This is the number of L2 page tables required for covering max
  * (hypothetical) memsize of 4GB and all kernel mappings (vectors, msgbuf,
@@ -366,7 +363,7 @@ initarm(void *mdp, void *unused __unused
 	struct bi_mem_region *mr;
 	void *kmdp;
 	u_int l1pagetable;
-	int i = 0;
+	int i = 0, j = 0;
 
 	kmdp = NULL;
 	lastaddr = 0;
@@ -465,13 +462,14 @@ initarm(void *mdp, void *unused __unused
 		if (!(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) {
 			valloc_pages(kernel_pt_table[i],
 			    L2_TABLE_SIZE / PAGE_SIZE);
+			j = i;
 		} else {
-			kernel_pt_table[i].pv_va = freemempos -
-			    (i % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) *
-			    L2_TABLE_SIZE_REAL;
+			kernel_pt_table[i].pv_va = kernel_pt_table[j].pv_va +
+			    L2_TABLE_SIZE_REAL * (i - j);
 			kernel_pt_table[i].pv_pa =
 			    kernel_pt_table[i].pv_va - KERNVIRTADDR +
 			    KERNPHYSADDR;
+
 		}
 	}
 	/*
@@ -506,7 +504,7 @@ initarm(void *mdp, void *unused __unused
 	l2_start = lastaddr & ~(L1_S_OFFSET);
 	for (i = 0 ; i < l2size - 1; i++)
 		pmap_link_l2pt(l1pagetable, l2_start + i * L1_S_SIZE,
-		    &kernel_pt_table[KERNEL_PT_KERN + i]);
+		    &kernel_pt_table[i]);
 
 	pmap_curmaxkvaddr = l2_start + (l2size - 1) * L1_S_SIZE;
 	
@@ -532,7 +530,7 @@ initarm(void *mdp, void *unused __unused
 
 	/* Link and map the vector page */
 	pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH,
-	    &kernel_pt_table[KERNEL_PT_SYS]);
+	    &kernel_pt_table[l2size - 1]);
 	pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 
@@ -603,8 +601,8 @@ initarm(void *mdp, void *unused __unused
 
 	arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 
-	dump_avail[0] = KERNPHYSADDR;
-	dump_avail[1] = KERNPHYSADDR + memsize;
+	dump_avail[0] = 0;
+	dump_avail[1] = memsize;
 	dump_avail[2] = 0;
 	dump_avail[3] = 0;
 



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