Subject: Re: port-i386/5786: APM: unknown error code
To: None <rh@vip.at>
From: Chris G. Demetriou <cgd@netbsd1.cygnus.com>
List: netbsd-bugs
Date: 07/25/1998 00:29:51
Rene Hexel <rh@idle.trapdoor.vip.at> writes:
>   The error message ("unknown error code") seems to stem from a parsing
> problem.  It looks like error codes 0x5306 and 0x5305 are combinations
> of 0x53 ("Command not supported") and 0x06 ("CPU busy") or 0x05 ("CPU
> idle"), respectively.  As I'm not an APM expert I cannot say whether
> this really is a (cosmetic) parsing problem on NetBSD's side or whether
> these are non-standard error codes issued by the motherboard(s).  (Since
> this happens on more than one motherboard I reckon that the first
> assumtion is the correct one).

Knowing in more detail what they are, that reckoning becomes less
likely (at least in my opinion).  It's not an error code parsing
problem.

0x53 is the APM BIOS function code.  To get the actual APM BIOS call
number, you take APM BIOS function code << 8 and or in the call number
of the call that you want.  Note that:

#define APM_CPU_IDLE            0x05
#define APM_CPU_BUSY            0x06

So, 0x5306 is the number the code passes to the BIOS to tell it to do
the APM cpu busy function, etc.

There are two possible causes for this:

* the BIOS not correctly filling in an error code when an error
condition occurs, or

* the kernel incorrectly sensing an error code when no error occurred.


It's worth noting that a similar case has popped up with the:

#define APM_GET_PM_EVENT        0x0b

call, but in the _opposite_ sense (if i recall correctly).
Unfortunately, I don't have my notes handy to check exactly what the
old symptom was.

John Kohl suggested a patch to me (regarding clearing the carry bit
before making the APM call), but I don't have it handy and never had a
chance to try it.  John?



cgd