summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1997-12-04 02:40:00 +0000
committerimp <imp@FreeBSD.org>1997-12-04 02:40:00 +0000
commitc184b142915986a82e72586fbe35f58d11e84a38 (patch)
tree8f6280806c689da695132e76f480d8aeff7451c1
parent0d728a957362d7c1f83d15ab6af61c7851c5ca36 (diff)
downloadFreeBSD-src-c184b142915986a82e72586fbe35f58d11e84a38.zip
FreeBSD-src-c184b142915986a82e72586fbe35f58d11e84a38.tar.gz
The Libretto's BIOS doesn't set edx on the APM_GETPWSTATUS call, so
the barrery time remaining is reported as a random number. Initialize edx to 0xffff in this case, and to 0 in all other cases. This change should be benign on other machines. Reviewed by: jdp
-rw-r--r--sys/i386/apm/apm.c14
-rw-r--r--sys/i386/bios/apm.c14
2 files changed, 22 insertions, 6 deletions
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c
index 39c1601..372efdf 100644
--- a/sys/i386/apm/apm.c
+++ b/sys/i386/apm/apm.c
@@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.64 1997/11/10 14:38:08 nate Exp $
+ * $Id: apm.c,v 1.65 1997/11/12 04:12:43 jdp Exp $
*/
#include <sys/param.h>
@@ -144,6 +144,7 @@ apm_enable_disable_pm(int enable)
else
ebx = 0xffff; /* APM version 1.0 only */
ecx = enable;
+ edx = 0;
return apm_int(&eax, &ebx, &ecx, &edx);
}
@@ -156,6 +157,7 @@ apm_driver_version(int version)
eax = (APM_BIOS << 8) | APM_DRVVERSION;
ebx = 0x0;
ecx = version;
+ edx = 0;
if(!apm_int(&eax, &ebx, &ecx, &edx))
apm_version = eax & 0xffff;
}
@@ -169,6 +171,7 @@ apm_engage_disengage_pm(int engage)
eax = (APM_BIOS << 8) | APM_ENGAGEDISENGAGEPM;
ebx = PMDV_ALLDEV;
ecx = engage;
+ edx = 0;
return(apm_int(&eax, &ebx, &ecx, &edx));
}
@@ -182,6 +185,7 @@ apm_getevent(void)
ebx = 0;
ecx = 0;
+ edx = 0;
if (apm_int(&eax, &ebx, &ecx, &edx))
return PMEV_NOEVENT;
@@ -197,6 +201,7 @@ apm_suspend_system(void)
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_ALLDEV;
ecx = PMST_SUSPEND;
+ edx = 0;
if (apm_int(&eax, &ebx, &ecx, &edx)) {
printf("Entire system suspend failure: errcode = %ld\n",
@@ -220,6 +225,7 @@ apm_display(int newstate)
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_DISP0;
ecx = newstate ? PMST_APMENABLED:PMST_SUSPEND;
+ edx = 0;
if (apm_int(&eax, &ebx, &ecx, &edx)) {
printf("Display off failure: errcode = %ld\n",
0xff & (eax >> 8));
@@ -241,6 +247,7 @@ apm_power_off(void)
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_ALLDEV;
ecx = PMST_OFF;
+ edx = 0;
apm_int(&eax, &ebx, &ecx, &edx);
}
@@ -433,6 +440,7 @@ apm_get_info(apm_info_t aip)
eax = (APM_BIOS << 8) | APM_GETPWSTATUS;
ebx = PMDV_ALLDEV;
ecx = 0;
+ edx = 0xffff; /* default to unknown battery time */
if (apm_int(&eax, &ebx, &ecx, &edx))
return 1;
@@ -467,7 +475,7 @@ apm_cpu_idle(void)
u_long eax, ebx, ecx, edx;
eax = (APM_BIOS <<8) | APM_CPUIDLE;
- ecx = ebx = 0;
+ edx = ecx = ebx = 0;
apm_int(&eax, &ebx, &ecx, &edx);
}
/*
@@ -499,7 +507,7 @@ apm_cpu_busy(void)
u_long eax, ebx, ecx, edx;
eax = (APM_BIOS <<8) | APM_CPUBUSY;
- ecx = ebx = 0;
+ edx = ecx = ebx = 0;
apm_int(&eax, &ebx, &ecx, &edx);
}
}
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index 39c1601..372efdf 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.64 1997/11/10 14:38:08 nate Exp $
+ * $Id: apm.c,v 1.65 1997/11/12 04:12:43 jdp Exp $
*/
#include <sys/param.h>
@@ -144,6 +144,7 @@ apm_enable_disable_pm(int enable)
else
ebx = 0xffff; /* APM version 1.0 only */
ecx = enable;
+ edx = 0;
return apm_int(&eax, &ebx, &ecx, &edx);
}
@@ -156,6 +157,7 @@ apm_driver_version(int version)
eax = (APM_BIOS << 8) | APM_DRVVERSION;
ebx = 0x0;
ecx = version;
+ edx = 0;
if(!apm_int(&eax, &ebx, &ecx, &edx))
apm_version = eax & 0xffff;
}
@@ -169,6 +171,7 @@ apm_engage_disengage_pm(int engage)
eax = (APM_BIOS << 8) | APM_ENGAGEDISENGAGEPM;
ebx = PMDV_ALLDEV;
ecx = engage;
+ edx = 0;
return(apm_int(&eax, &ebx, &ecx, &edx));
}
@@ -182,6 +185,7 @@ apm_getevent(void)
ebx = 0;
ecx = 0;
+ edx = 0;
if (apm_int(&eax, &ebx, &ecx, &edx))
return PMEV_NOEVENT;
@@ -197,6 +201,7 @@ apm_suspend_system(void)
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_ALLDEV;
ecx = PMST_SUSPEND;
+ edx = 0;
if (apm_int(&eax, &ebx, &ecx, &edx)) {
printf("Entire system suspend failure: errcode = %ld\n",
@@ -220,6 +225,7 @@ apm_display(int newstate)
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_DISP0;
ecx = newstate ? PMST_APMENABLED:PMST_SUSPEND;
+ edx = 0;
if (apm_int(&eax, &ebx, &ecx, &edx)) {
printf("Display off failure: errcode = %ld\n",
0xff & (eax >> 8));
@@ -241,6 +247,7 @@ apm_power_off(void)
eax = (APM_BIOS << 8) | APM_SETPWSTATE;
ebx = PMDV_ALLDEV;
ecx = PMST_OFF;
+ edx = 0;
apm_int(&eax, &ebx, &ecx, &edx);
}
@@ -433,6 +440,7 @@ apm_get_info(apm_info_t aip)
eax = (APM_BIOS << 8) | APM_GETPWSTATUS;
ebx = PMDV_ALLDEV;
ecx = 0;
+ edx = 0xffff; /* default to unknown battery time */
if (apm_int(&eax, &ebx, &ecx, &edx))
return 1;
@@ -467,7 +475,7 @@ apm_cpu_idle(void)
u_long eax, ebx, ecx, edx;
eax = (APM_BIOS <<8) | APM_CPUIDLE;
- ecx = ebx = 0;
+ edx = ecx = ebx = 0;
apm_int(&eax, &ebx, &ecx, &edx);
}
/*
@@ -499,7 +507,7 @@ apm_cpu_busy(void)
u_long eax, ebx, ecx, edx;
eax = (APM_BIOS <<8) | APM_CPUBUSY;
- ecx = ebx = 0;
+ edx = ecx = ebx = 0;
apm_int(&eax, &ebx, &ecx, &edx);
}
}
OpenPOWER on IntegriCloud