PowerOff code. (not yet completely)

'halt -p' availavle.
	not yet all power off...
	cannot exit poweroff mode. (reset required..)
This commit is contained in:
sato 1999-11-28 10:59:05 +00:00
parent 86a8f1d201
commit 943c083676
3 changed files with 39 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.9 1999/11/28 04:29:38 takemura Exp $ */
/* $NetBSD: machdep.c,v 1.10 1999/11/28 10:59:05 sato Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.9 1999/11/28 04:29:38 takemura Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.10 1999/11/28 10:59:05 sato Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
#include "opt_vr41x1.h"
@ -177,7 +177,8 @@ struct platform platform = {
unimpl_clockintr,
unimpl_fb_init,
unimpl_mem_init,
unimpl_reboot
unimpl_reboot,
NULL /* powerdown */,
};
#ifdef VR41X1
@ -615,9 +616,15 @@ haltsys:
/* run any shutdown hooks */
doshutdownhooks();
if ((howto & RB_POWERDOWN) == RB_POWERDOWN &&
platform.powerdown != NULL) {
(*platform.powerdown)(howto, bootstr);
printf("WARNING: powerdown failed!\n");
}
/* Finally, halt/reboot the system. */
printf("%s\n\n", howto & RB_HALT ? "halted." : "rebooting...");
(*platform.reboot)(howto, bootstr);
if (platform.reboot != NULL)
(*platform.reboot)(howto, bootstr);
while(1)
;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysconf.h,v 1.3 1999/11/28 04:29:38 takemura Exp $ */
/* $NetBSD: sysconf.h,v 1.4 1999/11/28 10:59:06 sato Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -92,6 +92,7 @@ extern struct platform {
unsigned long, unsigned long));
#endif
void (*reboot) __P((int howto, char *bootstr));
void (*powerdown) __P((int howto, char *bootstr));
} platform;
extern struct platform unimpl_platform;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vr.c,v 1.5 1999/11/28 04:29:39 takemura Exp $ */
/* $NetBSD: vr.c,v 1.6 1999/11/28 10:59:06 sato Exp $ */
/*-
* Copyright (c) 1999
@ -99,6 +99,7 @@ void vr_device_register __P((struct device *, void *));
void vr_fb_init __P((caddr_t*));
int vr_mem_init __P((caddr_t));
void vr_reboot __P((int howto, char *bootstr));
void vr_powerdown __P((int howto, char *bootstr));
char *vrbcu_vrip_getcpuname __P((void));
int vrbcu_vrip_getcpumajor __P((void));
@ -137,6 +138,7 @@ vr_init()
platform.fb_init = vr_fb_init;
platform.mem_init = vr_mem_init;
platform.reboot = vr_reboot;
platform.powerdown = vr_powerdown;
sprintf(cpu_model, "NEC %s rev%d.%d",
vrbcu_vrip_getcpuname(),
@ -288,7 +290,29 @@ vr_reboot(howto, bootstr)
printf("%s(%d): There is no DSU.", __FILE__, __LINE__);
#endif
}
while (1);
while (1) {
__asm(".word 0x42000021");/* STANDBY */
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
}
}
void
vr_powerdown(howto, bootstr)
int howto;
char *bootstr;
{
printf("fake powerdown\n");
__asm(".word 0x42000023");/* HIBERNATE */
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
vr_reboot(howto&~RB_HALT, bootstr);
}
void *