Subject: CF/IDE performance problem...
To: None <tech-kern@netbsd.org>
From: Matthew Orgass <darkstar@city-net.com>
List: tech-kern
Date: 11/18/2005 23:52:29
  I just purchased a Rosewill 512MB Compact Flash card and an IDE to CF
adaptor.  Performance was horrible (<800KB/s bonnie++ read (with small
data size)), and I noticed this in dmesg:

wd1: drive supports 1-sector PIO transfers, LBA addressing
wd1: 488 MB, 993 cyl, 16 head, 63 sec, 512 bytes/sect x 1000944 sectors
wd1: 32-bit data port
wd1(viaide0:1:0): using PIO mode 0

atactl identify:

Model: Hitachi XXM2.3.0, Rev: Rev 3.00, Serial #: X0207 20051011181554
Device type: ATAPI, removable
Device capabilities:
	LBA

  I guess the "PIO mode 0" would explain the performance problems.  This
is i386 running 2.0RC4; I booted the latest i386 daily HEAD kernel and it
also use PIO mode 0.  Under Windows ME with no special drivers it was much
faster.

  The description of the card included:

Fast ATA host-to-buffer burst transfer rate: Up to 20Mbytes/second, Support
PIO mode 4 at 16.6 Mbytes/second
Support 8-bit and 16-bit host data transfers
Conform to Compact Flash standard
Fully compatible with PC card ATA specifications

  I thought the 20MB/s host-to-buffer should mean DMA support, since as I
understand it PIO maxes out at 16.6MB/s, but at least PIO mode 4 should be
supported.

  I set wdcdebug_* to 0xffff and inserted the card via PCMCIA and got:

pcmcia1: CIS version PCMCIA 2.0 or 2.1
pcmcia1: CIS info: HITACHI, FLASH, 5.0
pcmcia1: Manufacturer code 0x7, product 0x0
pcmcia1: function 0: fixed disk(ata), ccr addr 200 mask f
pcmcia1: function 0, config table entry 0: memory card; irq mask 0; memspace 0-7ff; rdybsy_active powerdown
pcmcia1: 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
pcmcia1: 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
pcmcia1: 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
wdc2 at pcmcia1 function 0
atabus2 at wdc2 channel 0
wdc2:0: before reset, st0=0x50, st1=0x0
wdc2:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0: wdcwait_reset() end, st0=0x50 st1=0x0
wdc2:0: after reset, ret_value=0x3
wdc2:0:0: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0:1: after reset, sc=0x1 sn=0x1 cl=0x0 ch=0x0
wdc2:0: wait DRDY st0 0x50 st1 0x0
ata_get_parms
wdc_exec_command wdc2:0:0
wdc_exec_xfer 0xc1872034 channel 0 drive 0
wdcstart from wdc_exec_xfer, flags 0x100
wdcstart: xfer 0xc1872034 channel 0 drive 0
__wdccommand_start wdc2:0:0
__wdcwait wdc2:0
wdccommand wdc2:0:0: command=0xec cylin=0 head=0 sector=0 count=0 precomp=0
__wdccommand_intr wdc2:0:0
__wdcwait wdc2:0
__wdcwait: timeout (time=11), status d0 error 1 (mask 0x0 bits 0x0)
__wdcwait wdc2:0
__wdcwait: did busy-wait, time=1
__wdccommand_done wdc2:0:0
atabusattach: ch_drive_flags 0x1 0x0
wd2 at atabus2 drive 0wdattach
ata_get_parms
wdc_exec_command wdc2:0:0
wdc_exec_xfer 0xc1872034 channel 0 drive 0
wdcstart from wdc_exec_xfer, flags 0x100
wdcstart: xfer 0xc1872034 channel 0 drive 0
__wdccommand_start wdc2:0:0
__wdcwait wdc2:0
wdccommand wdc2:0:0: command=0xec cylin=0 head=0 sector=0 count=0 precomp=0
wdcintr
__wdccommand_intr wdc2:0:0
__wdcwait wdc2:0
__wdccommand_done wdc2:0:0
: <Hitachi XXM2.3.0>
wd2: drive supports 1-sector PIO transfers, LBA addressing
wd2: 488 MB, 993 cyl, 16 head, 63 sec, 512 bytes/sect x 1000944 sectors
wd2: atap_dmatiming_mimi=0, atap_dmatiming_recom=0
ata_get_parms
wdc_exec_command wdc2:0:0
wdc_exec_xfer 0xc1872034 channel 0 drive 0
wdcstart from wdc_exec_xfer, flags 0x100
wdcstart: xfer 0xc1872034 channel 0 drive 0
__wdccommand_start wdc2:0:0
__wdcwait wdc2:0
wdccommand wdc2:0:0: command=0xec cylin=0 head=0 sector=0 count=0 precomp=0
wdcintr
__wdccommand_intr wdc2:0:0
__wdcwait wdc2:0
__wdccommand_done wdc2:0:0
ata_get_parms
wdc_exec_command wdc2:0:0
wdc_exec_xfer 0xc1872034 channel 0 drive 0
wdcstart from wdc_exec_xfer, flags 0x100
wdcstart: xfer 0xc1872034 channel 0 drive 0
__wdccommand_start wdc2:0:0
__wdcwait wdc2:0
wdccommand wdc2:0:0: command=0xec cylin=0 head=0 sector=0 count=0 precomp=0
wdcintr
__wdccommand_intr wdc2:0:0
__wdcwait wdc2:0
__wdccommand_done wdc2:0:0
wdstrategy (wd0)
wdstart wd0
wdc_exec_xfer 0xc1872034 channel 0 drive 0
wdcstart from wdc_exec_xfer, flags 0x0
wdcstart: xfer 0xc1872034 channel 0 drive 0
[more stuff that looks like it is from the main hard drive]

  I don't know what, if anything, any of this means.

  I also tried a microdrive in the CF to IDE adaptor and it reported:

wd1 at atabus1 drive 0: <IBM-DSCM-11000>
wd1: drive supports 16-sector PIO transfers, LBA addressing
wd1: 1027 MB, 2088 cyl, 16 head, 63 sec, 512 bytes/sect x 2104704 sectors
wd1: 32-bit data port
wd1: drive supports PIO mode 3, DMA mode 1
wd1(viaide0:1:0): using PIO mode 3, DMA mode 1 (using DMA data transfers)
viaide0:1:0: lost interrupt
	type: ata tc_bcount: 512 tc_skip: 0
viaide0:1:0: bus-master DMA error: missing interrupt, status=0x21
wd1: transfer error, downgrading to PIO mode 3
wd1(viaide0:1:0): using PIO mode 3
wd1d: DMA error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
wd1: soft error (corrected)

Model: IBM-DSCM-11000, Rev: SC2IC915, Serial #:             KHLG5063
Device type: ATAPI, removable
Device capabilities:
	DMA
	LBA
	IORDY operation
	IORDY disabling
Device supports following standards:
ATA-1 ATA-2 ATA-3 ATA-4
Command set support:
	NOP command
	READ BUFFER command
	WRITE BUFFER command
	look-ahead
	write cache
	Power Management feature set
	Advanced Power Management feature set
	CFA feature set
Command sets/features enabled:
	look-ahead
	Advanced Power Management feature set


Matthew Orgass
darkstar@city-net.com