Chnage MACHINE_NONCONTIG implementation such that the message buffer is

always located at the end of onboard RAM. This allows locore.s to zero
any offboard RAM to initialise the parity bit which most VMEbus RAM cards
have. Without this, many cards buserr on the first read access.
Thanks to Herb Peyerl for the idea.
This commit is contained in:
scw 1997-11-01 17:56:47 +00:00
parent eb0f6686d2
commit cb8172bce4
3 changed files with 76 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.29 1997/10/21 19:25:16 scw Exp $ */
/* $NetBSD: locore.s,v 1.30 1997/11/01 17:56:49 scw Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -183,12 +183,36 @@ start: | start of kernel and .text!
movl 0xfffe0774,d1 | End + 1 of onboard memory
movl d1,a0@(4) | phys_seg_list[0].ps_end
clrl a0@(8) | phys_seg_list[0].ps_startpage
movl 0xfffe0764,a0@(0x0c) | Start of offboard segment
/* offboard RAM */
clrl a0@(0x0c) | phys_seg_list[1].ps_start
movl #NBPG-1,d0
addl 0xfffe0764,d0 | Start of offboard segment
andl #-NBPG,d0 | Round up to page boundary
beq Lsavmaxmem | Jump if none defined
movl 0xfffe0768,d1 | End of offboard segment
addql #1,d1 | +1
movl #NBPG,d1 | Note: implicit '+1'
addl 0xfffe0768,d1 | End of offboard segment
andl #-NBPG,d1 | Round up to page boundary
cmpl d1,d0 | Quick and dirty validity check
bcss Loff_ok | Yup, looks good.
movel a0@(4),d1 | Just use onboard RAM otherwise
bras Lsavmaxmem
Loff_ok:
movl d0,a0@(0x0c) | phys_seg_list[1].ps_start
movl d1,a0@(0x10) | phys_seg_list[1].ps_end
clrl a0@(0x14) | phys_seg_list[1].ps_startpage
/*
* Offboard RAM needs to be cleared to zero to initialise parity
* on most VMEbus RAM cards. Without this, some cards will buserr
* when first read.
*/
movel d0,a0 | offboard start address again.
Lclearoff:
clrl a0@+ | zap a word
cmpl a0,d1 | reached end?
bnes Lclearoff
Lsavmaxmem:
moveq #PGSHIFT,d2
lsrl d2,d1 | convert to page (click) number

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.28 1997/10/19 10:53:14 scw Exp $ */
/* $NetBSD: machdep.c,v 1.29 1997/11/01 17:56:47 scw Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -87,10 +87,15 @@
#include <machine/prom.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <machine/vmparam.h>
#include <dev/cons.h>
#include <machine/kcore.h> /* XXX should be pulled in by sys/kcore.h */
#ifdef MACHINE_NONCONTIG
#include <mvme68k/mvme68k/seglist.h>
#endif
#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */
/* the following is used externally (sysctl_hw) */
@ -219,10 +224,17 @@ mvme68k_init()
* Initialize error message buffer (at end of core).
* avail_end was pre-decremented in pmap_bootstrap to compensate.
*/
#ifdef MACHINE_NONCONTIG
#define MVME_MSG_BUF_START phys_seg_list[0].ps_end
#else
#define MVME_MSG_BUF_START avail_end
#endif
for (i = 0; i < btoc(MSGBUFSIZE); i++)
pmap_enter(pmap_kernel(), (vm_offset_t)msgbufaddr + i * NBPG,
avail_end + i * NBPG, VM_PROT_ALL, TRUE);
MVME_MSG_BUF_START + i * NBPG, VM_PROT_ALL, TRUE);
initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE));
#undef MVME_MSG_BUF_START
}
#ifdef MVME147
@ -334,7 +346,18 @@ cpu_startup()
*/
printf(version);
identifycpu();
printf("real mem = %d\n", ctob(physmem));
printf("real mem = %d", ctob(physmem));
#ifdef MACHINE_NONCONTIG
maxaddr = 0;
for (i = 1; i < MAX_PHYS_SEGS && phys_seg_list[i].ps_start; i++)
maxaddr += phys_seg_list[i].ps_end - phys_seg_list[i].ps_start;
if ( maxaddr )
printf(" (of which %d is offboard)", maxaddr);
#endif
printf("\n");
/*
* Fine out how much space we need, allocate it,

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_bootstrap.c,v 1.5 1997/10/09 21:39:33 scw Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.6 1997/11/01 17:56:51 scw Exp $ */
/*
* Copyright (c) 1991, 1993
@ -410,16 +410,28 @@ pmap_bootstrap(nextpa, firstpa)
* the pmap module.
*/
RELOC(avail_start, vm_offset_t) = nextpa;
#ifndef MACHINE_NONCONTIG
RELOC(avail_end, vm_offset_t) =
m68k_ptob(RELOC(maxmem, int))
/* XXX allow for msgbuf */
- m68k_round_page(MSGBUFSIZE);
#ifdef MACHINE_NONCONTIG
#else
RELOC(avail_next, vm_offset_t) = RELOC(avail_start, vm_offset_t);
/* leave space at end of onboard RAM for message buffer */
RELOC(phys_seg_list[0].ps_end, vm_offset_t) -=
m68k_round_page(MSGBUFSIZE);
/* initial avail_end is end of onboard RAM */
RELOC(avail_end, vm_offset_t) =
m68k_ptob(RELOC(phys_seg_list[0].ps_end, vm_offset_t));
RELOC(avail_remaining, vm_size_t) =
(RELOC(phys_seg_list[0].ps_end, vm_offset_t) -
RELOC(avail_start, vm_offset_t)) >> PGSHIFT;
RELOC(phys_seg_list[0].ps_start, vm_offset_t) =
RELOC(avail_start, vm_offset_t);
RELOC(phys_seg_list[0].ps_startpage, vm_offset_t) = 0;
@ -430,8 +442,7 @@ pmap_bootstrap(nextpa, firstpa)
RELOC(phys_seg_list[0].ps_start, vm_offset_t)) / NBPG;
/* iterate over any remaining segments */
for (i = 1; i < MAX_PHYS_SEGS; i++)
{
for (i = 1; i < MAX_PHYS_SEGS; i++) {
vm_offset_t len;
if ( RELOC(phys_seg_list[i].ps_start, vm_offset_t) == 0 )
@ -448,12 +459,15 @@ pmap_bootstrap(nextpa, firstpa)
RELOC(avail_remaining, vm_size_t) += (len / NBPG);
RELOC(physmem, int) += (len / NBPG);
}
/* correct for message buffer */
RELOC(phys_seg_list[i - 1].ps_end, vm_offset_t) -=
m68k_round_page(MSGBUFSIZE);
if ( m68k_ptob(RELOC(phys_seg_list[i].ps_end, vm_offset_t)) >
RELOC(avail_end, vm_offset_t) ) {
RELOC(avail_end, vm_offset_t) =
m68k_ptob(RELOC(phys_seg_list[i].ps_end, vm_offset_t));
}
}
#endif
RELOC(mem_size, vm_size_t) = m68k_ptob(RELOC(physmem, int));
RELOC(virtual_avail, vm_offset_t) =
VM_MIN_KERNEL_ADDRESS + (nextpa - firstpa);