From owner-freebsd-current@FreeBSD.ORG Sun May 16 02:50:49 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B56CF16A4CE for ; Sun, 16 May 2004 02:50:49 -0700 (PDT) Received: from st68.arena.ne.jp (st68.arena.ne.jp [203.138.213.2]) by mx1.FreeBSD.org (Postfix) with SMTP id 4236E43D4C for ; Sun, 16 May 2004 02:50:47 -0700 (PDT) (envelope-from eyes@navi.org) Received: (qmail 23877 invoked by SAV 20040515.9); 16 May 2004 18:50:45 +0900 Received: from unknown (HELO localhost) (220.221.66.250) by st68.arena.ne.jp (203.138.213.118) with SMTP; 16 May 2004 18:50:45 +0900 Date: Sun, 16 May 2004 18:52:18 +0900 From: Hiroyuki Aizu To: current@freebsd.org Message-Id: <20040516185218.2a1d27a2.eyes@navi.org> Organization: navi.org X-Mailer: Sylpheed version 0.9.9-gtk2-20040229 (GTK+ 2.4.1; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: CardBus (PCI ?) resource allocation problem report. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2004 09:50:49 -0000 Hi I have trouble with IEEE1394 CardBus card on 5-current. I think it is CardBus(PCI ?) resource allocation problem. I'll figure out this. The card cannot attached on 5-current as below message. (with hw.cardbus.debug=1 and hw.cardbus.cis_debug=1) ------------------------------------------------------------------------- cardbus1: Expecting link target, got 0x42 cardbus1: Resource not specified in CIS: id=10, size=800 cardbus1: Resource not specified in CIS: id=14, size=4000 cardbus1: Resource not specified in CIS: id=18, size=800 cardbus1: Non-prefetchable memory at 88008000-8800cfff fwohci0: mem 0x8800c000-0x8800c7ff,0x88008000-0x8800bfff,0x8800c800-0x8800cfff irq 10 at device 0.0 on cardbus1 fwohci0: [GIANT-LOCKED] fwohci0: OHCI version ff.ff (ROM=1) fwohci0: invalid OHCI version fwohci0: fwohci_init failed with err=6 device_probe_and_attach: fwohci0 attach returned 5 cbb1: CardBus card activation failed ------------------------------------------------------------------------- Next, I was patched to /sys/dev/cardbus/cardbus_cis.c like below. (Yes, this is very dirty hack. Just for trouble shooting.) ------------------------------------------------------------------------- --- cardbus_cis.c.orig Mon Apr 12 04:22:25 2004 +++ cardbus_cis.c Sun May 16 17:23:03 2004 @@ -993,6 +993,9 @@ cardbus_add_map(device_t cbdev, device_t static void cardbus_pickup_maps(device_t cbdev, device_t child) { +#if 1 + cardbus_add_map(cbdev, child, PCIR_BAR(0)); +#else struct cardbus_devinfo *dinfo = device_get_ivars(child); int reg; @@ -1003,6 +1006,7 @@ cardbus_pickup_maps(device_t cbdev, devi */ for (reg = 0; reg < dinfo->pci.cfg.nummaps; reg++) cardbus_add_map(cbdev, child, PCIR_BAR(reg)); +#endif } int ------------------------------------------------------------------------- The card works fine on patched kernel like below. ------------------------------------------------------------------------- cardbus1: Expecting link target, got 0x42 cardbus1: Resource not specified in CIS: id=10, size=800 cardbus1: Non-prefetchable memory at 88001000-880017ff fwohci0: mem 0x88001000-0x880017ff irq 10 at device 0.0 on cardbus1 fwohci0: [GIANT-LOCKED] fwohci0: OHCI version 1.10 (ROM=1) fwohci0: No. of Isochronous channel is 4. fwohci0: EUI64 00:40:26:01:04:04:4e:ef fwohci0: Phy 1394a available S400, 2 ports. fwohci0: Link S400, max_rec 2048 bytes. firewire0: on fwohci0 sbp0: on firewire0 fwohci0: Initiate bus reset fwohci0: node_id=0xc000ffc0, gen=1, CYCLEMASTER mode firewire0: 1 nodes, maxhop <= 0, cable IRM = 0 (me) firewire0: bus manager 0 (me) ------------------------------------------------------------------------- >From difference between two debug messages, I think it is problem that kernel allocate non-requested resource from driver. It has side effects in this case. In the PCI firewire driver reqests I/O memory that specified with rid = 0x10 like this. (from /sys/dev/firewire/fwohci_pci.c) rid = PCI_CBMEM; /* (= PCIR_BAR(0) = 0x10) */ sc->bsr = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); But 5-curret kernel allocates all memory resource (rid = 0x10, 0x14, 0x18). fwohci0: mem 0x8800c000-0x8800c7ff,0x88008000-0x8800bfff,0x8800c800-0x8800cfff irq 10 at device 0.0 on cardbus1 With my patch, it prevent add surplus resource to resource list. (Yes I know, this is not real solution.) # And, I don't know why the IEEE1394 card does not works with all memory # resouces allocated...