- Simplify early initialisation so we do most of it in C.
- Call allocsys() much earlier so we can use uvm_pageboot_alloc() to steal KSEG0 pages for system tables.
This commit is contained in:
parent
3b5f6123fa
commit
6a2132797e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.S,v 1.8 2002/10/14 14:19:29 scw Exp $ */
|
||||
/* $NetBSD: locore.S,v 1.9 2002/10/22 09:30:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
|
@ -123,42 +123,11 @@ Lmapped_start:
|
|||
/* Now safe to call C code */
|
||||
|
||||
/*
|
||||
* Do basic pre-pmap initialisation. This is mostly to do with
|
||||
* sizing physical memory.
|
||||
* Do basic initialisation, including setting up the pmap.
|
||||
*
|
||||
* vaddr_t evbsh5_memory_init(vaddr_t endkernel, struct mem_region *mr);
|
||||
* void evbsh5_init(vaddr_t endkernel)
|
||||
*/
|
||||
LEA(_C_LABEL(end), r2)
|
||||
LEA(Lmem_regions, r3)
|
||||
LEAF(_C_LABEL(evbsh5_memory_init), r0)
|
||||
ptabs/l r0, tr0
|
||||
blink tr0, r18
|
||||
|
||||
/*
|
||||
* Bootstrap the pmap:
|
||||
*
|
||||
* void pmap_bootstrap(vaddr_t avail, paddr_t kseg0base,
|
||||
* struct mem_region *mr);
|
||||
*/
|
||||
LDUC32(0x80000000, r3)
|
||||
LEA(Lmem_regions, r4)
|
||||
LEAF(_C_LABEL(pmap_bootstrap), r0)
|
||||
ptabs/l r0, tr0
|
||||
blink tr0, r18
|
||||
|
||||
/*
|
||||
* We can now deal with exceptions, particularly TLB misses
|
||||
*/
|
||||
getcon sr, r1
|
||||
movi 1, r0
|
||||
shlli r0, SH5_CONREG_SR_BL_SHIFT, r0
|
||||
andc r1, r0, r1
|
||||
putcon r1, sr
|
||||
|
||||
/*
|
||||
* Secondary initialisation. The pmap has been set up enough
|
||||
* to map device register into kernel virtual address space.
|
||||
*/
|
||||
LEAF(_C_LABEL(evbsh5_init), r0)
|
||||
ptabs/l r0, tr0
|
||||
blink tr0, r18
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.9 2002/10/14 14:21:35 scw Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.10 2002/10/22 09:30:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
|
@ -105,11 +105,21 @@ char cpu_model[128];
|
|||
bus_space_handle_t _evbsh5_bh_pbridge;
|
||||
bus_space_handle_t _evbsh5_bh_sysfpga;
|
||||
|
||||
static struct mem_region mr[2];
|
||||
|
||||
vaddr_t
|
||||
evbsh5_memory_init(vaddr_t endkernel, struct mem_region *mr)
|
||||
void
|
||||
evbsh5_init(vaddr_t endkernel)
|
||||
{
|
||||
extern char sh5_panic_stack[];
|
||||
#if NDTFCONS > 0
|
||||
extern char *_dtf_buffer;
|
||||
extern void _dtf_trap_frob(void);
|
||||
vaddr_t dtfbuf;
|
||||
paddr_t frob_p;
|
||||
#endif
|
||||
u_long ksize;
|
||||
vsize_t size;
|
||||
caddr_t v;
|
||||
|
||||
endkernel = sh5_round_page(endkernel);
|
||||
|
||||
|
@ -121,19 +131,9 @@ evbsh5_memory_init(vaddr_t endkernel, struct mem_region *mr)
|
|||
mr[1].mr_start = 0;
|
||||
mr[1].mr_size = 0;
|
||||
|
||||
return (endkernel);
|
||||
}
|
||||
pmap_bootstrap(endkernel, EVBSH5_RAM_START_PHYS, mr);
|
||||
|
||||
void
|
||||
evbsh5_init(void)
|
||||
{
|
||||
extern char sh5_panic_stack[];
|
||||
#if NDTFCONS > 0
|
||||
extern char *_dtf_buffer;
|
||||
extern void _dtf_trap_frob(void);
|
||||
vaddr_t dtfbuf;
|
||||
paddr_t frob_p;
|
||||
#endif
|
||||
__asm __volatile("putcon %0, sr" :: "r"(SH5_CONREG_SR_IMASK_ALL));
|
||||
|
||||
/* XXX: Will need to be revisited for SMP */
|
||||
curcpu()->ci_panicstkphys = EVBSH5_RAM_START_PHYS +
|
||||
|
@ -184,6 +184,15 @@ evbsh5_init(void)
|
|||
#endif
|
||||
|
||||
boothowto = RB_SINGLE | RB_KDB;
|
||||
|
||||
/*
|
||||
* Call allocsys() now so we can steal pages from KSEG0.
|
||||
*/
|
||||
size = (vsize_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_pageboot_alloc(round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
}
|
||||
|
||||
#ifndef SH5_CPU_SPEED
|
||||
|
@ -245,26 +254,13 @@ compute_ctc_tick_per_us(void)
|
|||
void
|
||||
cpu_startup(void)
|
||||
{
|
||||
caddr_t v;
|
||||
u_int i, base, residual;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
char pbuf[16];
|
||||
|
||||
/*
|
||||
* Find out how much space we need, allocate it,
|
||||
* and then give everything true virtual addresses.
|
||||
*/
|
||||
size = (vsize_t)allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(size))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if ((allocsys(v, NULL) - v) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
|
||||
/*
|
||||
* Now allocate buffers proper. They are different than the above
|
||||
* in that they usually occupy more virtual memory than physical.
|
||||
* Now allocate buffers proper.
|
||||
*/
|
||||
size = MAXBSIZE * nbuf;
|
||||
if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size),
|
||||
|
@ -323,8 +319,8 @@ cpu_startup(void)
|
|||
|
||||
strcpy(cpu_model, "SuperH SH5");
|
||||
|
||||
printf("%s%s running at %dMHz\n", version, cpu_model,
|
||||
(u_int)_sh5_ctc_ticks_per_us);
|
||||
printf("%s%s running in %d-bit mode at %dMHz\n", version, cpu_model,
|
||||
(sizeof(void *) == 8) ? 64 : 32, (u_int)_sh5_ctc_ticks_per_us);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.h,v 1.1 2002/07/05 13:31:40 scw Exp $ */
|
||||
/* $NetBSD: machdep.h,v 1.2 2002/10/22 09:30:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
|
@ -41,9 +41,6 @@
|
|||
extern bus_space_handle_t _evbsh5_bh_pbridge;
|
||||
extern bus_space_handle_t _evbsh5_bh_sysfpga;
|
||||
|
||||
struct mem_region;
|
||||
|
||||
extern vaddr_t evbsh5_memory_init(vaddr_t, struct mem_region *);
|
||||
extern void evbsh5_init(void);
|
||||
extern void evbsh5_init(vaddr_t);
|
||||
|
||||
#endif /* _EVBSH5_MACHDEP_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap.h,v 1.11 2002/10/04 09:17:57 scw Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.12 2002/10/22 09:30:26 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
|
@ -112,6 +112,8 @@ pmap_remove_all(struct pmap *pmap)
|
|||
}
|
||||
|
||||
/* Private pmap data and functions */
|
||||
struct mem_region;
|
||||
extern void pmap_bootstrap(vaddr_t, paddr_t, struct mem_region *);
|
||||
extern int pmap_initialized;
|
||||
extern u_int pmap_ipt_hash(vsid_t vsid, vaddr_t va); /* See exception.S */
|
||||
extern vaddr_t pmap_map_device(paddr_t, u_int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap.c,v 1.19 2002/10/12 12:02:16 scw Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.20 2002/10/22 09:30:27 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
|
@ -389,7 +389,6 @@ static struct pool_allocator pmap_pool_uallocator = {
|
|||
pmap_pool_ualloc, pmap_pool_ufree, 0,
|
||||
};
|
||||
|
||||
void pmap_bootstrap(vaddr_t, paddr_t, struct mem_region *);
|
||||
volatile pte_t *pmap_pte_spill(u_int, vsid_t, vaddr_t);
|
||||
|
||||
static void pmap_copyzero_page_dpurge(paddr_t, struct evcnt *);
|
||||
|
|
Loading…
Reference in New Issue