Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp300/hp300 Move bootinfo address initialization to...



details:   https://anonhg.NetBSD.org/src/rev/a0d84112f376
branches:  trunk
changeset: 760507:a0d84112f376
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Jan 06 13:03:47 2011 +0000

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

diffstat:

 sys/arch/hp300/hp300/locore.s         |  11 +++++++----
 sys/arch/hp300/hp300/machdep.c        |  11 ++++++++---
 sys/arch/hp300/hp300/pmap_bootstrap.c |  18 ++----------------
 3 files changed, 17 insertions(+), 23 deletions(-)

diffs (137 lines):

diff -r a476388c14ce -r a0d84112f376 sys/arch/hp300/hp300/locore.s
--- a/sys/arch/hp300/hp300/locore.s     Thu Jan 06 11:29:40 2011 +0000
+++ b/sys/arch/hp300/hp300/locore.s     Thu Jan 06 13:03:47 2011 +0000
@@ -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
diff -r a476388c14ce -r a0d84112f376 sys/arch/hp300/hp300/machdep.c
--- a/sys/arch/hp300/hp300/machdep.c    Thu Jan 06 11:29:40 2011 +0000
+++ b/sys/arch/hp300/hp300/machdep.c    Thu Jan 06 13:03:47 2011 +0000
@@ -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)
diff -r a476388c14ce -r a0d84112f376 sys/arch/hp300/hp300/pmap_bootstrap.c
--- a/sys/arch/hp300/hp300/pmap_bootstrap.c     Thu Jan 06 11:29:40 2011 +0000
+++ b/sys/arch/hp300/hp300/pmap_bootstrap.c     Thu Jan 06 13:03:47 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index