From owner-freebsd-i386@FreeBSD.ORG Fri Jan 20 18:30:09 2006 Return-Path: X-Original-To: freebsd-i386@hub.freebsd.org Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16F1316A41F for ; Fri, 20 Jan 2006 18:30:09 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16FC743D45 for ; Fri, 20 Jan 2006 18:30:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k0KIU6dV027610 for ; Fri, 20 Jan 2006 18:30:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k0KIU6g7027604; Fri, 20 Jan 2006 18:30:06 GMT (envelope-from gnats) Resent-Date: Fri, 20 Jan 2006 18:30:06 GMT Resent-Message-Id: <200601201830.k0KIU6g7027604@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Helge Oldach Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D70C216A41F for ; Fri, 20 Jan 2006 18:20:54 +0000 (GMT) (envelope-from hmo@sep.oldach.net) Received: from rigel.oldach.net (rigel.oldach.net [194.8.96.250]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B05843D45 for ; Fri, 20 Jan 2006 18:20:53 +0000 (GMT) (envelope-from hmo@sep.oldach.net) Received: from sep.oldach.net (p548FAD37.dip0.t-ipconnect.de [84.143.173.55]) by rigel.oldach.net (8.13.4/8.13.4/hmo30jul04) with ESMTP id k0KIKluL039385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Jan 2006 19:20:48 +0100 (CET) (envelope-from hmo@sep.oldach.net) Received: from sep.oldach.net (localhost [127.0.0.1]) by sep.oldach.net (8.13.4/8.13.4/hmo26jun05) with ESMTP id k0KIKkaJ002115 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Jan 2006 19:20:46 +0100 (CET) (envelope-from hmo@sep.oldach.net) Received: (from hmo@localhost) by sep.oldach.net (8.13.4/8.13.4/Submit/hmo26jun05) id k0KIKjno002114; Fri, 20 Jan 2006 19:20:45 +0100 (CET) (envelope-from hmo) Message-Id: <200601201820.k0KIKjno002114@sep.oldach.net> Date: Fri, 20 Jan 2006 19:20:45 +0100 (CET) From: Helge Oldach To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: i386/92070: wi0: No irq?! with LG 11Mbps Wireless LAN PCI Card X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Helge Oldach List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2006 18:30:09 -0000 >Number: 92070 >Category: i386 >Synopsis: wi0: No irq?! with LG 11Mbps Wireless LAN PCI Card >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 20 18:30:05 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Helge Oldach >Release: FreeBSD 5.4-STABLE i386 >Organization: >Environment: System: FreeBSD localhost 5.4-STABLE FreeBSD 5.4-STABLE #602: Fri Jan 20 15:43:51 CET 2006 toor@localhost:/usr/obj/usr/src/sys/HMO i386 >Description: I own an LG Electronics LW1100P wireless LAN PCI board, consisting of a Texas Instruments TI-1211 PCI-CardBus bridge and a wi(4)-compatible PCCARD. This card is recognized with an OLDCARD kernel but not with a(n almost) GENERIC kernel. Please see i386/91919 for another issue with this specific card. However this one is independent. With the patch from this PR the card is being recognized as follows: cbb0: at device 15.0 on pci0 cbb0: Found memory at 80000000 cbb0: Secondary bus is 0 cbb0: Secondary bus set to 2 subbus 3 cardbus0: on cbb0 pccard0: <16-bit PCCard bus> on cbb0 Status is 0x30001851 cbb0: card inserted: event=0x00000000, state=30001851 pccard0: chip_socket_enable cbb_pcic_socket_enable: cbb0: cbb_power: 3V pccard0: read_cis cis mem map 0xd31ad000 (resource: 0x88000000) pccard0: CIS tuple chain: CISTPL_DEVICE type=null speed=null 01 03 00 00 ff CISTPL_DEVICE_A type=sram speed=ext 17 04 67 5a 08 ff unhandled CISTPL 1d 1d 05 03 67 5a 08 ff CISTPL_VERS_1 15 32 05 00 4c 47 00 31 31 4d 62 70 73 20 57 69 72 65 6c 65 73 73 20 4c 41 4e 20 50 43 49 20 43 61 72 64 00 56 65 72 73 69 6f 6e 20 30 31 2e 30 32 00 00 ff CISTPL_MANFID 20 04 56 01 02 00 CISTPL_FUNCID 21 02 06 00 CISTPL_FUNCE 22 02 01 07 CISTPL_FUNCE 22 05 02 40 42 0f 00 CISTPL_FUNCE 22 05 02 80 84 1e 00 CISTPL_FUNCE 22 05 02 60 ec 53 00 CISTPL_FUNCE 22 05 02 c0 d8 a7 00 CISTPL_FUNCE 22 02 03 07 CISTPL_FUNCE 22 08 04 06 00 04 47 50 15 3a CISTPL_FUNCE 22 02 05 01 CISTPL_CONFIG 1a 07 03 01 e0 03 00 00 01 CISTPL_CFTABLE_ENTRY 1b 0d c1 01 09 77 b5 1e 35 b5 3c 36 36 05 46 CISTPL_END ff cis mem map d31ad000 CISTPL_LINKTARGET expected, code 00 observed pccard0: check_cis_quirks pccard0: CIS version PC Card Standard 5.0 pccard0: CIS info: LG, 11Mbps Wireless LAN PCI Card, Version 01.02, pccard0: Manufacturer code 0x156, product 0x2 pccard0: function 0: network adapter, ccr addr 3e0 mask 1 pccard0: function 0, config table entry 1: I/O card; irq mask 0; iomask 6, iospace 0-3f; io16 pccard0: functions scanning pccard0: Card has 1 functions. pccard_mfc is 0 pccard0: I/O rid 0 start 0 end ffffffff cbb_pcic_socket_enable: cbb0: cbb_power: 0V cbb0: cbb_power: 3V pccard0: ccr_res == 88000000-880003ff, base=3e0 pccard0: function 0 CCR at 0 offset 3e0: 41 80 22 ff, ff ff ff ff, ff wi0: at port 0x100-0x13f function 0 config 1 on pccard0 wi0: No irq?! device_attach: wi0 attach returned 6 What is odd is the lack of an IRQ for the card. (With OLDCARD it is correctly assigned irq 11.) There is only a single function in the CIS, with a single configuration table entry that we need to analyze: CISTPL_CFTABLE_ENTRY 1b 0d c1 01 09 77 b5 1e 35 b5 3c 36 36 05 46 1b is the CISTPL_CFTABLE_ENTRY tag 0d is the length of this entry c1 says that the default interface is interface 1 01 says that we are interface 1 09 says there follows a power (0x01) and an iospace (0x08) subfunction, but there is no timing, irq, memspace, or misc subfunction This is reflected by the debug output: pccard0: function 0, config table entry 1: I/O card; irq mask 0; iomask 6, iospace 0-3f; io16 The issue is the lack of an irq mask. I don't understand the PCMCIA specs to well, but it appears that the card is going to tell us "I don't care about the actual IRQ" which is not too unreasonable for a card that is attached to a PCI-PCCARD bridge. However, since this is an I/O card, it clearly needs an IRQ. But the IRQ mask remains initialized to zero, which effectively disables all IRQs for this card. Hence the "No irq?!" output from device_attach. I think the best approach would be to initialize the IRQ mask not to zero, but to 0xffff. This would permit all IRQs, unless the CIS specifies an IRQ mask explicitely. For I/O cards this should be the normal behaviour. For memory cards a pre-assigned IRQ mask doesn't harm - they don't need an IRQ anyway. The trivial patch below implements this default 0xffff IRQ mask. There are certainly other approaches to this problem, e.g. interpreting a zero cfe->irqmask as "don't care about the IRQ" upon device attachment. Note again that OLDCARD does it the Right Way; so the correct solution should probably be stolen from OLDCARD (from pccardd?). Note also that this issue is likely also present in 6-STABLE and CURRENT. >How-To-Repeat: >Fix: --- src/sys/dev/pccard/pccard_cis.c.ctm Thu Feb 3 07:44:38 2005 +++ src/sys/dev/pccard/pccard_cis.c Fri Jan 20 15:32:17 2006 @@ -1135,6 +1144,8 @@ cfe->irqmask = (1 << (reg & PCCARD_TPCE_IR_IRQ)); } + } else { + cfe->irqmask = 0xffff; } if (memspace) { if (tuple->length <= idx) { >Release-Note: >Audit-Trail: >Unformatted: