From owner-freebsd-mobile@FreeBSD.ORG Sat Feb 23 20:39:38 2008 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EB7416A401 for ; Sat, 23 Feb 2008 20:39:38 +0000 (UTC) (envelope-from mickey242@gmx.net) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id E8BEA13C46B for ; Sat, 23 Feb 2008 20:39:37 +0000 (UTC) (envelope-from mickey242@gmx.net) Received: (qmail invoked by alias); 23 Feb 2008 20:39:35 -0000 Received: from port-ip-213-211-209-123.reverse.mdcc-fun.de (EHLO gunhead.enforcer.cc) [213.211.209.123] by mail.gmx.net (mp029) with SMTP; 23 Feb 2008 21:39:35 +0100 X-Authenticated: #8913523 X-Provags-ID: V01U2FsdGVkX19f5TNMUv9f+YwnZ2BNoxre1nhWVJvZ07BSPdIstk ocxvy1/Akb/CFs Message-ID: <47C08482.4050608@gmx.net> Date: Sat, 23 Feb 2008 21:39:30 +0100 From: Andreas Wetzel User-Agent: Thunderbird 2.0.0.9 (X11/20080216) MIME-Version: 1.0 To: freebsd-mobile@freebsd.org References: <47BE9CBC.6010500@gmx.net> <47BED4A6.7040501@gmx.net> In-Reply-To: <47BED4A6.7040501@gmx.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: Re: ThinkPad 600 - CardBus inoperative X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2008 20:39:38 -0000 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 real memory = 301793280 (287 MB) avail memory = 285884416 (272 MB) ath_hal: 0.9.20.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413) acpi0: 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: port 0x62,0x66 on acpi0 cpu0: on acpi0 acpi_throttle0: on cpu0 acpi_lid0: on acpi0 acpi_button0: on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 cbb0: mem 0x20301000-0x20301fff at device 2.0 on pci0 cbb0: Found memory at 20301000 cbb0: Secondary bus is 1 cardbus0: on cbb0 pccard0: <16-bit PCCard bus> on cbb0 cbb1: mem 0x20300000-0x20300fff at device 2.1 on pci0 cbb1: Found memory at 20300000 cbb1: Secondary bus is 4 cardbus1: on cbb1 pccard1: <16-bit PCCard bus> on cbb1 pci0: at device 3.0 (no driver attached) isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xfcf0-0xfcff at device 7.1 on pci0 ata0: on atapci0 ata1: on atapci0 uhci0: port 0x8400-0x841f irq 7 at device 7.2 on pci0 uhci0: [GIANT-LOCKED] usb0: 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: 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: on intpm0 smbus1: on intsmb0 smb0: on smbus1 intpm0: PM I/O mapped ef00 acpi_tz0: on acpi0 acpi_tz1: on acpi0 acpi_tz2: on acpi0 fdc0: 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: port 0x2f8-0x2ff irq 3 drq 3 on acpi0 sio1: type 16550A speaker0: port 0x61 on acpi0 atkbdc0: port 0x60,0x64 irq 1 on acpi0 atkbd0: irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: model Generic PS/2 mouse, device ID 0 battery0: on acpi0 acpi_acad0: on acpi0 pmtimer0 on isa0 orm0: at iomem 0xc0000-0xc9fff on isa0 sc0: at flags 0x100 on isa0 sc0: VGA <12 virtual consoles, flags=0x300> vga0: 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: 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 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.