When APM is configured, turn off the power when halting for good.

This commit is contained in:
wollman 1997-06-15 02:03:03 +00:00
parent d50955905e
commit d0f38e6921
8 changed files with 68 additions and 8 deletions

View File

@ -35,9 +35,10 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.246 1997/06/02 08:19:03 dfr Exp $
* $Id: machdep.c,v 1.247 1997/06/07 04:36:09 bde Exp $
*/
#include "apm.h"
#include "npx.h"
#include "opt_sysvipc.h"
#include "opt_ddb.h"
@ -98,6 +99,9 @@
#include <net/netisr.h>
#if NAPM > 0
#include <machine/apm_bios.h>
#endif
#include <machine/cpu.h>
#include <machine/npx.h>
#include <machine/reg.h>
@ -684,6 +688,17 @@ cpu_halt(void)
__asm__ ("hlt");
}
/*
* Turn the power off.
*/
void
cpu_power_off(void)
{
#if NAPM > 0
apm_power_off();
#endif
}
/*
* Clear registers on exec
*/

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: md_var.h,v 1.13 1997/03/22 18:53:08 kato Exp $
* $Id: md_var.h,v 1.14 1997/06/07 04:36:05 bde Exp $
*/
#ifndef _MACHINE_MD_VAR_H_
@ -57,6 +57,7 @@ struct reg;
void bcopyb __P((const void *from, void *to, size_t len));
void cpu_reset __P((void));
void cpu_halt __P((void));
void cpu_power_down __P((void));
void cpu_switch_load_fs __P((void)) __asm(__STRING(cpu_switch_load_fs));
void cpu_switch_load_gs __P((void)) __asm(__STRING(cpu_switch_load_gs));
void doreti_iret __P((void)) __asm(__STRING(doreti_iret));

View File

@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.55 1997/03/29 11:06:37 phk Exp $
* $Id: apm.c,v 1.56 1997/03/30 09:08:00 phk Exp $
*/
#include <sys/param.h>
@ -223,6 +223,19 @@ apm_display(int newstate)
return 0;
}
/*
* Turn off the entire system.
*/
void
apm_display(void)
{
u_long eax, ebx, ecx;
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_ALLDEV;
ecx = PMST_OFF;
apm_int(&eax, &ebx, &ecx);
}
/* APM Battery low handler */
static void

View File

@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.55 1997/03/29 11:06:37 phk Exp $
* $Id: apm.c,v 1.56 1997/03/30 09:08:00 phk Exp $
*/
#include <sys/param.h>
@ -223,6 +223,19 @@ apm_display(int newstate)
return 0;
}
/*
* Turn off the entire system.
*/
void
apm_display(void)
{
u_long eax, ebx, ecx;
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_ALLDEV;
ecx = PMST_OFF;
apm_int(&eax, &ebx, &ecx);
}
/* APM Battery low handler */
static void

View File

@ -35,9 +35,10 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.246 1997/06/02 08:19:03 dfr Exp $
* $Id: machdep.c,v 1.247 1997/06/07 04:36:09 bde Exp $
*/
#include "apm.h"
#include "npx.h"
#include "opt_sysvipc.h"
#include "opt_ddb.h"
@ -98,6 +99,9 @@
#include <net/netisr.h>
#if NAPM > 0
#include <machine/apm_bios.h>
#endif
#include <machine/cpu.h>
#include <machine/npx.h>
#include <machine/reg.h>
@ -684,6 +688,17 @@ cpu_halt(void)
__asm__ ("hlt");
}
/*
* Turn the power off.
*/
void
cpu_power_off(void)
{
#if NAPM > 0
apm_power_off();
#endif
}
/*
* Clear registers on exec
*/

View File

@ -12,7 +12,7 @@
*
* Aug, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm_bios.h,v 1.16 1997/03/09 16:40:13 kato Exp $
* $Id: apm_bios.h,v 1.17 1997/03/29 11:07:12 phk Exp $
*/
#ifndef _MACHINE_APM_BIOS_H_
@ -156,6 +156,7 @@ struct apmhook *apm_hook_establish (int apmh, struct apmhook *);
void apm_hook_disestablish (int apmh, struct apmhook *);
void apm_cpu_idle(void);
void apm_cpu_busy(void);
void apm_power_off(void);
#endif /* !ASSEMBLER && !INITIALIZER */

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: md_var.h,v 1.13 1997/03/22 18:53:08 kato Exp $
* $Id: md_var.h,v 1.14 1997/06/07 04:36:05 bde Exp $
*/
#ifndef _MACHINE_MD_VAR_H_
@ -57,6 +57,7 @@ struct reg;
void bcopyb __P((const void *from, void *to, size_t len));
void cpu_reset __P((void));
void cpu_halt __P((void));
void cpu_power_down __P((void));
void cpu_switch_load_fs __P((void)) __asm(__STRING(cpu_switch_load_fs));
void cpu_switch_load_gs __P((void)) __asm(__STRING(cpu_switch_load_gs));
void doreti_iret __P((void)) __asm(__STRING(doreti_iret));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
* $Id: kern_shutdown.c,v 1.14 1997/04/26 11:46:14 peter Exp $
* $Id: kern_shutdown.c,v 1.15 1997/05/24 18:35:44 fsmp Exp $
*/
#include "opt_ddb.h"
@ -248,6 +248,7 @@ boot(howto)
}
splhigh();
if (howto & RB_HALT) {
cpu_power_down();
printf("\n");
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");