Misc cosmetics to reduce diff among hp300 derived m68k ports.
XXX: too many quirks to merge...
This commit is contained in:
parent
61ec97e196
commit
3beadbf115
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_bootstrap.c,v 1.28 2010/12/25 16:11:11 tsutsui Exp $ */
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.29 2011/01/02 08:40:54 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -36,38 +36,34 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.28 2010/12/25 16:11:11 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.29 2011/01/02 08:40:54 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/msgbuf.h>
|
||||
|
||||
#include <machine/frame.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/pte.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa - KERNBASE))
|
||||
|
||||
extern char *etext;
|
||||
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
|
||||
* msgbufp: kernel message buffer
|
||||
* msgbufaddr: kernel message buffer
|
||||
*/
|
||||
void *CADDR1, *CADDR2;
|
||||
char *vmmap;
|
||||
void *msgbufaddr;
|
||||
|
||||
void pmap_bootstrap(paddr_t, paddr_t);
|
||||
|
||||
/*
|
||||
* Bootstrap the VM system.
|
||||
*
|
||||
|
@ -82,7 +78,8 @@ void *msgbufaddr;
|
|||
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;
|
||||
|
@ -91,7 +88,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
/*
|
||||
* 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)
|
||||
|
@ -103,7 +100,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
* 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. ]
|
||||
*
|
||||
|
@ -186,7 +183,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*ste++ = protoste;
|
||||
protoste += (SG4_LEV3SIZE * sizeof(st_entry_t));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize level 1 descriptors. We need:
|
||||
* howmany(nl2desc, SG4_LEV2SIZE)
|
||||
|
@ -200,7 +196,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*ste++ = protoste;
|
||||
protoste += (SG4_LEV2SIZE * sizeof(st_entry_t));
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the final level 1 descriptor to map the next
|
||||
* block of level 2 descriptors for Sysptmap.
|
||||
|
@ -210,11 +205,11 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*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;
|
||||
ste = &ste[i + SG4_LEV2SIZE - NPTEPG / SG4_LEV3SIZE * 2];
|
||||
ste = &ste[i + SG4_LEV2SIZE - (NPTEPG / SG4_LEV3SIZE) * 2];
|
||||
este = &ste[NPTEPG / SG4_LEV3SIZE];
|
||||
protoste = kptmpa | SG_U | SG_RW | SG_V;
|
||||
while (ste < este) {
|
||||
|
@ -255,7 +250,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invalidate all remaining entries.
|
||||
*/
|
||||
|
@ -265,7 +259,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*pte++ = PG_NV;
|
||||
}
|
||||
/*
|
||||
* Initialize the last 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;
|
||||
|
@ -301,7 +295,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
while (pte < epte)
|
||||
*pte++ = PG_NV;
|
||||
/*
|
||||
* Initialize the last 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;
|
||||
|
@ -315,6 +309,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*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
|
||||
|
@ -327,7 +322,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
epte = &pte[NPTEPG];
|
||||
while (pte < epte)
|
||||
*pte++ = PG_NV;
|
||||
|
||||
/*
|
||||
* Initialize kernel page table.
|
||||
* Start by invalidating the `nptpages' that we have allocated.
|
||||
|
@ -336,7 +330,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
epte = &pte[nptpages * NPTEPG];
|
||||
while (pte < epte)
|
||||
*pte++ = PG_NV;
|
||||
|
||||
/*
|
||||
* Validate PTEs for kernel text (RO).
|
||||
*/
|
||||
|
@ -368,7 +361,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
}
|
||||
|
||||
/*
|
||||
* Calculate important exported kernel addresses and related vaules.
|
||||
* Calculate important exported kernel addresses and related values.
|
||||
*/
|
||||
/*
|
||||
* Sysseg: base of kernel segment table
|
||||
|
@ -400,11 +393,11 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
* 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.
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_bootstrap.c,v 1.29 2011/01/02 07:51:02 tsutsui Exp $ */
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.30 2011/01/02 08:40:54 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -35,20 +35,18 @@
|
|||
* @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.30 2011/01/02 08:40:54 tsutsui Exp $");
|
||||
|
||||
#include "opt_m68k_arch.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.29 2011/01/02 07:51:02 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <machine/frame.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/pte.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa))
|
||||
|
||||
extern char *etext;
|
||||
|
@ -56,8 +54,6 @@ extern char *etext;
|
|||
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:
|
||||
|
@ -70,6 +66,8 @@ void *CADDR1, *CADDR2;
|
|||
char *vmmap;
|
||||
void *msgbufaddr;
|
||||
|
||||
void pmap_bootstrap(paddr_t, paddr_t);
|
||||
|
||||
/*
|
||||
* Bootstrap the VM system.
|
||||
*
|
||||
|
@ -84,7 +82,7 @@ void *msgbufaddr;
|
|||
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;
|
||||
|
@ -96,7 +94,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
/*
|
||||
* 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)
|
||||
|
@ -145,6 +143,12 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
* 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 (0x3FC00000 -
|
||||
* 0x3FFFFFFF) are mapped for the kernel page tables.
|
||||
*
|
||||
* The rest of KVA space (0x40000000 - 0xFFFFFFFF) is mapped
|
||||
* by tt0/tt1 registers for device I/O in locore.s.
|
||||
*
|
||||
* 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
|
||||
|
@ -290,9 +294,9 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -305,7 +309,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
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)];
|
||||
|
@ -339,10 +343,10 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
|
||||
#define PTE2VA(pte) m68k_ptob(pte - ((pt_entry_t *)kptpa))
|
||||
|
||||
epte = &pte[iiomapsize];
|
||||
protopte = RELOC(intiobase_phys, u_int) | PG_RW | PG_CI | PG_V;
|
||||
RELOC(intiobase, char *) = (char *)PTE2VA(pte);
|
||||
RELOC(intiolimit, char *) = (char *)PTE2VA(epte);
|
||||
epte = &pte[iiomapsize];
|
||||
RELOC(intiobase, uint8_t *) = (uint8_t *)PTE2VA(pte);
|
||||
RELOC(intiolimit, uint8_t *) = (uint8_t *)PTE2VA(epte);
|
||||
while (pte < epte) {
|
||||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
|
@ -350,7 +354,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
RELOC(virtual_avail, vaddr_t) = PTE2VA(pte);
|
||||
|
||||
/*
|
||||
* Calculate important exported kernel virtual addresses
|
||||
* Calculate important exported kernel addresses and related values.
|
||||
*/
|
||||
/*
|
||||
* Sysseg: base of kernel segment table
|
||||
|
@ -377,9 +381,16 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*/
|
||||
RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa;
|
||||
|
||||
/*
|
||||
* 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)) -
|
||||
(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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_bootstrap.c,v 1.89 2010/06/06 04:50:07 mrg Exp $ */
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.90 2011/01/02 08:40:55 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.89 2010/06/06 04:50:07 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.90 2011/01/02 08:40:55 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -50,9 +50,9 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.89 2010/06/06 04:50:07 mrg Exp
|
|||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pmap.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/video.h>
|
||||
|
@ -64,8 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.89 2010/06/06 04:50:07 mrg Exp
|
|||
extern char *etext;
|
||||
extern char *extiobase;
|
||||
|
||||
extern paddr_t avail_start;
|
||||
extern paddr_t avail_end;
|
||||
extern paddr_t avail_start, avail_end;
|
||||
|
||||
#if NZSC > 0
|
||||
extern int zsinited;
|
||||
|
@ -96,8 +95,8 @@ void *CADDR1, *CADDR2;
|
|||
char *vmmap;
|
||||
void *msgbufaddr;
|
||||
|
||||
void pmap_bootstrap(paddr_t, paddr_t);
|
||||
void bootstrap_mac68k(int);
|
||||
void pmap_bootstrap(paddr_t, paddr_t);
|
||||
void bootstrap_mac68k(int);
|
||||
|
||||
/*
|
||||
* Bootstrap the VM system.
|
||||
|
@ -112,7 +111,7 @@ void bootstrap_mac68k(int);
|
|||
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;
|
||||
paddr_t avail_next;
|
||||
int avail_remaining;
|
||||
|
@ -129,7 +128,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
/*
|
||||
* 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)
|
||||
|
@ -139,7 +138,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
* 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
|
||||
* NBMAPSIZE are the number of PTEs, hence we need to round
|
||||
* the total to a page boundary with IO maps at the end. ]
|
||||
*
|
||||
|
@ -193,6 +192,9 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
* 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
|
||||
|
@ -333,9 +335,9 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*/
|
||||
ste = PA2VA(kstpa, st_entry_t *);
|
||||
ste = &ste[SYSMAP_VA >> SEGSHIFT];
|
||||
*ste = kptmpa | SG_RW | SG_V;
|
||||
pte = PA2VA(kptmpa, pt_entry_t *);
|
||||
pte = &pte[SYSMAP_VA >> SEGSHIFT];
|
||||
*ste = kptmpa | SG_RW | SG_V;
|
||||
*pte = kptmpa | PG_RW | PG_CI | PG_V;
|
||||
}
|
||||
|
||||
|
@ -347,21 +349,19 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
epte = &pte[nptpages * NPTEPG];
|
||||
while (pte < epte)
|
||||
*pte++ = PG_NV;
|
||||
|
||||
/*
|
||||
* Validate PTEs for kernel text (RO).
|
||||
* Pages up to "start" must be writable for the ROM.
|
||||
* Pages up to "start" (vectors and Mac OS global variable space)
|
||||
* must be writable for the ROM.
|
||||
*/
|
||||
pte = PA2VA(kptpa, pt_entry_t *);
|
||||
pte = &pte[m68k_btop(KERNBASE)];
|
||||
/* XXX why KERNBASE relative? */
|
||||
epte = &pte[m68k_btop(m68k_round_page(start))];
|
||||
protopte = firstpa | PG_RW | PG_V;
|
||||
while (pte < epte) {
|
||||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
}
|
||||
/* XXX why KERNBASE relative? */
|
||||
epte = &pte[m68k_btop(m68k_trunc_page(&etext))];
|
||||
protopte = (protopte & ~PG_PROT) | PG_RO;
|
||||
while (pte < epte) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_bootstrap.c,v 1.37 2010/12/25 14:43:00 tsutsui Exp $ */
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.38 2011/01/02 08:40:55 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* This file was taken from mvme68k/mvme68k/pmap_bootstrap.c
|
||||
|
@ -44,25 +44,23 @@
|
|||
* @(#)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.37 2010/12/25 14:43:00 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.38 2011/01/02 08:40:55 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/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <next68k/next68k/seglist.h>
|
||||
|
||||
#include <next68k/dev/intiovar.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa))
|
||||
|
||||
extern char *etext;
|
||||
|
@ -73,9 +71,6 @@ extern phys_ram_seg_t mem_clusters[];
|
|||
extern int mem_cluster_cnt;
|
||||
extern paddr_t msgbufpa;
|
||||
|
||||
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:
|
||||
|
@ -88,6 +83,8 @@ void *CADDR1, *CADDR2;
|
|||
char *vmmap;
|
||||
void *msgbufaddr;
|
||||
|
||||
void pmap_bootstrap(paddr_t, paddr_t);
|
||||
|
||||
/*
|
||||
* Bootstrap the VM system.
|
||||
*
|
||||
|
@ -102,7 +99,8 @@ void *msgbufaddr;
|
|||
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;
|
||||
|
@ -115,7 +113,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
/*
|
||||
* 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)
|
||||
|
@ -242,7 +240,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*ste = protoste;
|
||||
/*
|
||||
* Now initialize the final portion of that block of
|
||||
* descriptors to map the "last PT page".
|
||||
* descriptors to map Sysmap and the "last PT page".
|
||||
*/
|
||||
i = SG4_LEV1SIZE + (nl1desc * SG4_LEV2SIZE);
|
||||
ste = (st_entry_t *)kstpa;
|
||||
|
@ -309,7 +307,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
{
|
||||
/*
|
||||
* Map the page table pages in both the HW segment table
|
||||
* and the software Sysptmap
|
||||
* and the software Sysptmap.
|
||||
*/
|
||||
ste = (st_entry_t *)kstpa;
|
||||
pte = (pt_entry_t *)kptmpa;
|
||||
|
@ -348,6 +346,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*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
|
||||
|
@ -373,8 +372,8 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
while (pte < epte)
|
||||
*pte++ = PG_NV;
|
||||
/*
|
||||
* 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)];
|
||||
|
@ -402,7 +401,7 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
protopte += PAGE_SIZE;
|
||||
}
|
||||
/*
|
||||
* map the kernel segment table cache invalidated for
|
||||
* map the kernel segment table cache invalidated for
|
||||
* these machines (for the 68040 not strictly necessary, but
|
||||
* recommended by Motorola; for the 68060 mandatory)
|
||||
*/
|
||||
|
@ -417,20 +416,17 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, validate the internal IO space PTEs (RW+CI).
|
||||
* We do this here since the 320/350 MMU registers (also
|
||||
* used, but to a lesser extent, on other models) are mapped
|
||||
* in this range and it would be nice to be able to access
|
||||
* them after the MMU is turned on.
|
||||
*/
|
||||
|
||||
#define PTE2VA(pte) m68k_ptob(pte - ((pt_entry_t *)kptpa))
|
||||
|
||||
protopte = INTIOBASE | PG_RW | PG_CI | PG_U | PG_M | PG_V;
|
||||
epte = &pte[IIOMAPSIZE];
|
||||
RELOC(intiobase, char *) = (char *)PTE2VA(pte);
|
||||
RELOC(intiolimit, char *) = (char *)PTE2VA(epte);
|
||||
RELOC(intiobase, uint8_t *) = (uint8_t *)PTE2VA(pte);
|
||||
RELOC(intiolimit, uint8_t *) = (uint8_t *)PTE2VA(epte);
|
||||
while (pte < epte) {
|
||||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
|
@ -440,8 +436,8 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
|
||||
protopte = MONOBASE | PG_RW | PG_CWT | PG_U | PG_M | PG_V;
|
||||
epte = &pte[MONOMAPSIZE];
|
||||
RELOC(monobase, char *) = (char *)PTE2VA(pte);
|
||||
RELOC(monolimit, char *) = (char *)PTE2VA(epte);
|
||||
RELOC(monobase, uint8_t *) = (uint8_t *)PTE2VA(pte);
|
||||
RELOC(monolimit, uint8_t *) = (uint8_t *)PTE2VA(epte);
|
||||
while (pte < epte) {
|
||||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
|
@ -450,8 +446,8 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
|||
/* validate the color fb space PTEs */
|
||||
protopte = COLORBASE | PG_RW | PG_CWT | PG_U | PG_M | PG_V;
|
||||
epte = &pte[COLORMAPSIZE];
|
||||
RELOC(colorbase, char *) = (char *)PTE2VA(pte);
|
||||
RELOC(colorlimit, char *) = (char *)PTE2VA(epte);
|
||||
RELOC(colorbase, uint8_t *) = (uint8_t *)PTE2VA(pte);
|
||||
RELOC(colorlimit, uint8_t *) = (uint8_t *)PTE2VA(epte);
|
||||
while (pte < epte) {
|
||||
*pte++ = protopte;
|
||||
protopte += PAGE_SIZE;
|
||||
|
|
Loading…
Reference in New Issue