Subject: kern/21838: "panic: cardbus_get_capability" on apm resume when CardBus tlp(4) was running
To: None <gnats-bugs@gnats.netbsd.org>
From: None <itohy@netbsd.org>
List: netbsd-bugs
Date: 06/10/2003 12:21:05
>Number:         21838
>Category:       kern
>Synopsis:       "panic: cardbus_get_capability" on apm resume when CardBus tlp(4) was running
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 10 03:22:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     ITOH Yasufumi
>Release:        NetBSD 1.6L
>Organization:
>Environment:
System: NetBSD pino.my.domain 1.6L NetBSD 1.6L (PINO) #380: Mon Jun 9 20:33:32 JST 2003 itohy@pino.my.domain:/remote/fmv.w/src/sys/arch/i386/compile/PINO i386
Architecture: i386
Machine: i386

related dmesg:
cbb0 at pci0 dev 19 function 0: Toshiba ToPIC95B CardBus-PCI Bridge (rev. 0x07)
cbb1 at pci0 dev 19 function 1: Toshiba ToPIC95B CardBus-PCI Bridge (rev. 0x07)
cbb0: interrupting at irq 11
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 20 device 0
pcmcia0 at cardslot0
cbb1: interrupting at irq 11
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 21 device 0
pcmcia1 at cardslot1
	:
tlp0 at cardbus1 dev 0 function 0: DECchip 21143 Ethernet, pass 4.1
tlp0: Ethernet address xx:xx:xx:xx:xx:xx
ukphy0 at tlp0 phy 1: Generic IEEE 802.3u media interface
ukphy0: OUI 0x000818, model 0x0021, rev. 2
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp0: 21143 reset block
tlp0: unknown ISV media block type 0x06
tlp0: interrupting at 11

>Description:
	If CardBus tlp card is running (ifconfig up),
	suspending and resuming the system causes a panic.

panic: cardbus_get_capability
Begin traceback...
_cardbus_get_capability(c05c3a00,c039bb8c,80150000,1,c690fde8) at _cardbus_get_capability+0x5f
_tlp_cardbus_setup(c06fd000,c05c3a00,c60f3000,c02fce0f,c0580800) at _tlp_cardbus_setup+0x79
_tlp_cardbus_power(c06fd000,0,18,c0300e8d,c06e9160) at _tlp_cardbus_power+0x31
_tlp_power(0,c06fd000,90607d3,2b370b01,c05c2400) at _tlp_power+0x70
_dopowerhooks(0,3,c690feac,c030fc5a,3ee3e0ab) at _dopowerhooks+0x30
_apm_resume(c05c2400,c690ff2c,246,10,c05c2400) at _apm_resume+0x34
_apm_event_handle(c05c2400,c690ff2c,1,c039d76c,0) at _apm_event_handle+0x10e
_apm_periodic_check(c05c2400,0,c690ff8c,c0310c65,c05c245c) at _apm_periodic_check+0xb0
_apm_thread(c05c2400,0,0,0,c010032e) at _apm_thread+0x26
End traceback...
syncing disks... wd0g: error writing fsbn 28344398 of 28344398-28344399 (wd0 bn 46504274; cn 14473 tn 40 sn 5), retrying
wd0: (aborted command)
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 giving up

dumping to dev 0,1 offset 608565

>How-To-Repeat:
	1. insert CardBus tlp to your PC,
	2. boot a kernel with DIAGNOSTIC in single user mode,
	3. ifconfig tlp0 up
	4. suspend the system,
	5. resume the system,
	6. the system panics.

>Fix:
	The card doesn't powered up correctly.
	This patch fixes the problem.
	Is it correct?
	(Adding Cardbus_function_enable() only does not fix the problem.)

Index: if_tlp_cardbus.c
===================================================================
RCS file: /cvsroot/src/sys/dev/cardbus/if_tlp_cardbus.c,v
retrieving revision 1.38
diff -u -p -r1.38 if_tlp_cardbus.c
--- if_tlp_cardbus.c	2002/11/11 12:51:38	1.38
+++ if_tlp_cardbus.c	2003/06/09 14:09:50
@@ -581,8 +581,10 @@ tlp_cardbus_power(sc, why)
 		if (TULIP_IS_ENABLED(sc) == 0)
 			panic("tlp_cardbus_power");
 #endif
+		Cardbus_function_enable(csc->sc_ct); /* Power on the socket. */
 		tlp_cardbus_setup(csc);
-	}
+	} else
+		Cardbus_function_disable(csc->sc_ct);/* Power off the socket. */
 }
 
 void
>Release-Note:
>Audit-Trail:
>Unformatted: