diff -Naur --exclude-from=exclude linux-2.4.7/arch/i386/kernel/apm.c linux-2.4.7-sony/arch/i386/kernel/apm.c --- linux-2.4.7/arch/i386/kernel/apm.c Fri Apr 6 13:42:47 2001 +++ linux-2.4.7-sony/arch/i386/kernel/apm.c Mon Aug 20 12:21:46 2001 @@ -704,7 +704,11 @@ return (eax >> 8) & 0xff; *status = ebx; *bat = ecx; - *life = edx; + if (apm_info.get_power_status_swabinminutes) { + *life = swab16((u16)edx); + *life |= 0x8000; + } else + *life = edx; return APM_SUCCESS; } diff -Naur --exclude-from=exclude linux-2.4.7/arch/i386/kernel/dmi_scan.c linux-2.4.7-sony/arch/i386/kernel/dmi_scan.c --- linux-2.4.7/arch/i386/kernel/dmi_scan.c Mon Aug 20 14:49:59 2001 +++ linux-2.4.7-sony/arch/i386/kernel/dmi_scan.c Mon Aug 20 14:06:52 2001 @@ -251,6 +251,13 @@ return 0; } +static __init int swab_apm_power_in_minutes(struct dmi_blacklist *d) +{ + apm_info.get_power_status_swabinminutes = 1; + printk(KERN_WARNING "BIOS strings suggest APM reports battery life in minutes and wrong byte order.\n"); + return 0; +} + /* * Process the DMI blacklists */ @@ -297,6 +304,12 @@ MATCH(DMI_PRODUCT_NAME, "L8400K series Notebook PC"), NO_MATCH, NO_MATCH } }, + { swab_apm_power_in_minutes, "Sony VAIO", { /* Handle problems with APM on Sony Vaio PCG-N505VX */ + MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), + MATCH(DMI_BIOS_VERSION, "W2K06H0"), + MATCH(DMI_BIOS_DATE, "02/03/00"), NO_MATCH + } }, + { apm_is_horked, "Trigem Delhi3", { /* APM crashes */ MATCH(DMI_SYS_VENDOR, "TriGem Computer, Inc"), MATCH(DMI_PRODUCT_NAME, "Delhi3"), diff -Naur --exclude-from=exclude linux-2.4.7/include/linux/apm_bios.h linux-2.4.7-sony/include/linux/apm_bios.h --- linux-2.4.7/include/linux/apm_bios.h Wed Jul 4 14:50:39 2001 +++ linux-2.4.7-sony/include/linux/apm_bios.h Mon Aug 20 12:18:14 2001 @@ -52,6 +52,7 @@ struct apm_bios_info bios; unsigned short connection_version; int get_power_status_broken; + int get_power_status_swabinminutes; int allow_ints; int realmode_power_off; int disabled;