Module Name: src
Committed By: tsutsui
Date: Sun Jan 2 07:03:47 UTC 2011
Modified Files:
src/sys/arch/hp300/hp300: pmap_bootstrap.c
src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c
src/sys/arch/news68k/news68k: pmap_bootstrap.c
src/sys/arch/x68k/x68k: pmap_bootstrap.c
Log Message:
Misc cosmetics to reduce diffs among these ports.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/hp300/hp300/pmap_bootstrap.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/news68k/news68k/pmap_bootstrap.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/x68k/x68k/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/pmap_bootstrap.c
diff -u src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.49 src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.50
--- src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.49 Sun Jan 2 05:21:11 2011
+++ src/sys/arch/hp300/hp300/pmap_bootstrap.c Sun Jan 2 07:03:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_bootstrap.c,v 1.49 2011/01/02 05:21:11 tsutsui Exp $ */
+/* $NetBSD: pmap_bootstrap.c,v 1.50 2011/01/02 07:03:46 tsutsui Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -36,20 +36,18 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.49 2011/01/02 05:21:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.50 2011/01/02 07:03:46 tsutsui Exp $");
#include <sys/param.h>
+#include <uvm/uvm_extern.h>
-#include <machine/frame.h>
#include <machine/cpu.h>
#include <machine/hp300spu.h>
-#include <machine/vmparam.h>
#include <machine/pte.h>
+#include <machine/vmparam.h>
#include <hp300/hp300/clockreg.h>
-#include <uvm/uvm_extern.h>
-
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa))
extern char *etext;
@@ -60,20 +58,21 @@
extern int maxmem, physmem;
extern paddr_t avail_start, avail_end;
-void pmap_bootstrap(paddr_t, paddr_t);
-
/*
* Special purpose kernel virtual addresses, used for mapping
* physical pages for a variety of temporary or permanent purposes:
*
* CADDR1, CADDR2: pmap zero/copy operations
* vmmap: /dev/mem, crash dumps, parity error checking
- * ledbase: SPU LEDs
* msgbufaddr: kernel message buffer
+ * ledbase: SPU LEDs
*/
-void *CADDR1, *CADDR2, *ledbase;
+void *CADDR1, *CADDR2;
char *vmmap;
void *msgbufaddr;
+void *ledbase;
+
+void pmap_bootstrap(paddr_t, paddr_t);
/*
* Bootstrap the VM system.
@@ -89,7 +88,8 @@
void
pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
{
- paddr_t kstpa, kptpa, kptmpa, lkptpa, lwp0upa;
+ paddr_t lwp0upa, kstpa, kptmpa, kptpa;
+ paddr_t lkptpa;
u_int nptpages, kstsize;
st_entry_t protoste, *ste, *este;
pt_entry_t protopte, *pte, *epte;
@@ -98,7 +98,7 @@
/*
* Calculate important physical addresses:
*
- * lwp0upa lwp 0 u-area UPAGES pages
+ * lwp0upa lwp0 u-area UPAGES pages
*
* kstpa kernel segment table 1 page (!040)
* N pages (040)
@@ -110,7 +110,7 @@
* kptpa statically allocated
* kernel PT pages Sysptsize+ pages
*
- * [ Sysptsize is the number of pages of PT, IIOMAPSIZE and
+ * [ Sysptsize is the number of pages of PT, and IIOMAPSIZE and
* EIOMAPSIZE are the number of PTEs, hence we need to round
* the total to a page boundary with IO maps at the end. ]
*
@@ -213,7 +213,7 @@
*ste = protoste;
/*
* Now initialize the final portion of that block of
- * descriptors to map kptmpa and the "last PT page".
+ * descriptors to map Sysmap and the "last PT page".
*/
i = SG4_LEV1SIZE + (nl1desc * SG4_LEV2SIZE);
ste = (st_entry_t *)kstpa;
@@ -267,7 +267,7 @@
*pte++ = PG_NV;
}
/*
- * Initialize the last ones to point to kptmpa and the page
+ * Initialize the last ones to point to Sysptmap and the page
* table page allocated earlier.
*/
pte = (pt_entry_t *)kptmpa;
@@ -304,7 +304,7 @@
while (pte < epte)
*pte++ = PG_NV;
/*
- * Initialize the last ones to point to kptmpa and the page
+ * Initialize the last ones to point to Sysptmap and the page
* table page allocated earlier.
*/
ste = (st_entry_t *)kstpa;
@@ -320,6 +320,7 @@
*ste = lkptpa | SG_RW | SG_V;
*pte = lkptpa | PG_RW | PG_CI | PG_V;
}
+
/*
* Invalidate all but the final entry in the last kernel PT page.
* The final entry maps the last page of physical memory to
@@ -349,8 +350,8 @@
RELOC(bootinfo_pa, paddr_t) = firstpa;
/*
- * Validate PTEs for kernel text (RO). The first page
- * of kernel text remains invalid; see locore.s
+ * Validate PTEs for kernel text (RO).
+ * The first page of kernel text remains invalid; see locore.s
*/
pte = (pt_entry_t *)kptpa;
pte = &pte[m68k_btop(KERNBASE + PAGE_SIZE)];
@@ -455,11 +456,11 @@
* the pmap module.
*
* Note about avail_end: msgbuf is initialized just after
- * avail_end in machdep.c. Since the last page is used
- * for rebooting the system (code is copied there and
- * excution continues from copied code before the MMU
- * is disabled), the msgbuf will get trounced between
- * reboots if it's placed in the last physical page.
+ * avail_end in machdep.c.
+ * Since the last page is used for rebooting the system
+ * (code is copied there and excution continues from copied code
+ * before the MMU is disabled), the msgbuf will get trounced
+ * between reboots if it's placed in the last physical page.
* To work around this, we move avail_end back one more
* page so the msgbuf can be preserved.
*/
@@ -467,6 +468,7 @@
RELOC(avail_end, paddr_t) = m68k_ptob(RELOC(maxmem, int)) -
(m68k_round_page(MSGBUFSIZE) + m68k_ptob(1));
RELOC(mem_size, vsize_t) = m68k_ptob(RELOC(physmem, int));
+
RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;
#ifdef M68K_MMU_HP
Index: src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.46 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.47
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.46 Sun Jan 2 06:25:23 2011
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Sun Jan 2 07:03:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_bootstrap.c,v 1.46 2011/01/02 06:25:23 tsutsui Exp $ */
+/* $NetBSD: pmap_bootstrap.c,v 1.47 2011/01/02 07:03:46 tsutsui Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -35,22 +35,21 @@
* @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
*/
-#include "opt_m68k_arch.h"
-
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.46 2011/01/02 06:25:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.47 2011/01/02 07:03:46 tsutsui Exp $");
+
+#include "opt_m68k_arch.h"
#include <sys/param.h>
#include <sys/kcore.h>
-#include <machine/kcore.h>
+#include <uvm/uvm_extern.h>
+
+#include <machine/cpu.h>
#include <machine/pte.h>
#include <machine/vmparam.h>
-#include <machine/cpu.h>
#include <mvme68k/mvme68k/seglist.h>
-#include <uvm/uvm_extern.h>
-
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa))
extern char *etext;
@@ -73,7 +72,7 @@
char *vmmap;
void *msgbufaddr;
-void pmap_bootstrap(paddr_t, paddr_t);
+void pmap_bootstrap(paddr_t, paddr_t);
/*
* Bootstrap the VM system.
@@ -89,7 +88,7 @@
void
pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
{
- paddr_t kstpa, kptpa, kptmpa, lwp0upa;
+ paddr_t lwp0upa, kstpa, kptmpa, kptpa;
u_int nptpages, kstsize;
st_entry_t protoste, *ste, *este;
pt_entry_t protopte, *pte, *epte;
@@ -113,7 +112,7 @@
* kptpa statically allocated
* kernel PT pages Sysptsize+ pages
*
- * [ Sysptsize is the number of pages of PT, iiomappages is the
+ * [ Sysptsize is the number of pages of PT, and iiomappages is the
* number of PTEs, hence we need to round the total to a page
* boundary with IO maps at the end. ]
*
Index: src/sys/arch/news68k/news68k/pmap_bootstrap.c
diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.34 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.35
--- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.34 Sun Jan 2 05:09:27 2011
+++ src/sys/arch/news68k/news68k/pmap_bootstrap.c Sun Jan 2 07:03:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_bootstrap.c,v 1.34 2011/01/02 05:09:27 tsutsui Exp $ */
+/* $NetBSD: pmap_bootstrap.c,v 1.35 2011/01/02 07:03:46 tsutsui Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -38,17 +38,17 @@
* news68k/pmap_bootstrap.c - from hp300 and mvme68k
*/
-#include "opt_m68k_arch.h"
-
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.34 2011/01/02 05:09:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.35 2011/01/02 07:03:46 tsutsui Exp $");
+
+#include "opt_m68k_arch.h"
#include <sys/param.h>
+#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
#include <machine/pte.h>
-
-#include <uvm/uvm_extern.h>
+#include <machine/vmparam.h>
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa))
@@ -59,8 +59,6 @@
extern int maxmem, physmem;
extern paddr_t avail_start, avail_end;
-void pmap_bootstrap(paddr_t, paddr_t);
-
/*
* Special purpose kernel virtual addresses, used for mapping
* physical pages for a variety of temporary or permanent purposes:
@@ -73,6 +71,8 @@
char *vmmap;
void *msgbufaddr;
+void pmap_bootstrap(paddr_t, paddr_t);
+
/*
* Bootstrap the VM system.
*
@@ -87,7 +87,7 @@
void
pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
{
- paddr_t kstpa, kptpa, kptmpa, lwp0upa;
+ paddr_t lwp0upa, kstpa, kptmpa, kptpa;
u_int nptpages, kstsize;
st_entry_t protoste, *ste, *este;
pt_entry_t protopte, *pte, *epte;
@@ -99,7 +99,7 @@
/*
* Calculate important physical addresses:
*
- * lwp0upa lwp 0 u-area UPAGES pages
+ * lwp0upa lwp0 u-area UPAGES pages
*
* kstpa kernel segment table 1 page (!040)
* N pages (040)
@@ -109,7 +109,7 @@
* kptpa statically allocated
* kernel PT pages Sysptsize+ pages
*
- * [ Sysptsize is the number of pages of PT, IIOMAPSIZE and
+ * [ Sysptsize is the number of pages of PT, and IIOMAPSIZE and
* EIOMAPSIZE are the number of PTEs, hence we need to round
* the total to a page boundary with IO maps at the end. ]
*
@@ -131,10 +131,8 @@
if (RELOC(mmutype, int) == MMU_68040)
kstsize = MAXKL2SIZE / (NPTEPG/SG4_LEV2SIZE);
else
- kstsize = 1;
-#else
- kstsize = 1;
#endif
+ kstsize = 1;
kstpa = nextpa;
nextpa += kstsize * PAGE_SIZE;
kptmpa = nextpa;
@@ -147,10 +145,8 @@
/*
* Clear all PTEs to zero
*/
-#if 1
for (pte = (pt_entry_t *)kstpa; pte < (pt_entry_t *)nextpa; pte++)
*pte = 0;
-#endif
/*
* Initialize segment table and kernel page table map.
@@ -312,9 +308,9 @@
*/
ste = (st_entry_t *)kstpa;
ste = &ste[SYSMAP_VA >> SEGSHIFT];
- *ste = kptmpa | SG_RW | SG_V;
pte = (pt_entry_t *)kptmpa;
pte = &pte[SYSMAP_VA >> SEGSHIFT];
+ *ste = kptmpa | SG_RW | SG_V;
*pte = kptmpa | PG_RW | PG_CI | PG_V;
}
@@ -326,7 +322,6 @@
epte = &pte[nptpages * NPTEPG];
while (pte < epte)
*pte++ = PG_NV;
-
/*
* Validate PTEs for kernel text (RO).
*/
@@ -431,7 +426,7 @@
*/
RELOC(avail_start, paddr_t) = nextpa;
RELOC(avail_end, paddr_t) = m68k_ptob(RELOC(maxmem, int)) -
- (m68k_round_page(MSGBUFSIZE));
+ m68k_round_page(MSGBUFSIZE);
RELOC(mem_size, vsize_t) = m68k_ptob(RELOC(physmem, int));
RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;
Index: src/sys/arch/x68k/x68k/pmap_bootstrap.c
diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.52 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.53
--- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.52 Sat Dec 25 16:37:22 2010
+++ src/sys/arch/x68k/x68k/pmap_bootstrap.c Sun Jan 2 07:03:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_bootstrap.c,v 1.52 2010/12/25 16:37:22 tsutsui Exp $ */
+/* $NetBSD: pmap_bootstrap.c,v 1.53 2011/01/02 07:03:46 tsutsui Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -36,18 +36,18 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.52 2010/12/25 16:37:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.53 2011/01/02 07:03:46 tsutsui Exp $");
#include "opt_m68k_arch.h"
#include <sys/param.h>
#include <uvm/uvm_extern.h>
+
+#include <machine/cpu.h>
#include <machine/pte.h>
#include <machine/vmparam.h>
-#include <machine/cpu.h>
#include <arch/x68k/x68k/iodevice.h>
-
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa))
extern char *etext;
@@ -55,8 +55,6 @@
extern int maxmem, physmem;
extern paddr_t avail_start, avail_end;
-void pmap_bootstrap(paddr_t, paddr_t);
-
/*
* Special purpose kernel virtual addresses, used for mapping
* physical pages for a variety of temporary or permanent purposes:
@@ -69,6 +67,8 @@
char *vmmap;
void *msgbufaddr;
+void pmap_bootstrap(paddr_t, paddr_t);
+
/*
* Bootstrap the VM system.
*
@@ -83,7 +83,7 @@
void
pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
{
- paddr_t kstpa, kptpa, kptmpa, lwp0upa;
+ paddr_t lwp0upa, kstpa, kptmpa, kptpa;
u_int nptpages, kstsize;
st_entry_t protoste, *ste, *este;
pt_entry_t protopte, *pte, *epte;
@@ -94,7 +94,7 @@
/*
* Calculate important physical addresses:
*
- * lwp0upa lwp 0 u-area UPAGES pages
+ * lwp0upa lwp0 u-area UPAGES pages
*
* kstpa kernel segment table 1 page (!040)
* N pages (040)
@@ -146,6 +146,9 @@
* each mapping 256kb. Note that there may be additional "segment
* table" pages depending on how large MAXKL2SIZE is.
*
+ * Portions of the last segment of KVA space (0xFFC00000 -
+ * 0xFFFFFFFF) are mapped for the kernel page tables.
+ *
* XXX cramming two levels of mapping into the single "segment"
* table on the 68040 is intended as a temporary hack to get things
* working. The 224mb of address space that this allows will most
@@ -202,7 +205,7 @@
*ste = protoste;
/*
* Now initialize the final portion of that block of
- * descriptors to map kptmpa.
+ * descriptors to map Sysmap.
*/
i = SG4_LEV1SIZE + (nl1desc * SG4_LEV2SIZE);
ste = (st_entry_t *)kstpa;
@@ -289,9 +292,9 @@
*/
ste = (st_entry_t *)kstpa;
ste = &ste[SYSMAP_VA >> SEGSHIFT];
- *ste = kptmpa | SG_RW | SG_V;
pte = (pt_entry_t *)kptmpa;
pte = &pte[SYSMAP_VA >> SEGSHIFT];
+ *ste = kptmpa | SG_RW | SG_V;
*pte = kptmpa | PG_RW | PG_CI | PG_V;
}
@@ -304,11 +307,10 @@
while (pte < epte)
*pte++ = PG_NV;
/*
- * Validate PTEs for kernel text (RO)
+ * Validate PTEs for kernel text (RO).
*/
pte = (pt_entry_t *)kptpa;
pte = &pte[m68k_btop(KERNBASE)];
- /* XXX why KERNBASE relative? */
epte = &pte[m68k_btop(m68k_trunc_page(&etext))];
protopte = firstpa | PG_RO | PG_V;
while (pte < epte) {
@@ -359,7 +361,7 @@
epte = &pte[IIOMAPSIZE];
RELOC(intiobase, uint8_t *) = (uint8_t *)PTE2VA(pte);
RELOC(IODEVbase, uint8_t *) = RELOC(intiobase, uint8_t *); /* XXX */
- RELOC(intiolimit, char *) = (char *)PTE2VA(epte);
+ RELOC(intiolimit, uint8_t *) = (uint8_t *)PTE2VA(epte);
while (pte < epte) {
*pte++ = protopte;
protopte += PAGE_SIZE;
@@ -397,12 +399,13 @@
/*
* VM data structures are now initialized, set up data for
* the pmap module.
+ *
+ * Note about avail_end: msgbuf is initialized just after
+ * avail_end in machdep.c.
*/
RELOC(avail_start, paddr_t) = nextpa;
- RELOC(avail_end, paddr_t) =
- m68k_ptob(RELOC(maxmem, int))
- /* XXX allow for msgbuf */
- - m68k_round_page(MSGBUFSIZE);
+ RELOC(avail_end, paddr_t) = m68k_ptob(RELOC(maxmem, int)) -
+ m68k_round_page(MSGBUFSIZE);
RELOC(mem_size, psize_t) = m68k_ptob(RELOC(physmem, int));
RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;