Date: Thu, 5 Sep 2002 10:28:39 +0100 (BST) From: Bruce M Simpson <bms@spc.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: i386/42439: i386/apm: battery time reported incorrectly on Sony Vaio Z600 Message-ID: <20020905092839.6EA559696@triage.dollah.com>
next in thread | raw e-mail | index | archive | help
>Number: 42439 >Category: i386 >Synopsis: i386/apm: battery time reported incorrectly on Sony Vaio Z600 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 05 02:30:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bruce M Simpson >Release: FreeBSD 4.6-STABLE i386 >Organization: >Environment: System: FreeBSD triage.dollah.com 4.6-STABLE FreeBSD 4.6-STABLE #2: Wed Sep 4 18:52:52 BST 2002 root@triage.dollah.com:/usr/src/sys/compile/TRIAGE i386 >Description: Certain models of laptop have an APM bios bug which reports the battery time with the incorrect byte order. The Sony Vaio PCG-Z600HEK is one such laptop. >How-To-Repeat: Use the apm(8) tool to display APM BIOS battery information periodically, and notice that it is incorrect. >Fix: The attached patch introduces a new kernel compile option which is currently activated by adding the following line to the kernel configuration file before compilation: makeoptions APM_SWAB_BATT_MINUTES=1 --- apm-vaio-batt-time.patch begins here --- --- sys/i386/apm/apm.c.orig Tue Sep 3 11:21:30 2002 +++ sys/i386/apm/apm.c Tue Sep 3 11:35:27 2002 @@ -36,6 +36,7 @@ #include <machine/apm_bios.h> #include <machine/segments.h> #include <machine/clock.h> +#include <machine/endian.h> #include <vm/vm.h> #include <vm/vm_param.h> #include <vm/pmap.h> @@ -633,7 +634,13 @@ if (sc->bios.r.edx == 0xffff) /* Time is unknown */ app->ap_batt_time = -1; else if (sc->bios.r.edx & 0x8000) /* Time is in minutes */ +#if defined(APM_SWAB_BATT_MINUTES) + /* BIOS reports minutes incorrectly */ + app->ap_batt_time = __byte_swap_word(sc->bios.r.edx) | 0x8000; + app->ap_batt_time *= 60; +#else app->ap_batt_time = (sc->bios.r.edx & 0x7fff) * 60; +#endif else /* Time is in seconds */ app->ap_batt_time = sc->bios.r.edx; --- apm-vaio-batt-time.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: 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?20020905092839.6EA559696>