Subject: Re: apm (Re: Anyone running NetBSD on an IBM ThinkPad [A|T]21?)
To: None <port-i386@netbsd.org>
From: Chuck Cranor <chuck@xxx.research.att.com>
List: port-i386
Date: 01/19/2001 23:55:38
In article <20010118234921.D2243305@chips.research.att.com>,
Chuck Cranor <chuck@research.att.com> wrote:
>two things regarding apm:
>first, i noticed today that between 1.4P and 1.5 some change
>was made that prevents APM suspend from working properly on 
>a thinkpad 560.  (with newer kernels the APM BIOS rejects the 
>suspend request with "0x60 Unable to enter requested state".)  
>i have not isolated what the cause of this problem is yet.


i have now isolated this problem.   the bug was introduced
back on 16-Jun-2000 and is in the file sys/arch/i386/isa/npx_isa.c.

the bug can easily be seen (and worked around) by applying the 
following diff:

Index: npx_isa.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/isa/npx_isa.c,v
retrieving revision 1.1
diff -c -r1.1 npx_isa.c
*** npx_isa.c	2000/06/16 03:47:24	1.1
--- npx_isa.c	2001/01/20 04:33:47
***************
*** 71,76 ****
--- 71,77 ----
  	if (bus_space_map(ia->ia_iot, 0xf0, ia->ia_iosize, 0, &ioh) != 0)
  		return (0);
  
+ printf("PROBE1: %#x, %#lx, %#x\n", ia->ia_iot, ioh, ia->ia_irq);
  	result = npxprobe1(ia->ia_iot, ioh, ia->ia_irq);
  	if (result != NPX_INTERRUPT)
  		ia->ia_irq = IRQUNK;	/* zap the interrupt */
***************
*** 93,99 ****
--- 94,105 ----
  		panic("npxattach: unable to map I/O space");
  	}
  
+ #if 0
  	sc->sc_type = npxprobe1(sc->sc_iot, sc->sc_ioh, ia->ia_irq);
+ #else
+ printf("PROBE2: %#x, %#lx, %#x\n", sc->sc_iot, sc->sc_ioh, ia->ia_irq);
+ 	sc->sc_type = NPX_EXCEPTION;
+ #endif
  
  	switch (sc->sc_type) {
  	case NPX_INTERRUPT:


the resulting boot output is:

PROBE1: 0, 0xf0, 0xd
npx0 at isa0 port 0xf0-0xffPROBE2: 0, 0xf0, 0xffffffff
: using exception 16


note that the value of "irq" in the second call to npxprobe1() is 
-1 (because ia->ia_irq was set to IRQUNK after the first call).
i think this is messing up the idt and causing the apm BIOS to
misbehave on the thinkpad 560.


Jason: can you please fix this?  thanks.

chuck
-- 
Chuck Cranor                            http://www.research.att.com/info/chuck
Senior Technical Staff Member		chuck@research.att.com
Internet and Networking Systems Research Lab
AT&T Labs-Research, Florham Park, NJ