From owner-freebsd-acpi@FreeBSD.ORG Wed Jun 16 21:39:28 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF0FC16A4CE for ; Wed, 16 Jun 2004 21:39:28 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66A3143D1F for ; Wed, 16 Jun 2004 21:39:28 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.11/8.12.11) with ESMTP id i5GLbimk025707; Wed, 16 Jun 2004 15:37:44 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 16 Jun 2004 15:37:57 -0600 (MDT) Message-Id: <20040616.153757.104034074.imp@bsdimp.com> To: liamfoy@sepulcrum.org From: "M. Warner Losh" In-Reply-To: <20040616221656.5e0febc0.liamfoy@sepulcrum.org> References: <20040616215708.360cf786.liamfoy@sepulcrum.org> <20040616.150227.68884900.imp@bsdimp.com> <20040616221656.5e0febc0.liamfoy@sepulcrum.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: acpi@freebsd.org Subject: Re: apm problem X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2004 21:39:28 -0000 In message: <20040616221656.5e0febc0.liamfoy@sepulcrum.org> "Liam J. Foy" writes: Yeah. This : has been causing utter confusion, needs to be fixed once and for : all. The man page stages 255 is returned also, except for : ai_batt_time (-t) since it is an int. To finalise, APM returns -1 : for UNKNOWN and so we should test for -1 or 0xff? The APM BIOS returns 0xff in some cases to indicate unknown. FreeBSD's apm driver shuffles these values into u_int as unsigned. So the right thing to do is to check against 0xff for those fields. There's one case where FreeBSD's apm driver stores -1 in a u_int. I just chagned that one case to store the unsigned number 0xfffffffful into that field. For that field, and that field only (ai_batteries), we need to check against 0xffffffff. All others are properly checking against 255 (0xff). The BIOS call that returns values for ai_batteries doesn't have an unknown option (see section 4.6.17). Many others do, but this one doesn't. This is arguably a bug in FreeBSD's api, but at this late date, it would be painful to change it. If we didn't have third party applications, then it would be easy, but alas there are several that use this interface. : I recently lost a small disk with a specification on. I could of : sworn it said 0xffffffff. Maybe Nate and I had the same document. Do : you have a specification you could possibly email me privately with : it? It doesn't. And even if it did, the FreeBSD apm driver masks off the upper bits. You can download the specs from http://www.microsoft.com/hwdev/busbios/apm_12.htm Warner