Date: Fri, 22 Mar 2002 15:00:10 -0800 (PST) From: Alan Larson <larson@eng.paix.net> To: freebsd-bugs@freebsd.org Subject: halt -p doesn't if apm not enabled. Message-ID: <200203222300.PAA30437@ground0.paix.net>
next in thread | raw e-mail | index | archive | help
email address: larson@paix.net
name: Alan Larson
organization: PAIX.net
summary: halt -p = reboot(RB_POWEROFF) doesn't halt if apm not enabled
category: kernel
severity: non-critical
priority: low
class: sw-bug
freebsd version: 4.3 and later
Full description:
halt -p would halt the system, but not power down. Power down
was known to work for windows 2k. Investigation revealed that
apm_power_off() in apm.c was testing the softc to see if it was
active.
It appears to be unnecessary for the apm to be active to issue
the bios call to power the machine down.
A context diff of the correction is included.
While investigating this, I defined APM_DEBUG and discovered a
couple problems in printf formats. They are also corrected in
the diff, and should be included.
How to repeat the problem:
su # many fun things start with this.
apm -e 0 # only needed if it was already on.
halt -p # you did save your work first, didn't you?
Fix to the problem:
The following diff should do it just fine.
*** apm.ccO Fri Mar 22 14:09:17 2002
--- apm.cc Fri Mar 22 14:15:10 2002
***************
*** 285,293 ****
{
struct apm_softc *sc = &apm_softc;
! /* Not halting powering off, or not active */
! if (!(howto & RB_POWEROFF) || !apm_softc.active)
! return;
sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE;
sc->bios.r.ebx = PMDV_ALLDEV;
sc->bios.r.ecx = PMST_OFF;
--- 285,292 ----
{
struct apm_softc *sc = &apm_softc;
! if (!(howto & RB_POWEROFF)) /* Powering off? */
! return; /* no */
sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE;
sc->bios.r.ebx = PMDV_ALLDEV;
sc->bios.r.ecx = PMST_OFF;
***************
*** 1041,1047 ****
/* print bootstrap messages */
#ifdef APM_DEBUG
! printf("apm: APM BIOS version %04x\n", apm_version);
printf("apm: Code16 0x%08x, Data 0x%08x\n",
sc->bios.seg.code16.base, sc->bios.seg.data.base);
printf("apm: Code entry 0x%08x, Idling CPU %s, Management %s\n",
--- 1040,1046 ----
/* print bootstrap messages */
#ifdef APM_DEBUG
! printf("apm: APM BIOS version %04lx\n", apm_version);
printf("apm: Code16 0x%08x, Data 0x%08x\n",
sc->bios.seg.code16.base, sc->bios.seg.data.base);
printf("apm: Code entry 0x%08x, Idling CPU %s, Management %s\n",
***************
*** 1191,1197 ****
if (!sc->initialized)
return (ENXIO);
#ifdef APM_DEBUG
! printf("APM ioctl: cmd = 0x%x\n", cmd);
#endif
switch (cmd) {
case APMIO_SUSPEND:
--- 1190,1196 ----
if (!sc->initialized)
return (ENXIO);
#ifdef APM_DEBUG
! printf("APM ioctl: cmd = 0x%lx\n", cmd);
#endif
switch (cmd) {
case APMIO_SUSPEND:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203222300.PAA30437>
