Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Feb 2008 21:39:30 +0100
From:      Andreas Wetzel <mickey242@gmx.net>
To:        freebsd-mobile@freebsd.org
Subject:   Re: ThinkPad 600 - CardBus inoperative
Message-ID:  <47C08482.4050608@gmx.net>
In-Reply-To: <47BED4A6.7040501@gmx.net>
References:  <47BE9CBC.6010500@gmx.net> <rmiprupb2ij.fsf@fnord.ir.bbn.com> <47BED4A6.7040501@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
It seems like I have found a workaround for my ThinkPad 600 cardbus problem.
(I wouldn't call it a fix). Here is what I did:

--- /usr/src/sys/dev/cardbus/cardbus.c.orig     2008-02-23 20:44:08.000000000 
+0100
+++ /usr/src/sys/dev/cardbus/cardbus.c  2008-02-23 20:40:07.000000000 +0100
@@ -460,6 +460,7 @@
         device_t child;
         int cardattached = 0;
         int bus, slot, func;
+       int try;

         cardbus_detach_card(cbdev); /* detach existing cards */
         POWER_ENABLE_SOCKET(brdev, cbdev);
@@ -470,9 +471,17 @@
                 for (func = 0; func <= cardbusfunchigh; func++) {
                         struct cardbus_devinfo *dinfo;

-                       dinfo = (struct cardbus_devinfo *)
-                           pci_read_device(brdev, bus, slot, func,
-                               sizeof(struct cardbus_devinfo));
+                       for(try = 1, dinfo = NULL; !dinfo && try <= 3; try++)
+                       {
+                               dinfo = (struct cardbus_devinfo *)
+                                   pci_read_device(brdev, bus, slot, func,
+                                       sizeof(struct cardbus_devinfo));
+
+                               printf("cardbus_attach_card(): %d:%d:%d try %d 
%s\n",
+                                       bus, slot, func, try,
+                                       dinfo == NULL ? "FAILED" : "SUCCEEDED");
+                       }
+
                         if (dinfo == NULL)
                                 continue;
                         if (dinfo->pci.cfg.mfdev)



This small patch simply retries up to three times the read during card attach.
The first try fails, and returns NULL. But the second try succeeds, the card
gets initialized and is working properly. Perhaps someone with more in-depth
knowledge of the pci/cardbus stuff has an explanation, why that is happening.

As has been confirmed by others, the ThinkPad 600 also has some interrupt
routing issues. As far as I can tell, these can either be fixed by putting
some hw.pci.link.LNK?.irq tunables into /boot/loader.conf, or by using a fixed
ACPI DSDT. Both methods work for me, but the card not being initialized due to
the first read returning NULL, seems to be a different problem. Possibly sort
of timing problem???


/boot/loader.conf:

#acpi_dsdt_load="YES"
#acpi_dsdt_name="/boot/TP600.aml"
cpufreq_load="YES"
hw.cardbus.debug="1"
hw.cardbus.cis_debug="1"
hw.cbb.debug="1"
#hw.acpi.verbose="1"
#hw.cbb.start_memory=0xd8000
hw.pci.link.LNKA.irq="11"
hw.pci.link.LNKB.irq="10"
hw.pci.link.LNKC.irq="7"
hw.pci.link.LNKD.irq="7"


dmesg output:

Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
         The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 6.3-RELEASE #11: Sat Feb 23 20:45:46 CET 2008
     root@escape.enforcer.cc:/usr/obj/usr/src/sys/ESCAPE
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Pentium II/Pentium II Xeon/Celeron (298.42-MHz 686-class CPU)
   Origin = "GenuineIntel"  Id = 0x652  Stepping = 2
 
Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>
real memory  = 301793280 (287 MB)
avail memory = 285884416 (272 MB)
ath_hal: 0.9.20.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)
acpi0: <IBM TP600> on motherboard
acpi0: Power Button (fixed)
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0xef08-0xef0b on acpi0
acpi_ec0: <Embedded Controller: GPE 0x9, GLK> port 0x62,0x66 on acpi0
cpu0: <ACPI CPU> on acpi0
acpi_throttle0: <ACPI CPU Throttling> on cpu0
acpi_lid0: <Control Method Lid Switch> on acpi0
acpi_button0: <Sleep Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
cbb0: <TI1250 PCI-CardBus Bridge> mem 0x20301000-0x20301fff at device 2.0 on pci0
cbb0: Found memory at 20301000
cbb0: Secondary bus is 1
cardbus0: <CardBus bus> on cbb0
pccard0: <16-bit PCCard bus> on cbb0
cbb1: <TI1250 PCI-CardBus Bridge> mem 0x20300000-0x20300fff at device 2.1 on pci0
cbb1: Found memory at 20300000
cbb1: Secondary bus is 4
cardbus1: <CardBus bus> on cbb1
pccard1: <16-bit PCCard bus> on cbb1
pci0: <display, VGA> at device 3.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX4 UDMA33 controller> port 
0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xfcf0-0xfcff at device 7.1 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0x8400-0x841f irq 7 at 
device 7.2 on pci0
uhci0: [GIANT-LOCKED]
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
intpm0: <Intel 82371AB Power management controller> port 0xefa0-0xefaf irq 9 
at device 7.3 on pci0
intpm0: I/O mapped efa0
intpm0: intr IRQ 9 enabled revision 0
intpm0: [GIANT-LOCKED]
intsmb0: <Intel PIIX4 SMBUS Interface> on intpm0
smbus1: <System Management Bus> on intsmb0
smb0: <SMBus generic I/O> on smbus1
intpm0: PM I/O mapped ef00
acpi_tz0: <Thermal Zone> on acpi0
acpi_tz1: <Thermal Zone> on acpi0
acpi_tz2: <Thermal Zone> on acpi0
fdc0: <floppy drive controller (FDE)> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: [FAST]
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
sio1: <Generic IRDA-compatible device> port 0x2f8-0x2ff irq 3 drq 3 on acpi0
sio1: type 16550A
speaker0: <PC speaker> port 0x61 on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Generic PS/2 mouse, device ID 0
battery0: <ACPI Control Method Battery> on acpi0
acpi_acad0: <AC Adapter> on acpi0
pmtimer0 on isa0
orm0: <ISA Option ROM> at iomem 0xc0000-0xc9fff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <12 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounter "TSC" frequency 298423427 Hz quality 800
Timecounters tick every 1.000 msec
ipfw2 initialized, divert enabled, rule-based forwarding disabled, default to 
deny, logging unlimited
Status is 0x30000106
Status is 0x30000920
cbb1: card inserted: event=0x00000000, state=30000920
cbb1: cbb_power: 3V
cardbus_attach_card(): 4:0:0 try 1 FAILED
cardbus_attach_card(): 4:0:0 try 2 SUCCEEDED
TUPLE: LINKTARGET [3]: 43 49 53
Manufacturer ID: 71021200
TUPLE: Unknown(0x04) [6]: 03 01 00 00 00 00
TUPLE: Unknown(0x05) [14]: 41 b1 39 b5 1e 2d 4e 56 30 ff ff 02 e9 00
cardbus1: Opening BAR: type=MEM, bar=10, len=10000
CIS reading done
cardbus1: Non-prefetchable memory at 88000000-8800ffff
ath0: <Atheros 5212> mem 0x88000000-0x8800ffff irq 10 at device 0.0 on cardbus1
ath0: Ethernet address: 00:19:e0:83:b0:41
ath0: mac 7.9 phy 4.5 radio 5.6
ad0: 4887MB <IBM DADA-25120 AD5IA40A> at ata0-master UDMA33
Trying to mount root from ufs:/dev/ad0s2a


-- 
Keep it icy man.
I don't want to end up a corpse before my time because you were daydreaming.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C08482.4050608>