Subject: very strange IDE behaviour
To: None <tech-kern@netbsd.org>
From: Nino Dehne <TeCeEm@gmx.de>
List: tech-kern
Date: 10/09/2003 11:52:26
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

recently I acquired a new hard disk, 160GB in size:

~   Model: SAMSUNG SP1604N, Rev: TM100-23

It's supposed to run as the sole drive on a channel. When setting it to
be master the BIOS recognizes it (with only 137GB but that's not
relevant I guess). NetBSD 1.6.1_STABLE does not recognize it, at all.
It's just as if it wasn't there. The drive supports UDMA133. It's hooked
to a

~   pciide0 at pci0 dev 17 function 1: VIA Technologies VT8233 ATA100
controller

The board has another controller:

~   pciide1 at pci0 dev 6 function 0: Promise Ultra100/ATA Bus Master IDE
Accelerator (rev. 0x02)

This one gives the exact same symptoms so I leave that out for now. In
case you wonder about the order of pciide(1|2), I hardwired the VIA to
be first. I also hardwired wd[0123] and wd[4567], not that it matters.

Samsung provides a utility to set the UDMA mode of their drives to a
maximum value. When fixing the disk to support max. UDMA100 NetBSD
recognizes it, but gives the following error around mounting the root
partition from wd0:

~   pciide0:1:0: not ready, st=0x00, err=0x00
~   wd2d: device timeout reading fsbn 0 (wd2 bn 0; cn 0 tn 0 sn 0), retrying
~   wd2: soft error (corrected)

That's the only error I get. I read some blocks off of the drive with
dd(1) and get speeds of ~55MB/s without any following errors. That's all
with the drive being master. No slave drive.

Now things turn strange. I set the drive back to support UDMA133 to get
an equal starting point. I set it to be _slave_ this time. No master on
the channel.

NetBSD recognizes the drive just fine, reporting it supports UDMA133
etc. I get no error at all and speed is the same as before.

~   wd3: drive supports 16-sector PIO transfers, LBA48 addressing
~   wd3: 149 GB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect x 312581808
sectors
~   wd3: 32-bit data port
~   wd3: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
~   wd3(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100)
(using DMA data transfers)

It's not the cable. I tried several verified-to-be-working ones. I also
tried using the farthest and the middle connector of the cable without a
difference. I didn't, however,  try with another drive filling the
missing master/slave position.

Any clue as to why this happens?

Oh and btw, atactl(8) identify reports

~   Model: SAMSUNG SP1604N, Rev: TM100-23, [...]
~   Device type: ATA, fixed
~   Cylinders: 16383, heads: 16, sec/track: 63, total sectors: 268435455

Note the sector count. The correct value is 312581808 for that drive. I
take it's just a minor bug with atactl(8) and nothing to worry about,
since NetBSD claims to be using LBA48 and reports the correct value in
ther kernel messages.

Regards

- --
Of course it runs NetBSD.

PGP key: 42A5E773 / 41DE 4A4C DB34 33F7 2044  8FE0 91AA C584 42A5 E773
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/hS/VkarFhEKl53MRAsDyAJ9PebflQLK9ZzqkZdgyoT3XwaF3HACdGF/j
rQI0LcJiSUxybjJ9+ULxm58=
=vUnR
-----END PGP SIGNATURE-----