i386/67050: CardBus (PCI ?) resource allocation problem
Hiroyuki Aizu
eyes at navi.org
Sat May 22 09:10:44 PDT 2004
>Number: 67050
>Category: i386
>Synopsis: CardBus (PCI ?) resource allocation problem
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-i386
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat May 22 09:10:24 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator: Hiroyuki Aizu
>Release: FreeBSD 5.2-CURRENT
>Organization:
navi.org
>Environment:
FreeBSD ayers.navi.org 5.2-CURRENT FreeBSD 5.2-CURRENT #15: Sun May 16 17:23:16 JST 2004 aizu at ayers.navi.org:/usr/src/sys/i386/compile/ONE i386
>Description:
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: <Texas Instruments TSB43AB22/A> 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: <Texas Instruments TSB43AB22/A> 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: <IEEE1394(FireWire) bus> on fwohci0
sbp0: <SBP-2/SCSI over FireWire> 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)
-------------------------------------------------------------------------
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
>>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: <Texas Instruments TSB43AB22/A> 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...
More information about the freebsd-i386
mailing list