On Wed, 13 Dec 2000, Alan Cox wrote:

> > (3) modifies the output of /proc/apm when power status reporting is
> > disabled - on reflection, maybe this wasn't such a smart thing to do
> > (could royally stuff anybody who is automagically parsing /proc/apm?)
> 
> Please dont - it correctly reports 'dunno' right now

OK, (yet another) diff attached, against 2.2.18.

Neale.
diff -ur -x .config linux-2.2.18-orig/Documentation/Configure.help 
linux-2.2.18/Documentation/Configure.help
--- linux-2.2.18-orig/Documentation/Configure.help      Mon Dec 11 11:49:41 2000
+++ linux-2.2.18/Documentation/Configure.help   Wed Dec 13 13:36:54 2000
@@ -10298,6 +10298,18 @@
   a work-around for a number of buggy BIOSes. Switch this option on if
   your computer crashes instead of powering off properly.
 
+Buggy battery status reporting
+CONFIG_APM_ASHES_NOTEBIOS
+  Currently disables power status reporting - for buggy BIOS which
+  (a) oopses on reading from /proc/apm and (b) does NOT have DMI.
+  (AcerNote-950 with Phoenix NoteBIOS 1994).
+  In future, this setting might invoke a bug-workaround.
+  
+  Note that if the machine has DMI then the BIOS version should be
+  automagically detectable and this workaround automated.  Send the DMI
+  strings printed at boot-time with any report if this is not happening
+  (or try patching arch/i386/kernel/dmi_scan.c).
+
 Watchdog Timer Support 
 CONFIG_WATCHDOG
   If you say Y here (and to one of the following options) and create a
diff -ur -x .config linux-2.2.18-orig/arch/i386/config.in 
linux-2.2.18/arch/i386/config.in
--- linux-2.2.18-orig/arch/i386/config.in       Mon Dec 11 11:49:41 2000
+++ linux-2.2.18/arch/i386/config.in    Wed Dec 13 13:36:54 2000
@@ -116,6 +116,7 @@
   bool '   RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT
   bool '   Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS
   bool '   Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF
+  bool '   Buggy power status reporting' CONFIG_APM_ASHES_NOTEBIOS
 fi
 tristate 'Toshiba Laptop support' CONFIG_TOSHIBA
 
diff -ur -x .config linux-2.2.18-orig/arch/i386/kernel/apm.c 
linux-2.2.18/arch/i386/kernel/apm.c
--- linux-2.2.18-orig/arch/i386/kernel/apm.c    Mon Dec 11 11:49:41 2000
+++ linux-2.2.18/arch/i386/kernel/apm.c Wed Dec 13 13:40:23 2000
@@ -130,6 +130,9 @@
  *         is now the way life works). 
  *         Fix thinko in suspend() (wrong return).
  *   1.13ac: Added apm_battery_horked() for Compal boards (Dell 5000e etc)
+ *   1.13ac-nb: WIP: AcerNote-950 oops on reading /proc/apm
+ *         Try disabling power status reporting.
+ *         Neale Banks <[EMAIL PROTECTED]>
  *
  * APM 1.1 Reference:
  *
@@ -211,6 +214,8 @@
  * P: Toshiba 1950S: battery life information only gets updated after resume
  * P: Midwest Micro Soundbook Elite DX2/66 monochrome: screen blanking
  *     broken in BIOS [Reported by Garst R. Reese <[EMAIL PROTECTED]>]
+ * ?: AcerNote-950: oops on reading /proc/apm - workaround is a WIP
+ *     Neale Banks <[EMAIL PROTECTED]> December 2000
  *
  * Legend: U = unusable with APM patches
  *         P = partially usable with APM patches
@@ -327,6 +332,11 @@
 static int                     power_off_enabled = 1;
 #endif
 static int                     dell_crap = 0;  /*Set if we find a 5000e */
+#ifdef CONFIG_APM_ASHES_NOTEBIOS
+static int                     ashes_notebios = 1;     /*Set by configure*/
+#else
+static int                     ashes_notebios = 0;     /* Default to OK */
+#endif
 
 static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
 static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
@@ -658,6 +668,14 @@
        u32     edx;
        u32     dummy;
 
+       /* Catch cases of known buggy BIOSen */
+       if (dell_crap || ashes_notebios) {
+               *status = *bat = *life = 0xffff;
+               /* not sure of the _best_ code to return here.
+                  For now, APM_DISABLED will have to do  */
+               return APM_DISABLED;
+       }
+
        if (apm_bios_call(APM_FUNC_GET_STATUS, APM_DEVICE_ALL, 0,
                        &eax, &ebx, &ecx, &edx, &dummy))
                return (eax >> 8) & 0xff;
@@ -1272,7 +1290,7 @@
 
        p = buf;
 
-       if ((smp_num_cpus == 1) && (!dell_crap) && 
+       if ((smp_num_cpus == 1) &&
            !(error = apm_get_power_status(&bx, &cx, &dx))) {
                ac_line_status = (bx >> 8) & 0xff;
                battery_status = bx & 0xff;
@@ -1492,6 +1510,9 @@
                (apm_bios_info.version & 0xff),
                apm_bios_info.flags,
                driver_version);
+       if (dell_crap || ashes_notebios) {
+               printk(KERN_INFO "apm: power status reporting disabled\n");
+       }
        if ((apm_bios_info.flags & APM_32_BIT_SUPPORT) == 0) {
                printk(KERN_INFO "apm: no 32 bit BIOS support\n");
                return -ENODEV;

Reply via email to