wipe out all physical memory before hibernate/reset.

otherwise, WinCE will not boot on some machine (ex. IBM z50).
This commit is contained in:
shin 2002-11-24 06:02:23 +00:00
parent fe56c2b22a
commit 79606e014b
3 changed files with 54 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_machdep.S,v 1.4 2002/01/31 16:27:35 uch Exp $ */
/* $NetBSD: locore_machdep.S,v 1.5 2002/11/24 06:02:23 shin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -56,7 +56,35 @@
#include <mips/asm.h>
#include <mips/cpuregs.h>
#include <hpcmips/vr/vr_asm.h>
.set noreorder
/*
* void vr_hibernate(void *addr, int len)
* wipe out all physical memory and hibernate
*/
LEAF_NOPROFILE(vr_hibernate)
la t0, evr_hibernate
la t1, vr_hibernate
subu t0, t1 # t0 = length of this function
addu a0, t0
subu a1, t0
1: sw zero, 0(a0)
subu a1, 4
bnez a1, 1b
addu a0, 4 # BDSLOT
.word VR_OPCODE_HIBERNATE
nop
nop
nop
nop
nop
END(vr_hibernate)
XLEAF(evr_hibernate)
.set reorder
.align 2
/*
* Interrupt counters for vmstat.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vr.c,v 1.39 2002/02/11 11:44:36 takemura Exp $ */
/* $NetBSD: vr.c,v 1.40 2002/11/24 06:02:24 shin Exp $ */
/*-
* Copyright (c) 1999-2002
@ -59,6 +59,8 @@
#include <hpcmips/vr/vripreg.h>
#include <hpcmips/vr/rtcreg.h>
#include <mips/cache.h>
#include "vrip_common.h"
#if NVRIP_COMMON > 0
#include <hpcmips/vr/vripvar.h>
@ -474,6 +476,9 @@ vr_cons_init()
#endif /* NVRKIU > 0 */
}
extern char vr_hibernate[];
extern char evr_hibernate[];
void
vr_reboot(int howto, char *bootstr)
{
@ -482,13 +487,19 @@ vr_reboot(int howto, char *bootstr)
*/
if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
printf("fake powerdown\n");
__asm(__CONCAT(".word ",___STRING(VR_OPCODE_HIBERNATE)));
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm(".set reorder");
/*
* copy vr_hibernate() to top of physical memory.
*/
memcpy((void *)MIPS_KSEG0_START, vr_hibernate,
evr_hibernate - (char *)vr_hibernate);
/* sync I&D cache */
mips_dcache_wbinv_all();
mips_icache_sync_all();
/*
* call vr_hibernate() at MIPS_KSEG0_START.
*/
((void (*)(void *,int))MIPS_KSEG0_START)(
(void *)MIPS_KSEG0_START, ptoa(physmem));
/* not reach */
vr_reboot(howto&~RB_HALT, bootstr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vrdsu.c,v 1.6 2002/10/02 05:26:55 thorpej Exp $ */
/* $NetBSD: vrdsu.c,v 1.7 2002/11/24 06:02:24 shin Exp $ */
/*
* Copyright (c) 1999 Shin Takemura All rights reserved.
@ -29,6 +29,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <uvm/uvm_param.h>
#include <machine/bus.h>
@ -98,6 +99,10 @@ vrdsu_reset()
splhigh();
vrdsu_write(the_dsu_sc, DSUSET_REG_W, 1); /* 1 sec */
vrdsu_write(the_dsu_sc, DSUCNT_REG_W, DSUCNT_DSWEN);
/*
* wipe out all physical memory for clean WinCE boot.
*/
memset((void *)MIPS_PHYS_TO_KSEG1(0), 0, ptoa(physmem) - 0);
while (1);
} else {
printf("%s(%d): There is no DSU.", __FILE__, __LINE__);