Subject: cardbus fwohci detach
To: Ichiro Fukuhara <ichiro@netbsd.org>
From: Love <lha@stacken.kth.se>
List: current-users
Date: 12/29/2001 23:16:02
> Date: Sat, 29 Dec 2001 14:26:33 +0200 (EET)
> From: Ichiro Fukuhara <ichiro@netbsd.org>
> To: source-changes@netbsd.org
> Subject: CVS commit: syssrc/sys/dev
> Message-Id: <20011229122633.49131B005@cvs.netbsd.org>
> 
> Module Name:	syssrc
> Committed By:	ichiro
> Date:		Sat Dec 29 12:26:32 UTC 2001
> 
> Modified Files:
> 	syssrc/sys/dev/cardbus: fwohci_cardbus.c
> 	syssrc/sys/dev/ieee1394: fwohci.c fwohcivar.h
> 
> Log Message:
> implement fwohci detach routine.

But this doesn't free all resources ?

Like killing the event thread, g/c all underlaying fwnodes, and freeing all
dma buffers, detaching event counters, etc.

Also, if the card is sharing the irq with the cardbus controller,
interesting things happened in fwohci_intr(), it never exited and it hang
for me.

See mail I sent to current-users
<http://mail-index.netbsd.org/current-users/2001/12/13/0001.html>. That
patch isn't perfect since it seems that somethings I free dma-buffer that
already have been free-ed. I never got comments from anyone on this patch.

BTW I have problems with my ohci cardbus card. It never seen any new nodes
when I insert then on the bus.

If I insert the card with the fw-cable connected to other devices it
sometimes sees the other devices. But if I set a breakpoint in
fwohci_phy_busreset() in ddb and wait ~ 1-2 sec before continuting, it
almost always works.

When it doesn't work, it hangs somehere where its reading the rom of the
other device. I've appended part of my msgbuf with some comments.

Love

NetBSD 1.5ZA (NUTCRACKER) #49: Sat Dec 29 20:36:27 CET 2001
    lha@nutcracker.stacken.kth.se:/usr/src/sys/arch/i386/compile/NUTCRACKER
cpu0: Intel Pentium III (Coppermine) (686-class), 697.45 MHz
cpu0: I-cache 16 KB 32b/line 4-way, D-cache 16 KB 32b/line 2-way
cpu0: L2 cache 256 KB 32b/line 8-way
cpu0: features 383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features 383f9ff<PGE,MCA,CMOV,FGPAT,PSE36,MMX,FXSR,SSE>
[....]
cbb0 at pci0 dev 2 function 0: Texas Instruments PCI1450 PCI-CardBus Bridge (rev. 0x03)
cbb1 at pci0 dev 2 function 1: Texas Instruments PCI1450 PCI-CardBus Bridge (rev. 0x03)
cbb0: interrupting at irq 7
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 2 device 0
pcmcia0 at cardslot0
cbb1: interrupting at irq 10
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 3 device 0
pcmcia1 at cardslot1
[....]

Here I just insert the device.

fwohci0 at cardbus1 dev 0 function 0: VIA Technologies VT3606 OCHI IEEE 1394 Controller (rev. 0x43)
fwohci0: interrupting at 10
fwohci0: OHCI 1.0, 00:01:08:10:00:00:0f:05, 400Mb/s, 2048 max_rec, 8 iso_ctx
fw0 at fwohci0: 00:01:08:10:00:00:0f:05:0a:02:20:00:00:00:00:00
fwctl0 at fwohci0fw0 detached
fwctl0 detached
fwohci0 detached

Here I set a breakpoint in fwohci_phy_busreset in ddb.

fwohci0 at cardbus1 dev 0 function 0: VIA Technologies VT3606 OCHI IEEE 1394 Controller (rev. 0x43)
fwohci0: interrupting at 10
fwohci0: OHCI 1.0, 00:01:08:10:00:00:0f:05, 400Mb/s, 2048 max_rec, 8 iso_ctx
fw0 at fwohci0: 00:01:08:10:00:00:0f:05:0a:02:20:00:00:00:00:00
fwctl0 at fwohci0fwohci0: nodeid=0xffc0(0), rootid=1, irmid=0
fw0: Updating nodeid to 0
fwnode0 at fwohci0 Node 1: UID 00:d0:4b:00:e0:00:99:00
[.....]
fwnode0: Link Speed: 100Mb/s, max_rec: 64 bytes
found_sbp2: 0x0000c000
Root directory:

Node-Capabilities: 0x000083c0
Module-Vendor-Id: 0x0000d04b
Textual-Descriptor: Wise Advanced Co., Ltd.     
Module-Hw-Version: 0x0000f911
Textual-Descriptor: FWIDE   

    Unit directory:

    Unit-Spec-Id: 0x0000609e
    Unit-Sw-Version: 0x00010483
    SBP2 Firmware Revision: 0x00000130
    SBP2 Management Agent: 0x0000c000
    SBP2 Unit Characteristics: 0x00003c08
    SBP2 Command Set Spec Id: 0x0000609e
    SBP2 Command Set: SCSI 2
    SBP2 Command Set Revision: 0x00000000
    SBP2 Reconnect Timeout: 0x00000003
    SBP2 Logical Unit Number: 0x004e0000
    Model: 0x00000001
    Textual-Descriptor: Wise Advanced IDE Devices   
    Root-Directory: 0x00000000
    Root-Directory: 0x00000000
    Root-Directory: 0x00000000
csr: 0x0000400000000020
0: 0x00100000
1: 0xffc1ffff
2: 0xf0010000
3: 0x00000000
csr: 0x0000400000000030
0: 0x41004000
1: 0x00000000