Subject: Compact Flash II HD problems causing file system corruption
To: None <tech-kern@NetBSD.ORG>
From: James Lees Vodanovich <jim@comdotcom.com.au>
List: tech-kern
Date: 01/12/2005 14:57:38
I ask here because this seems a non port specific kernel problem, though the 
system is a hpcarm running NetBSD 2.0.
The drive is a magicstor 2.2.Gig which works fine under Win CE

Firstly I had to disable DMA with
wd*     at atabus? drive ? flags 0x0ffb  #use PIO mode 3 or less



I can disklabel and newfs but writing to the drive causes file system 
corruption. If i set the idle and standby timers to 0 the errors are a lot 
less. 

If have tried dkctl wd0 setcache r  
But the dk wd0 getcache reports write cache as stll being enabled

dkctl wd0 setcache r 

dkctl wd0 getcache
/dev/rwd0d: read cache enabled
/dev/rwd0d: write-back cache enabled
/dev/rwd0d: read cache enable is not changeable
/dev/rwd0d: write cache enable is changeable
/dev/rwd0d: cache parameters are not savable

also 
dkctl wd0 synccache
dkctl: /dev/rwd0d: sync cache: Operation not supported by device


Errors 

Often after coping several large files to a freshly created fs the fs fails a 
fsck with mangled or missng super blocks.

wdc0:0:0: read intr before drq
wd0a: device timeout reading fsbn 48 of 48-59 (wd0 bn 512112; cn 250 tn 3 sn 
16), retrying
wd0: soft error (corrected)
dev = 0x1000, block = 67520, fs = /mnt
panic: blkfree: freeing free block
Stopped in pid 1426.1 (tar) at  netbsd:cpu_Debugger+0x4:      mov     r15, r14


On a freshly created filesystem

# tar -xf  root.tar
wdc0:0:0: lost interrupt
        type: ata tc_bcount: 8192 tc_skip: 0
wd0f: device timeout reading fsbn 176 of 176-191 (wd0 bn 1024240; cn 500 tn 7 
sn 16), retrying
wd0: soft error (corrected)
tar: Cannot identify format. Searching...
dmode ffd0 mode ffd0 dgen 0 gen 0
size ffd0ffd0ffd0ffd0 blocks 0
ino 4 ipref 2
panic: ffs_valloc: dup alloc
Stopped in pid 1517.1 (tar) at  netbsd:cpu_Debugger+0x4:      mov     r15, r14




Dmesg Entry
pcmcia0: CIS version PCMCIA 2.0 or 2.1
pcmcia0: CIS info: RIOSPRING, MICRODRIVE2
pcmcia0: Manufacturer code 0xa4, product 0x0
pcmcia0: function 0: fixed disk(ata), ccr addr 200 mask f
pcmcia0: function 0, config table entry 0: memory card; irq mask 0; memspace 
0-7ff; mwait_required rdybsy_active powerdown
pcmcia0: function 0, config table entry 1: I/O card; irq mask ffff; iomask 4, 
iospace 0-f; memspace 0-7ff; rdybsy_active io8 io16 irqshare irqpulse 
irqlevel powerdown
pcmcia0: function 0, config table entry 2: I/O card; irq mask 4000; iomask a, 
iospace 1f0-1f7 3f6-3f7; memspace 0-7ff; rdybsy_active io8 io16 irqshare 
irqpulse irqlevel powerdown
pcmcia0: function 0, config table entry 3: I/O card; irq mask 4000; iomask a, 
iospace 170-177 376-377; memspace 0-7ff; rdybsy_active io8 io16 irqshare 
irqpulse irqlevel powerdown
wdc0 at pcmcia0 function 0