Module Name:    src
Committed By:   tsutsui
Date:           Thu Jan  6 13:03:47 UTC 2011

Modified Files:
        src/sys/arch/hp300/hp300: locore.s machdep.c pmap_bootstrap.c

Log Message:
Move bootinfo address initialization to locore.s and machdep.c
to reduce MD quirks in pmap_bootstrap.c.
Also print bootinfo_pa in consinit() so that we can see
at least MMU is properly enabled after boot.

Tested on HP382.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/hp300/hp300/locore.s
cvs rdiff -u -r1.212 -r1.213 src/sys/arch/hp300/hp300/machdep.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/hp300/hp300/pmap_bootstrap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp300/hp300/locore.s
diff -u src/sys/arch/hp300/hp300/locore.s:1.157 src/sys/arch/hp300/hp300/locore.s:1.158
--- src/sys/arch/hp300/hp300/locore.s:1.157	Mon Dec 27 15:39:07 2010
+++ src/sys/arch/hp300/hp300/locore.s	Thu Jan  6 13:03:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.157 2010/12/27 15:39:07 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.158 2011/01/06 13:03:47 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -114,7 +114,7 @@
  * VA 0.
  *
  * The bootloader places the bootinfo in this page, and we allocate
- * a VA for it and map it in pmap_bootstrap().
+ * a VA for it and map it later.
  */
 	.fill	PAGE_SIZE/4,4,0
 
@@ -420,14 +420,17 @@
 	moveq	#FC_USERD,%d0		| user space
 	movc	%d0,%sfc		|   as source
 	movc	%d0,%dfc		|   and destination of transfers
+/* save the first PA as bootinfo_pa to map it to a virtual address later. */
+	movl	%a5,%d0			| lowram value from ROM via boot
+	RELOC(bootinfo_pa, %a0)
+	movl	%d0,%a0@		| save the lowram as bootinfo PA
 /* initialize memory sizes (for pmap_bootstrap) */
 	movl	#MAXADDR,%d1		| last page
 	moveq	#PGSHIFT,%d2
 	lsrl	%d2,%d1			| convert to page (click) number
 	RELOC(maxmem, %a0)
 	movl	%d1,%a0@		| save as maxmem
-	movl	%a5,%d0			| lowram value from ROM via boot
-	lsrl	%d2,%d0			| convert to page number
+	lsrl	%d2,%d0			| convert the lowram to page number
 	subl	%d0,%d1			| compute amount of RAM present
 	RELOC(physmem, %a0)
 	movl	%d1,%a0@		| and physmem

Index: src/sys/arch/hp300/hp300/machdep.c
diff -u src/sys/arch/hp300/hp300/machdep.c:1.212 src/sys/arch/hp300/hp300/machdep.c:1.213
--- src/sys/arch/hp300/hp300/machdep.c:1.212	Sat Oct 16 16:41:45 2010
+++ src/sys/arch/hp300/hp300/machdep.c	Thu Jan  6 13:03:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.212 2010/10/16 16:41:45 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.213 2011/01/06 13:03:47 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.212 2010/10/16 16:41:45 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.213 2011/01/06 13:03:47 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -249,6 +249,8 @@
 	 * exists by searching for the MAGIC record.  If it's not
 	 * there, disable bootinfo.
 	 */
+	bootinfo_va = virtual_avail;
+	virtual_avail += PAGE_SIZE;
 	pmap_enter(pmap_kernel(), bootinfo_va, bootinfo_pa,
 	    VM_PROT_READ|VM_PROT_WRITE,
 	    VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
@@ -260,6 +262,7 @@
 		pmap_remove(pmap_kernel(), bootinfo_va,
 		    bootinfo_va + PAGE_SIZE);
 		pmap_update(pmap_kernel());
+		virtual_avail -= PAGE_SIZE;
 		bootinfo_va = 0;
 	}
 }
@@ -287,7 +290,9 @@
 	/*
 	 * Issue a warning if the boot loader didn't provide bootinfo.
 	 */
-	if (bootinfo_va == 0)
+	if (bootinfo_va != 0)
+		printf("bootinfo found at 0x%08lx\n", bootinfo_pa);
+	else
 		printf("WARNING: boot loader did not provide bootinfo\n");
 
 #if NKSYMS || defined(DDB) || defined(MODULAR)

Index: src/sys/arch/hp300/hp300/pmap_bootstrap.c
diff -u src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.51 src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.52
--- src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.51	Sun Jan  2 18:48:05 2011
+++ src/sys/arch/hp300/hp300/pmap_bootstrap.c	Thu Jan  6 13:03:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.51 2011/01/02 18:48:05 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.52 2011/01/06 13:03:47 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.51 2011/01/02 18:48:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.52 2011/01/06 13:03:47 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <uvm/uvm_extern.h>
@@ -52,8 +52,6 @@
 
 extern char *etext;
 extern vaddr_t CLKbase, MMUbase;
-extern paddr_t bootinfo_pa;
-extern vaddr_t bootinfo_va;
 
 extern int maxmem, physmem;
 extern paddr_t avail_start, avail_end;
@@ -339,16 +337,6 @@
 	epte = &pte[nptpages * NPTEPG];
 	while (pte < epte)
 		*pte++ = PG_NV;
-
-	/*
-	 * The page of kernel text is zero-filled in locore.s,
-	 * and not mapped (at VA 0).  The boot loader places the
-	 * bootinfo here after the kernel is loaded.  Remember
-	 * the physical address; we'll map it to a virtual address
-	 * later.
-	 */
-	RELOC(bootinfo_pa, paddr_t) = firstpa;
-
 	/*
 	 * Validate PTEs for kernel text (RO).
 	 * The first page of kernel text remains invalid; see locore.s
@@ -489,8 +477,6 @@
 	{
 		vaddr_t va = RELOC(virtual_avail, vaddr_t);
 
-		RELOC(bootinfo_va, vaddr_t) = (vaddr_t)va;
-		va += PAGE_SIZE;
 		RELOC(CADDR1, void *) = (void *)va;
 		va += PAGE_SIZE;
 		RELOC(CADDR2, void *) = (void *)va;

Reply via email to