Powerdown support.

This commit is contained in:
tsubai 1998-06-26 14:18:08 +00:00
parent 653c43d0f5
commit 57d093fa36
2 changed files with 35 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: adb_direct.c,v 1.1 1998/05/15 10:15:47 tsubai Exp $ */
/* $NetBSD: adb_direct.c,v 1.2 1998/06/26 14:18:08 tsubai Exp $ */
/* From: adb_direct.c 2.02 4/18/97 jpw */
@ -2073,3 +2073,21 @@ powermac_restart()
while (1); /* not return */
}
void
powermac_powerdown()
{
volatile int flag = 0;
int result;
u_char output[16];
output[0] = 0x02; /* 2 byte message */
output[1] = 0x01; /* to pram/rtc/soft-power device */
output[2] = 0x0a; /* powerdown */
result = send_adb_cuda((u_char *)output, (u_char *)0,
(void *)0, (void *)0, (int)0);
if (result != 0) /* exit if not sent */
return;
while (1); /* not return */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.5 1998/06/21 13:46:02 tsubai Exp $ */
/* $NetBSD: machdep.c,v 1.6 1998/06/26 14:18:08 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -934,15 +934,26 @@ cpu_reboot(howto, what)
vfs_shutdown(); /* sync */
resettodr(); /* set wall clock */
}
splhigh();
if (!cold && (howto & RB_DUMP))
dumpsys();
doshutdownhooks();
if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
#if NADB > 0
powermac_powerdown();
printf("WARNING: powerdown failed!\n");
#endif
}
if (howto & RB_HALT) {
doshutdownhooks();
printf("halted\n\n");
ppc_exit();
}
if (!cold && (howto & RB_DUMP))
dumpsys();
doshutdownhooks();
printf("rebooting\n\n");
if (what && *what) {
if (strlen(what) > sizeof str - 5)