Subject: kern/9218: Our PCMCIA code causes some CF cards to produce bogus data
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cgd@netbsd.org>
List: netbsd-bugs
Date: 01/17/2000 17:15:53
>Number: 9218
>Category: kern
>Synopsis: CF cards produce bogus data w/o our PCMCIA code, good otherwise
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 17 17:15:00 2000
>Last-Modified:
>Originator: Chris G. Demetriou
>Organization:
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
>Release: NetBSD-current sources as of today (20000117), morning PST
>Environment:
System: NetBSD 1.4P (GENERIC_NODDB) #23: Mon Jan 17 12:33:33 PST 2000 cgd@veal:/net/mp-fs/export/mphome/cgd/proj/netbsd/src/sys/arch/i386/compile/GENERIC_NODDB
kernel config is a trimmed down GENERIC. system is an HP Kayak P3@550
with an Antec DataChute PCMCIA Card adapter (on ISA). I was only able
to try this one system, because all of my other PCMCIA-enabled systems
run 1.4, and there the CF cards just hang the system...
>Description:
Our PCMCIA card appears to cause some CF cards to produce bogus data.
For instance, from a known-working SST 4MB CF card:
wdc2 at pcmcia1 function 0 port 0x330-0x33f
pcmcia1: card irq 14
wd0 at wdc2 channel 0 drive 0: <00000000000000000049448588>
wd0: drive supports 67-sector pio transfers, chs addressing
wd0: 0MB, 33924 cyl, 0 head, 2 sec, 512 bytes/sect x 0 sectors
stray interrupt 14
wd0 detached
wdc2 detached
Note the bogus geometry, etc. Also, the model number string
provided there is bogus, though that's not obvious unless you have
more information (e.g. the identify data returned from a
properly-functioning implementation).
Some other CF cards work fine, e.g. a Simple Technology 32MB card:
wdc2 at pcmcia1 function 0 port 0x330-0x33f
pcmcia1: card irq 14
wd0 at wdc2 channel 0 drive 0: <Hitachi CV 7.1.1>
wd0: drive supports 1-sector pio transfers, lba addressing
wd0: 30MB, 492 cyl, 4 head, 32 sec, 512 bytes/sect x 62976 sectors
stray interrupt 14
wd0 detached
wdc2 detached
OK Cards:
Kingston 16MB.
Kingston 32MB.
Simple Technology 32MB (shown above/below).
SanDisk/Kodak Picture Card 16MB.
IBM Microdrive 340MB.
Losing Cards:
SST 4MB (shown above/below)
SST 32MB card
Kingston 8MB Card
The kernel identifies the PCMCIA controller itself as:
pcic2 at isapnp0 port 0x3e0/2
pcic2: VIA PCMCIA CARD (ident 0x82 OK): using iomem 0xc8000 iosiz 0x4000 irq 5
pcic2: controller 0 (Cirrus PD672X) has sockets A and B
pcmcia0 at pcic2 controller 0 socket 0
pcmcia1 at pcic2 controller 0 socket 1
Here's output printed from a known-good source including information
from the response to an ATA Identify for the SST 4MB Flash card
shown above as being broken under NetBSD:
cf1: 7872 blocks of 512 bytes = 4030464 total
cf1: Identify Drive Information
General configuration = 0x848a
Default cylinders = 123
Current cylinders = 123
Default heads = 2
Current heads = 2
Bytes per track = 0
Bytes per sector = 528
Default sectors per track = 32
Current sectors per track = 32
Sectors per card = 7872
Current capacity in sectors = 7872
Addressable sectors = 7872
Serial number: SS1T1100000000009458
Buffer type: dual port
Buffer size = 4096
ECC bytes = 8
Firmware revision: CF-2A
Model number: SST48CF004C-2A CompactFlash Memory Card
Capabilities: LBA
PIO timing = 0x0100
Multiple sectors setting = 0x0100
That's from custom firmware running on an sa1100, where the CF
card is in one of the SA-1100's PCMCIA slots.
Note the serial number, and its partial correspondence with the
model number printed by NetBSD. In particular, note how:
9458 -> 49448588
Kinda weird, probably a clue.
The complete kernel output generated by insertion of the same
non-working SST 4MB card when pcic_debug, pcicisa_debug,
pcicsubr_debug, pcmcia_debug, pcmciaintr_debug, and pcmciacis_debug
are set to 1 is below:
pcic2: intr
pcic2: 40 CD 1b
pcic2: intr
pcic2: 40 CD 1f
pcic2: insertion event
pcic2: pcic_chip_socket_enable 40 cardtype mem 40
pcic_chip_mem_map window 0 bus c8000+0+400 at card addr 0
pcic_chip_do_mem_map window 0: 00c8 80c8 7f38
cis mem map f7ed7000
pcmcia1: CIS tuple chain:
CISTPL_DEVICE type=funcspec speed=100ns
01 03 dc 01 ff
unhandled CISTPL 1c
1c 04 02 db 01 ff
unhandled CISTPL 18
18 02 df 01
CISTPL_MANFID
20 04 bf 00 01 00
CISTPL_VERS_1
15 22 04 01 53 53 54 00 34 38 43 46 30 30 34 00
35 35 4c 44 30 31 36 2d 33 41 00 46 57 32 41 20
20 20 00 ff
CISTPL_FUNCID
21 02 04 01
unhandled CISTPL 22
22 02 01 01
unhandled CISTPL 22
22 03 02 0c 0f
CISTPL_CONFIG
1a 05 01 03 00 02 0f
CISTPL_CFTABLE_ENTRY
1b 0a c0 40 a1 07 55 4d 5d 08 00 20
CISTPL_CFTABLE_ENTRY
1b 05 00 01 01 b5 1e
CISTPL_CFTABLE_ENTRY
1b 0c c1 41 99 07 55 4d 5d 64 f0 ff ff 20
CISTPL_CFTABLE_ENTRY
1b 05 01 01 01 b5 1e
CISTPL_CFTABLE_ENTRY
1b 11 c2 41 99 07 55 4d 5d ea 61 f0 01 07 f6 03
01 ee 20
CISTPL_CFTABLE_ENTRY
1b 05 02 01 01 b5 1e
CISTPL_CFTABLE_ENTRY
1b 11 c3 41 99 07 55 4d 5d ea 61 70 01 07 76 03
01 ee 20
CISTPL_CFTABLE_ENTRY
1b 05 03 01 01 b5 1e
CISTPL_NO_LINK
14 00
CISTPL_END
ff
pcic_chip_socket_disable
pcic2: pcic_chip_socket_enable 40 cardtype mem 40
pcic_chip_mem_map window 0 bus c8000+0+400 at card addr 0
pcic_chip_do_mem_map window 0: 00c8 80c8 7f38
cis mem map f7ed7000
pcmcia1: CIS tuple chain:
01 03 dc 01 ff
1c 04 02 db 01 ff
18 02 df 01
20 04 bf 00 01 00
15 22 04 01 53 53 54 00 34 38 43 46 30 30 34 00
35 35 4c 44 30 31 36 2d 33 41 00 46 57 32 41 20
20 20 00 ff
21 02 04 01
pcic_chip_socket_disable
wdc2 at pcmcia1 function 0pcic_chip_io_alloc alloc port 330+10
pcic2: pcic_chip_socket_enable 40 cardtype io 60
pcmcia1: ++enabled_count = 1
pcic_chip_mem_map window 0 bus c8000+200+14 at card addr 0
pcic_chip_do_mem_map window 0: 00c8 80c8 7f38
pcmcia1: function 0 CCR at 0 offset 200: 41 a0 2e 0, 0 0 0 0, 0
pcic_chip_io_map window 0 auto port 330+10
port 0x330-0x33fpcic_chip_do_io_map win 0 addr 330 size 10 width 0
pcmcia1: card irq 14
wd0 at wdc2 channel 0 drive 0: <00000000000000000049448588>
wd0: drive supports 67-sector pio transfers, chs addressing
wd0: 0MB, 33924 cyl, 0 head, 2 sec, 512 bytes/sect x 0 sectors
pcic_chip_socket_disable
pcmcia1: --enabled_count = 0
pcmcia1: function 0 CCR at 0 offset 200: ff ff ff ff, ff ff ff ff, ff
For comparison, sa1100 firmware output from the
Simple Tech. 32MB card is:
cf1: 62976 blocks of 512 bytes = 32243712 total
cf1: Identify Drive Information
General configuration = 0x848a
Default cylinders = 492
Current cylinders = 492
Default heads = 4
Current heads = 4
Bytes per track = 0
Bytes per sector = 512
Default sectors per track = 32
Current sectors per track = 32
Sectors per card = 62976
Current capacity in sectors = 62976
Addressable sectors = 62976
Serial number:
Buffer type: dual port
Buffer size = 1024
ECC bytes = 4
Firmware revision: Rev 1.01
Model number: Hitachi CV 7.1.1
Capabilities: LBA
PIO timing = 0x0100
Multiple sectors setting = 0x0100
and kernel output is:
pcic2: intr
pcic2: 40 CD 17
pcic2: intr
pcic2: 40 CD 13
pcic2: intr
pcic2: 40 CD 7
pcic2: intr
pcic2: 40 CD f
pcic2: enqueing INSERTION event
pcic2: insertion event
pcic2: pcic_chip_socket_enable 40 cardtype mem 40
pcic_chip_mem_map window 0 bus c8000+0+400 at card addr 0
pcic_chip_do_mem_map window 0: 00c8 80c8 7f38
cis mem map f7ed7000
pcmcia1: CIS tuple chain:
CISTPL_DEVICE type=funcspec speed=ext
01 04 df 4a 01 ff
unhandled CISTPL 1c
1c 04 02 d9 01 ff
unhandled CISTPL 18
18 02 df 01
CISTPL_MANFID
20 04 4d 01 01 00
CISTPL_VERS_1
15 31 04 01 53 69 6c 69 63 6f 6e 54 65 63 68 2c
49 6e 63 2e 00 33 32 4d 42 20 43 6f 6d 70 61 63
74 20 50 43 20 43 61 72 64 00 56 65 72 20 33 2e
30 00 ff
CISTPL_FUNCID
21 02 04 01
unhandled CISTPL 22
22 02 01 01
unhandled CISTPL 22
22 03 02 0c 0f
CISTPL_CONFIG
1a 05 01 03 00 02 0f
CISTPL_CFTABLE_ENTRY
1b 08 c0 40 a1 01 55 08 00 20
CISTPL_CFTABLE_ENTRY
1b 06 00 01 21 b5 1e 4d
CISTPL_CFTABLE_ENTRY
1b 0a c1 41 99 01 55 64 f0 ff ff 20
CISTPL_CFTABLE_ENTRY
1b 06 01 01 21 b5 1e 4d
CISTPL_CFTABLE_ENTRY
1b 0f c2 41 99 01 55 ea 61 f0 01 07 f6 03 01 ee
20
CISTPL_CFTABLE_ENTRY
1b 06 02 01 21 b5 1e 4d
CISTPL_CFTABLE_ENTRY
1b 0f c3 41 99 01 55 ea 61 70 01 07 76 03 01 ee
20
CISTPL_CFTABLE_ENTRY
1b 06 03 01 21 b5 1e 4d
CISTPL_NO_LINK
14 00
CISTPL_END
ff
pcic_chip_socket_disable
pcic2: pcic_chip_socket_enable 40 cardtype mem 40
pcic_chip_mem_map window 0 bus c8000+0+400 at card addr 0
pcic_chip_do_mem_map window 0: 00c8 80c8 7f38
cis mem map f7ed7000
pcmcia1: CIS tuple chain:
01 04 df 4a 01 ff
1c 04 02 d9 01 ff
18 02 df 01
20 04 4d 01 01 00
15 31 04 01 53 69 6c 69 63 6f 6e 54 65 63 68 2c
49 6e 63 2e 00 33 32 4d 42 20 43 6f 6d 70 61 63
74 20 50 43 20 43 61 72 64 00 56 65 72 20 33 2e
30 00 ff
21 02 04 01
pcic_chip_socket_disable
wdc2 at pcmcia1 function 0pcic_chip_io_alloc alloc port 330+10
pcic2: pcic_chip_socket_enable 40 cardtype io 60
pcmcia1: ++enabled_count = 1
pcic_chip_mem_map window 0 bus c8000+200+14 at card addr 0
pcic_chip_do_mem_map window 0: 00c8 80c8 7f38
pcmcia1: function 0 CCR at 0 offset 200: 41 a0 2e 0, ff ff ff ff, ff
pcic_chip_io_map window 0 auto port 330+10
port 0x330-0x33fpcic_chip_do_io_map win 0 addr 330 size 10 width 0
pcmcia1: card irq 14
wd0 at wdc2 channel 0 drive 0: <Hitachi CV 7.1.1>
wd0: drive supports 1-sector pio transfers, lba addressing
wd0: 30MB, 492 cyl, 4 head, 32 sec, 512 bytes/sect x 62976 sectors
pcic_chip_socket_disable
pcmcia1: --enabled_count = 0
pcmcia1: function 0 CCR at 0 offset 200: ff ff ff ff, ff ff ff ff, ff
>How-To-Repeat:
see above. I can easily provide more information if somebody will
tell me how to obtain it; this is easily reproducable for me.
>Fix:
unknown. Maybe it's a bug in the wd/wdc code, rather than the
pcmcia code itself though...
>Audit-Trail:
>Unformatted: