Bug 9048 - pata_via libata: Eirroneous "limited to UDMA/33 due to 40-wire cable"
Summary: pata_via libata: Eirroneous "limited to UDMA/33 due to 40-wire cable"
Status: CLOSED CODE_FIX
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: Serial ATA (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
: 9168 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-09-20 23:31 UTC by Salah Coronya
Modified: 2008-06-10 08:06 UTC (History)
8 users (show)

See Also:
Kernel Version: 2.6.24-rc1
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Salah Coronya 2007-09-20 23:31:32 UTC
Most recent kernel where this bug did not occur: I don't never worked right; first noticed when libata announced this fact 
Distribution: Gentoo
Hardware Environment: Home-built machine, see lspci info below
Software Environment:gentoo-sources-2.6.22-r5 (fails on vanilla-sources-rc6 as well)
Problem Description: libata incorrectly limits CD-Writer to UDMA/33 (or at least gives the wrong reason why)

Steps to reproduce: Just boot

libata in incorrectly limiting (or incorrectly declaring) the DVD writer to UDMA/33. The cable is a 80-wire cable (I've tried multiple cables) I've already the patch that fixes the via_cable_detect function; but even replacing via_port_ops[_noirq].cable_detect with ata_cable_80wire() instead of via_cable_detect makes no difference.

The problem occurs in include/linux/ata.h with the ata_drive_40wire() function, which is return 1 on that drive, which causes ata_dev_xfermask in drivers/ata/libata-core.c to print the message and limit the drive. Even if this some kind of hardware issue it should at least declare that the drive controller and drive don't agree.

lscpi data:

00:00.0 Host bridge: VIA Technologies, Inc. VT8375 [KM266/KL266] Host Bridge
00:01.0 PCI bridge: VIA Technologies, Inc. VT8633 [Apollo Pro266 AGP]
00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80)
00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80)
00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)
00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge
00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 50)
00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
01:00.0 VGA compatible controller: nVidia Corporation NV34 [GeForce FX 5200] (rev a1)

output of lspci -nxxxv -s 11.1:
00:11.1 0101: 1106:0571 (rev 06) (prog-if 8a [Master SecP PriP])
        Subsystem: 1106:0571
        Flags: bus master, medium devsel, latency 32, IRQ 255
        [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
        [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
        I/O ports at fc00 [size=16]
        Capabilities: [c0] Power Management version 2
00: 06 11 71 05 07 00 90 02 06 8a 01 01 00 20 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 01 fc 00 00 00 00 00 00 00 00 00 00 06 11 71 05
30: 00 00 00 00 c0 00 00 00 00 00 00 00 ff 01 00 00
40: 0b f2 09 35 18 1c c0 00 a8 20 a8 20 ff 00 20 20
50: 17 e6 17 e0 0c 00 00 00 a8 a8 a8 a8 00 00 00 00
60: 00 02 00 00 00 00 00 00 00 02 00 00 00 00 00 00
70: 02 01 00 00 00 00 00 00 02 01 00 00 00 00 00 00
80: 00 90 fd 1f 00 00 00 00 00 70 00 1f 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 06 00 71 05 06 11 71 05 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00

Unfortunately attempt to get the ATA IDENTIFY PACKET DEVICE information fail with both hdparm AND sg_inq (but succeed with the hard disk)
 
sg_inq --ata /dev/sr0 fails with "fetching ATA information failed on /dev/sr0"
sg_vpd fails with "fetching VPD page failed"
hdparm -I fails with "HDIO_DRIVE_CMD(identify) failed: Input/output error"

However, boot an older kernel without libata (using the Gentoo LiveCD 7.0) does allow hdparm to work on it sort of. Each time hdparm is run in it (/dev/hdc in this case) it prints out:

/dev/hdc:
hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04 { AbortedCommand }
ide: failed opcode was: 0xec

But it does give a result (from hdparm --Istdout):

/dev/hdc:
85c0 0000 0000 0000 0000 0000 0000 0000
0000 0000 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 0000 0000 0000 4853
3045 2020 2020 4c49 5445 2d4f 4e20 4456
4452 5720 5348 4d2d 3136 3548 3653 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0b00 4000 0000 0000 0006 0000 0000
0000 0000 0000 0000 0000 0000 079f 0007
0003 0078 0078 00f0 0078 0000 0000 0000
0000 0004 0009 0000 0000 0000 0000 0000
00f0 0000 0210 5000 4000 0210 1000 4000
101f 0000 0000 0000 0000 4101 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 faa5

Run though hdparm --Istdin, it gives
ATAPI CD-ROM, with removable media
        Model Number:       LITE-ON DVDRW SHM-165H6S                
        Serial Number:      
        Firmware Revision:  HS0E    
Standards:
        Used: ATAPI for CD-ROMs, SFF-8020i, r2.5
        Supported: CD-ROM ATAPI-2 
Configuration:
        DRQ response: 50us.
        Packet size: 12 bytes
Capabilities:
        LBA, IORDY(cannot be disabled)
        DMA: *sdma0 *sdma1 *sdma2 sdma3 sdma4 sdma7 mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 *udma4 (?)
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=240ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    PACKET command feature set
           *    DEVICE_RESET command
           *    Mandatory FLUSH_CACHE
HW reset results:
        CBLID- below Vih
        Device num = 0

(This is supposed to be a 16x drive, and I have 16x media, but it barely runs at 5x. Unfortunately even when the drive is in UDMA/66 mode its no faster ANYWAY. It could very well be this drive is just broken, but I've got another (Windows) machine I could that theory on)
Comment 1 Alan 2007-09-21 03:33:51 UTC
Known problem, fix is hopefully in the current 2.6.23-rc tree so 2.6.23 should sort this out
Comment 2 Salah Coronya 2007-10-10 18:49:41 UTC
(In reply to comment #1)
> Known problem, fix is hopefully in the current 2.6.23-rc tree so 2.6.23
> should
> sort this out
> 

I just tried a vanilla 2.6.23 kernel. Same message ("limited to UDMA/33 due to 40-wire cable").

This isn't specific to pata_via either, on a different machine (Fedora 7, kernel 2.6.22.9-91.fc7), with driver ata_piix

ata2.00: ATAPI: HL-DT-STDVD-ROM GDR8160B, 0014, max UDMA/66
ata2.01: ATAPI: DVDRW DRW-5S163, YSG5, max UDMA/66
ata2.00: limited to UDMA/33 due to 40-wire cable
ata2.01: limited to UDMA/33 due to 40-wire cable
Comment 3 Alan 2007-11-02 09:56:26 UTC
The ata_piix host side detect is known correct so it looks as if one or more of your drives has issues with cable detection
Comment 4 Alan 2007-11-02 10:04:03 UTC
101f 0000 0000 0000 0000 4101 0000 0000

Word 93 is 0x4101 -> valid, 40 wire.
Comment 5 Salah Coronya 2007-11-02 15:16:50 UTC
Well, I just updated the other computer to 2.6.23.1-10.fc7, at is has the same problem (with both drives). Its hard to believe that 3 different drives, on 2 completely different machines are having the same problem. It could be my drive is borked and the other machine really does have a 40-wire cable, but I won't have physical access to that machine until Nov 9th. At that time I can investigate the  cabling as well as get the ATA IDENTIFY PACKET DEVICE information from those 2 drivers. 

If there really is a hardware issue, and the drive/controller is simply spitting out bogus values; can some sysfs attribute/module option/kconfig option added override/disable it?

I'm not the only one with this problem; see bug 9168 who has to opposite problem - the cable is 40wire but detects as 80. 
Comment 6 Alan 2007-11-02 16:46:21 UTC
I can only go by the data given but for the one you quote identify data the drive itself explicitly said it thought the system was a 40 wire cable. 
Comment 7 Cuero Bugot 2007-11-05 15:02:08 UTC
I actually have the same problem when upgrading from 2.6.20 to 2.6.22 and higher (tested as well on 2.6.23.1)
In my case I use Compact Flash as hard drive (UDMA4 Compact flash). The pata drive is pata_it821x.
With kernel 2.6.20 the CF is recognized as UDMA4 device and it works fine (40MB/s)
With kernel 2.6.22 and higher I have the same message: "limited to UDMA/33 due to 40-wire cable", and the device is indeed set a UDMA2 speed.



2.6.20 kernel outputs:
>>>>> lspci
00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 81)
00:01.0 PCI bridge: Intel Corporation 82945G/GZ/P/PL PCI Express Root Port (rev 81)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1c.4 PCI bridge: Intel Corporation 82801GR/GH/GHM (ICH7 Family) PCI Express Port 5 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 SATA controller: Intel Corporation 82801GR/GH (ICH7 Family) Serial ATA Storage Controller AHCI (rev 01)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
01:03.0 FireWire (IEEE 1394): Texas Instruments TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)
01:04.0 Mass storage controller: Integrated Technology Express, Inc. ITE 8211F Single Channel UDMA 133 (ASUS 8211 (ITE IT8212 ATA RAID Controller)) (rev 11)
02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 15)
04:00.0 VGA compatible controller: nVidia Corporation G70 [GeForce 7600 GS] (rev a1)


>>>>>> hdparm -i /dev/sdb

/dev/sdb:

 Model=                                        , FwRev=20070308, SerialNo=CF  CARD    0000C3CB
 Config={ HardSect NotMFM Fixed DTR>10Mbs }
 RawCHS=7980/16/63, TrkSize=0, SectSize=576, ECCbytes=4
 BuffType=DualPort, BuffSize=1kB, MaxMultSect=1, MultSect=?0?
 CurCHS=7980/16/63, CurSects=8043840, LBA=yes, LBAsects=8043840
 IORDY=no, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 *udma4
 AdvancedPM=yes: disabled (255)
 Drive conforms to: Unspecified:  ATA/ATAPI-4

 * signifies the current active mode


>>>>>>> hdparm --Istdout /dev/sdb

/dev/sdb:
044a 1f2c 0000 0010 0000 0240 003f 007a
bd40 0000 4346 2020 4341 5244 2020 2020
3030 3030 4333 4342 0002 0002 0004 3230
3037 3033 3038 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 8001
0000 0300 0000 0200 0000 0007 1f2c 0010
003f bd40 007a 0100 bd40 007a 0000 0007
0003 0078 0078 0078 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0010 0000 7008 400c 4000 0000 0000 0000
101f 0000 0000 0000 0000 400f 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0492 0002 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000


>>>>> dmesg (filtered)

[    6.142966] pata_it821x: controller in pass through mode.
[    6.143057] ata5: PATA max UDMA/133 cmd 0x0001b800 ctl 0x0001b402 bmdma 0x0001a400 irq 21
[    6.313581] ata5.00: ATA-4: , 20070308, max UDMA/66
[    6.313585] ata5.00: 8043840 sectors, multi 0: LBA
[    6.325299] ata5.00: configured for UDMA/66
[    6.325310] scsi5 : pata_it821x





2.6.22 kernel outputs:
>>>>> lspci
00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 81)
00:01.0 PCI bridge: Intel Corporation 82945G/GZ/P/PL PCI Express Root Port (rev 81)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1c.4 PCI bridge: Intel Corporation 82801GR/GH/GHM (ICH7 Family) PCI Express Port 5 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 SATA controller: Intel Corporation 82801GR/GH (ICH7 Family) SATA AHCI Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
01:03.0 FireWire (IEEE 1394): Texas Instruments TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)
01:04.0 Mass storage controller: Integrated Technology Express, Inc. ITE 8211F Single Channel UDMA 133 (rev 11)
02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 15)
04:00.0 VGA compatible controller: nVidia Corporation G70 [GeForce 7600 GS] (rev a1)



>>>>>> hdparm -i /dev/sdb

/dev/sdb:

 Model=                                        , FwRev=20070308, SerialNo=CF  CARD    0000C3CB
 Config={ HardSect NotMFM Fixed DTR>10Mbs }
 RawCHS=7980/16/63, TrkSize=0, SectSize=576, ECCbytes=4
 BuffType=DualPort, BuffSize=1kB, MaxMultSect=1, MultSect=?0?
 CurCHS=7980/16/63, CurSects=8043840, LBA=yes, LBAsects=8043840
 IORDY=no, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 *udma2 udma3 udma4
 AdvancedPM=yes: disabled (255)
 Drive conforms to: Unspecified:  ATA/ATAPI-4

 * signifies the current active mode



>>>>>>> hdparm --Istdout /dev/sdb

/dev/sdb:
044a 1f2c 0000 0010 0000 0240 003f 007a
bd40 0000 4346 2020 4341 5244 2020 2020
3030 3030 4333 4342 0002 0002 0004 3230
3037 3033 3038 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 8001
0000 0300 0000 0200 0000 0007 1f2c 0010
003f bd40 007a 0100 bd40 007a 0000 0007
0003 0078 0078 0078 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0010 0000 7008 400c 4000 0000 0000 0000
041f 0000 0000 0000 0000 400f 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0492 0002 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000



>>>>> dmesg (filtered)

[   38.156814] pata_it821x: controller in pass through mode.
[   38.156917] scsi6 : pata_it821x
[   38.156981] scsi7 : pata_it821x
[   38.157013] ata7: PATA max UDMA/133 cmd 0x0001b800 ctl 0x0001b402 bmdma 0x0001a400 irq 20
[   38.321124] ata7.00: ATA-4: , 20070308, max UDMA/66
[   38.321128] ata7.00: 8043840 sectors, multi 0: LBA
[   38.321134] ata7.00: limited to UDMA/33 due to 40-wire cable
[   38.336882] ata7.00: configured for UDMA/33
Comment 8 Cuero Bugot 2007-11-07 13:42:34 UTC
I checked into ATA specification. Indeed word93 = 400f is correct and means that the device detected a 40wire cable (bit13=0).
So I would say that the bug is rather into the device than in the driver.
The device is an A-DATA 4Go Compact Flash card 266x (up to udma4).
I even tried to add a pullup on PDIAG pin (onto the CF->IDE adaptor) with no success: the device beleives it has a 40wire cable.

I also tried with a regular hard drive, same cable. This time the device (Seagate 120Go hardrive) detected correctly the 80wire cable, and udma was activated.

So the question is, why with previous kernels udma4 was still activated even though the device returned word93=400f?

Also I read into ATA specification that the primary way to detect 80wire cable was to probe for PDIAG pin on the host side.
Would it be possible to add PDIAG sensing into pata_it821x driver ? What should libata do when host is detecting 80wire cable and device is detecting 40wire cable?
Comment 9 Cuero Bugot 2007-11-07 14:11:10 UTC
From IT8211F_V0.2.1.pdf, the register at 0x40 gives the cable information. (page 22)
Bit 2 and 3 are set according to cable type (CBLID).
This would enable the host driver to override device cable detection.
Comment 10 Cuero Bugot 2007-11-10 06:18:52 UTC
Analysing a bit mode the code I found something that is a little different from the standard:
into libata-core.c, around line 3903:
	/* Apply cable rule here.  Don't apply it early because when
	 * we handle hot plug the cable type can itself change.
	 * Check this last so that we know if the transfer rate was
	 * solely limited by the cable.
	 * Unknown or 80 wire cables reported host side are checked
	 * drive side as well. Cases where we know a 40wire cable
	 * is used safely for 80 are not checked here.
	 */
From the comment and the if statement below, the device detection is prevalent on host detection.
However in the ATA standard (d1532v2r4b ATA-ATAPI-7.pdf from t13), it is written that the host cable detection is normative and that device cable detection is informative.


Also on page 167 it can be read: 
ANNEX D. DEVICE DETERMINATION OF CABLE TYPE (INFORMATIVE)
D.1      Overview
This standard requires that, for systems using a cable assembly, an 80-conductor cable assembly shall be
installed before a system may operate with Ultra DMA modes greater than 2. However, some hosts have
not implemented circuitry to determine the installed cable type by detecting whether PDIAG-:CBLID- is
connected to ground as mandated by this standard. The following describes an alternate method for using
IDENTIFY DEVICE or IDENTIFY PACKET DEVICE data from the device to determine the cable type. It is
not recommended that a host use the method described in this annex.

Anyway that would not solve my immediate problem since it821x driver is returning : .cable_detect= ata_cable_unknown
Also I read register 0x40 of IT8211F device and it always return 0xA0F0 whatever cable (40wires or 80wires) and hard drive is connected...
Maybe CLBID signal is not connected on my motherboard (ASUS P5LD2 Deluxe).

I will try to contact A-Data in order to inderstand why their CompactFlash Card is returning Word93=0x400F.
Comment 11 Alan 2007-11-10 07:23:56 UTC
I'm aware of the docs but none of the drivers check word 0x40, including the reference driver for both 8211 and 8212.
Comment 12 Salah Coronya 2007-11-10 16:00:03 UTC
Ok, I finally got the results for the other machine. That one really DID have a 40-wire cable, I've since replaced it with an 80-wire one. However, only 1 of the 2 drives actually runs correctly; the other still detects a 40-wire cable. And they are on the same cable!

ata2: PATA max UDMA/100 cmd 0x00010170 ctl 0x00010376 bmdma 0x0001ffa8 irq 15
ata2.00: ATAPI: HL-DT-STDVD-ROM GDR8160B, 0014, max UDMA/66
ata2.01: ATAPI: DVDRW DRW-5S163, YSG5, max UDMA/66
ata2.00: limited to UDMA/33 due to 40-wire cable
ata2.00: configured for UDMA/33
ata2.01: configured for UDMA/66

/dev/hdc:
85c0 0000 0000 0000 0000 0000 0000 0000
0000 0000 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 0000 0000 0000 3030
3134 2020 2020 484c 2d44 542d 5354 4456
442d 524f 4d20 4744 5238 3136 3042 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0f00 0000 0200 0200 0006 0000 0000
0000 0000 0000 0000 0000 0000 0007 0007
0003 0078 0078 0078 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
101f 0000 0000 0000 0000 2000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

/dev/hdd:
85c0 0000 0000 0000 0000 0000 0000 0000
0000 0000 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 0000 0000 0000 5953
4735 2020 2020 4456 4452 5720 4452 572d
3553 3136 3320 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0b00 4000 0000 0000 0006 0000 0000
0000 0000 0000 0000 0000 0000 079f 0007
0003 0078 0078 00f0 0078 0000 0000 0000
0000 0004 0009 0000 0000 0000 0000 0000
00f0 0000 0210 5000 4000 0210 1000 4000
101f 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 62a5
Comment 13 Cuero Bugot 2007-11-12 11:28:26 UTC
That last comment from Salah shows that the current cable type determining schem is not perfect ;-) It is quite strange to limit one device to UDMA33MB/S and let the other to UDMA66MB/S on the same cable because of heterogenous cable type detection.
I would say, either you are strict and:
one device report 40wire => both device are UDMA33 limited
or you are optimist:
one device report 80wire => both device benefit from higher than UDMA33.

Best thing would be to use the host cable detection as a third voter.

And even better: ata lib could be more optimistic and always allow 80wire, and decrease the DMA speed when too many CRC are detected. (actually I am not sure this is feasible). This would allow best performances all the time.

Finally I believe that allowing the user to force the cable type would be grate. That could be when loading pata drivers (or libata ?) allowing option that can force the cable type.
Comment 14 Alan 2007-11-30 10:45:03 UTC
*** Bug 9168 has been marked as a duplicate of this bug. ***
Comment 15 Karl Tischler 2007-12-05 23:28:29 UTC
I've the same problem on Kernel-Version 2.6.23.9. On older releases of Kernel-Versions it worked for me.
Here is my output:
lspci:
00:00.0 Host bridge: VIA Technologies, Inc. VT8377 [KT400/KT600 AGP] Host Bridge (rev 80)
00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge
00:09.0 Network controller: AVM Audiovisuelles MKTG & Computer System GmbH Fritz!PCI v2.0 ISDN (rev 02)
00:0a.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

My output on booting my system
00:0b.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:0d.0 Network controller: Cologne Chip Designs GmbH ISDN network controller [HFC-PCI] (rev 02)
00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)
00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)
00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 78)
01:00.0 VGA compatible controller: STMicroelectronics STG4000 [3D Prophet Kyro Series] (rev 0f)

lspci -nxxxv -s 0f.1:
00:0f.1 Class 0101: 1106:0571 (rev 06) (prog-if 8a [Master SecP PriP])
        Subsystem: 1849:0571
        Flags: bus master, medium devsel, latency 32, IRQ 18
        [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
        [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
        [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
        I/O ports at fc00 [size=16]
        Capabilities: [c0] Power Management version 2
00: 06 11 71 05 07 00 90 02 06 8a 01 01 00 20 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 01 fc 00 00 00 00 00 00 00 00 00 00 49 18 71 05
30: 00 00 00 00 c0 00 00 00 00 00 00 00 ff 01 00 00
40: 2b f2 09 05 18 1c c0 00 a8 20 a8 20 ff 00 b6 b6
50: 07 e6 17 f1 0c 00 00 00 a8 a8 a8 a8 00 00 00 00
60: 00 02 00 00 00 00 00 00 00 02 00 00 00 00 00 00
70: 02 01 00 00 00 00 00 00 02 01 00 00 00 00 00 00
80: 10 fd 09 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 06 00 71 05 49 18 71 05 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 09 00 00 00 00 00 00 00 00 00

hdparm -i /dev/hda:

/dev/hda:

 Model=SAMSUNG SP2514N, FwRev=VF100-41, SerialNo=S08BJ1JL530690
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4
 BuffType=DualPortCache, BuffSize=8192kB, MaxMultSect=16, MultSect=16
 CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=268435455
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: unknown:

 * signifies the current active mode

My output on booting my system:

HDIO_SET_DMA failed: operation not permitted
Comment 16 Harald Judt 2008-01-03 06:24:53 UTC
I have the same problems with two different DVD drives. The cables are certainly 80-wire and work correctly with hard disks, and I've already exchanged it with another cable in case it is defective. BIOS recognized the drives as UDMA/100 and UDMA/66, but the kernel sets them to UDMA/33. Old IDE/ATAPI drivers and Windows recognize UDMA/66 correctly. Both drives have been connected as master to the IDE port.

dmesg:
ata2.00: ATAPI: TSSTcorp CDDVDW SH-S202J, SB01, max UDMA/66
ata2.00: limited to UDMA/33 due to 40-wire cable
ata2.00: configured for UDMA/33

Due to some strangeness, I got this first (I suppose this is because of some application I used before):
sdparm /dev/sr0:
/dev/sr0: TSSTcorp  CDDVDW SH-S202J   SB01  [cd/dvd]
INQUIRY fetching VPD page=0x0 failed

Then, I booted to systemrescuecd-0.3.4, did the things noted below (to get IDE information) and rebooted my system. No INQUIRY error anymore, this is what I get now (still at UDMA/33 though):

sdparm -a /dev/sr0:
    /dev/sr0: TSSTcorp  CDDVDW SH-S202J   SB01  [cd/dvd]
Read write error recovery mode page:
  AWRE        0  [cha: y, def:  0]
  ARRE        0  [cha: n, def:  0]
  TB          0  [cha: n, def:  0]
  RC          0  [cha: n, def:  0]
  EER         0  [cha: n, def:  0]
  PER         0  [cha: y, def:  0]
  DTE         0  [cha: n, def:  0]
  DCR         0  [cha: y, def:  0]
  RRC       128  [cha: y, def:128]
  COR_S       0  [cha: n, def:  0]
  HOC         0  [cha: n, def:  0]
  DSOC        0  [cha: n, def:  0]
  EMCDR       0  [cha: n, def:  0]
  WRC         0  [cha: n, def:  0]
  ERTL        0  [cha: n, def:  0]
Write parameters (MMC) mode page:
  BUFE        0  [cha: y, def:  0]
  LS_V        0  [cha: n, def:  0]
  TST_W       0  [cha: y, def:  0]
  WR_T        0  [cha: y, def:  0]
  MULTI_S     3  [cha: y, def:  3]
  FP          0  [cha: y, def:  0]
  COPY        0  [cha: y, def:  0]
  TRACK_M     5  [cha: y, def:  5]
  DBT         8  [cha: y, def:  8]
  LINK_S      0  [cha: n, def:  0]
  IAC         0  [cha: y, def:  0]
  SESS_F      0  [cha: y, def:  0]
  PACK_S      0  [cha: y, def:  0]
  APL       150  [cha: y, def:150]
Protocol specific logical unit mode page:
  LUPID       0  [cha: n, def:  0]
Power condition mode page:
  IDLE        1  [cha: n, def:  1]
  STANDBY     1  [cha: n, def:  1]
  ICT       2780  [cha: n, def:2780]
  SCT       6000  [cha: n, def:6000]
Informational exceptions control mode page:
  PERF        0  [cha: n, def:  0]
  EBF         0  [cha: n, def:  0]
  EWASC       0  [cha: n, def:  0]
  DEXCPT      0  [cha: n, def:  0]
  TEST        0  [cha: n, def:  0]
  EBACKERR    0  [cha: n, def:  0]
  LOGERR      0  [cha: n, def:  0]
  MRIE        0  [cha: n, def:  0]
  INTT        0  [cha: n, def:  0]
  REPC        0  [cha: n, def:  0]
Timeout and protect (MMC) mode page:
  G3E         0  [cha: n, def:  0]
  TMOE        0  [cha: n, def:  0]
  DISP        0  [cha: n, def:  0]
  SWPP        0  [cha: n, def:  0]
  G1MT        6  [cha: n, def:  6]
  G2MT        0  [cha: n, def:  0]
CD/DVD (MM) capabilities and mechanical status (MMC) mode page:
  D_RAM_R     1  [cha: n, def:  1]
  D_R_R       1  [cha: n, def:  1]
  D_ROM_R     1  [cha: n, def:  1]
  METH2       1  [cha: n, def:  1]
  CD_RW_R     1  [cha: n, def:  1]
  CD_R_R      1  [cha: n, def:  1]
  D_RAM_W     1  [cha: n, def:  1]
  D_R_W       1  [cha: n, def:  1]
  TST_WR      1  [cha: n, def:  1]
  CD_RW_W     1  [cha: n, def:  1]
  CD_R_W      1  [cha: n, def:  1]
  BUF         1  [cha: n, def:  1]
  MULT_S      1  [cha: n, def:  1]
  M2F2        1  [cha: n, def:  1]
  M2F1        1  [cha: n, def:  1]
  DP_2        0  [cha: n, def:  0]
  DP_1        0  [cha: n, def:  0]
  COMP        0  [cha: n, def:  0]
  AUDIO_P     1  [cha: n, def:  1]
  RBC         0  [cha: n, def:  0]
  UPC         1  [cha: n, def:  1]
  ISRC        1  [cha: n, def:  1]
  C2PS        1  [cha: n, def:  1]
  RW_DC       1  [cha: n, def:  1]
  RW_S        1  [cha: n, def:  1]
  CDDA_SA     1  [cha: n, def:  1]
  CDDA_CS     1  [cha: n, def:  1]
  LMT         1  [cha: n, def:  1]
  EJECT       1  [cha: n, def:  1]
  PJ          0  [cha: n, def:  0]
  LS          0  [cha: n, def:  0]
  LOCK        1  [cha: n, def:  1]
  RWILI       1  [cha: n, def:  1]
  SCC         0  [cha: n, def:  0]
  SSS         0  [cha: n, def:  0]
  CSDP        0  [cha: n, def:  0]
  SCM         1  [cha: n, def:  1]
  SVL         1  [cha: n, def:  1]
  NVLS      256  [cha: n, def:256]
  BSS       2048  [cha: n, def:2048]
  LENGTH      1  [cha: n, def:  1]
  LSBF        0  [cha: n, def:  0]
  RCK         0  [cha: n, def:  0]
  BCKF        0  [cha: n, def:  0]
  CMRS        1  [cha: n, def:  1]
  RCS         0  [cha: y, def:  0]
  CWSS      8468  [cha: n, def:  0]

lspci:
00:1f.2 0101: 8086:24d1 (rev 02) (prog-if 8a [Master SecP PriP])
	Subsystem: 1458:24d1
	Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 17
	I/O ports at 01f0 [size=8]
	I/O ports at 03f4 [size=1]
	I/O ports at 0170 [size=8]
	I/O ports at 0374 [size=1]
	I/O ports at f000 [size=16]
	Kernel driver in use: ata_piix
00: 86 80 d1 24 05 00 a8 02 02 8a 01 01 00 00 00 00
10: 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
20: 01 f0 00 00 00 00 00 00 00 00 00 00 58 14 d1 24
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00
40: 77 e3 03 a3 0b 00 00 00 07 00 11 02 00 00 00 00
50: 00 00 00 00 f0 30 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00
80: 05 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 04 00 33 00 20 00 00 00 00 00 00 00 00 00 00 00
a0: 68 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 66 0f 05 00 00 00 00 00

hdparm --Istdout /dev/hdc (boot from system rescue cd-0.3.4):

hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04 { AbortedCommand }
ide: failed opcode was: 0xec
85c0 0000 0000 0000 0000 0000 0000 0000
0000 0000 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 0000 0000 0000 5342
3031 2020 2020 5453 5354 636f 7270 2043
4444 5644 5720 5348 2d53 3230 324a 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0b00 0000 0200 0200 0006 0000 0000
0000 0000 0000 0000 0000 0000 0000 0007
0003 0078 0078 017f 0078 0000 0000 0000
0000 00f8 0210 0000 0000 0000 0000 0000
00f8 0210 0210 0000 0000 0000 0000 0000
101f 0000 8005 3200 005b 2000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 9ba5

hdparm -i /dev/hdc (boot from system rescue cd-0.3.4):

 Model=TSSTcorp CDDVDW SH-S202J, FwRev=SB01, SerialNo=
 Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }
 RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=0kB, MaxMultSect=0
 (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0
 IORDY=yes, tPIO={min:383,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 *udma4 udma3 *udma4
 AdvancedPM=no
 Drive conforms to: unknown:  ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6 ATA/ATAPI-7

 * signifies the current active mode
Comment 17 Alan 2008-01-03 07:52:05 UTC
"TSSTcorp CDDVDW SH-S202J"

We've seen quite a few reports like this and the TSSTcorp ones all appear to be broken drives.  The TSSTcorp devices we've looked at in detail don't correctly set the flags for 40/80 wire cable detect validity, and with 40 wire cables report themselves as SATA causing even more chaos.

Various people (Linux folks and some BIOS people) are currently attempting to get the vendor to fix the firmware.
Comment 18 Harald Judt 2008-01-09 17:23:48 UTC
I understand. It is good to know that some people are already working on this problem, but it seems there are many more drives with defective firmware then, because the LiteOn DVD drive I owned before showed the same issue. So it would be great to force the driver to detect an 80 wire cable if that does not cause other problems.

While the speed limit is not really a showstopper, I have issues with DVD writing at higher speeds (>= 16x) which should not occur because the system should be capable enough to provide the appropriate throughput (S-ATA drives manage 70MiB/s, the DVD drive is on IDE master without any other devices attached to the same cable and CPU usage is only around 15%). This always seems to happen at approx. 25MiB transfer rate, and I *guess* this is because of the UDMA/33 limit. On the other hand, I had similar problems (buffer underrun at high speeds) when using the IDE driver, though that was able to set the correct UDMA mode. Could also be some performance problems with 2.6.23, so if it is, hopefully 2.6.24 fixes this.
Comment 19 Alan 2008-01-29 08:47:20 UTC
Work still in progress. I have some more bits to fire into -mm for testing which should fix this case
Comment 20 Harald Judt 2008-02-07 13:54:29 UTC
After upgrading to 2.6.24 (gentoo tuxonice), the TSSTcorp DVD drive is now correctly configured for UDMA/66.

Thank you to all who helped fixing this!

[BTW: The performance issues with high speed burning I wrote about in my last post are still not fixed. However, this seems to be a different issue, and I don't really care.]
Comment 21 Jakub Moc 2008-02-20 02:20:06 UTC
Definitely not limited to ATAPI drives, also still an issue w/ 2.6.24.2

pata_via 0000:00:07.1: version 0.3.3
scsi0 : pata_via
scsi1 : pata_via
ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xc000 irq 14
ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xc008 irq 15
ata1.00: ATA-6: ST3120026A, 3.76, max UDMA/100
ata1.00: 234441648 sectors, multi 16: LBA48 
ata1.01: ATA-7: Maxtor 6Y160P0, YAR41BW0, max UDMA/133
ata1.01: 320173056 sectors, multi 16: LBA48 
ata1.00: limited to UDMA/33 due to 40-wire cable
ata1.01: limited to UDMA/33 due to 40-wire cable
ata1.00: configured for UDMA/33
ata1.01: configured for UDMA/33
ata2.00: ATAPI: HL-DT-ST DVDRAM GSA-4040B, A304, max UDMA/33
ata2.01: ATAPI: TEAC    CD-W552E, 1.13, max UDMA/33
ata2.00: configured for UDMA/33
ata2.01: configured for UDMA/33
scsi 0:0:0:0: Direct-Access     ATA      ST3120026A       3.76 PQ: 0 ANSI: 5
scsi 0:0:1:0: Direct-Access     ATA      Maxtor 6Y160P0   YAR4 PQ: 0 ANSI: 5
scsi 1:0:0:0: CD-ROM            HL-DT-ST DVDRAM GSA-4040B A304 PQ: 0 ANSI: 5
scsi 1:0:1:0: CD-ROM            TEAC     CD-W552E         1.13 PQ: 0 ANSI: 5


# lspci -nxxxvvv -s 07.1

00:07.1 0101: 1106:0571 (rev 06) (prog-if 8a [Master SecP PriP])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32
	Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
	Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
	Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
	Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
	Region 4: I/O ports at c000 [size=16]
	Capabilities: [c0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: pata_via
00: 06 11 71 05 07 00 90 02 06 8a 01 01 00 20 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 01 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 c0 00 00 00 00 00 00 00 ff 00 00 00
40: 0b 02 09 3a 1c 10 c0 00 20 20 20 20 55 00 20 20
50: e4 e4 e4 e4 14 00 00 00 a8 a8 a8 a8 00 00 00 00
60: 00 02 00 00 00 00 00 00 00 02 00 00 00 00 00 00
70: 02 01 00 00 00 00 00 00 02 01 00 00 00 00 00 00
80: 00 80 35 2f 00 00 00 00 00 a0 35 2f 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 06 00 71 05 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

# hdparm --Istdout /dev/sd[ab]

/dev/sda:
0c5a 3fff c837 0010 0000 0000 003f 0000
0000 0000 334c 4a30 3347 4148 2020 2020
2020 2020 2020 2020 0000 4000 0004 332e
3736 2020 2020 5354 3331 3230 3032 3641
2020 2020 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 8010
0000 2f00 0000 0200 0200 0007 ffff 0001
003f ffc1 003e 0110 4bb0 0df9 0000 0007
0003 0078 0078 00f0 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
007e 001b 346b 7d01 4003 3469 3c01 4003
043f 0000 0000 fefe 0000 607d 8000 0000
0000 0000 0000 0000 4bb0 0df9 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 4bb0 0df9 4bb0 0df9 2020 0002 42b6
0000 8a00 3c06 3c0a ffff 07c6 0100 0800
10f0 1000 0002 0030 0000 0000 0000 fe06
0000 0002 0000 0000 0000 0000 0023 000b
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 8fa5

/dev/sdb:
0040 3fff c837 0010 0000 0000 003f 0000
0000 0000 5934 3253 4e46 4345 2020 2020
2020 2020 2020 2020 0003 3e00 0039 5941
5234 3142 5730 4d61 7874 6f72 2036 5931
3630 5030 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 2020 2020 2020 8010
0000 2f00 4000 0200 0000 0007 ffff 0001
003f ffc1 003e 0110 ffff 0fff 0000 0007
0003 0078 0078 0078 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
00fe 001e 7c6b 7f09 4003 7c69 3e01 4003
047f 0000 0000 0000 fffe 6d00 c0fe 0000
0000 0000 0000 0000 7400 1315 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0001 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0001 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 03a5

# hdparm -i /dev/sd[ab]

/dev/sda:

 Model=ST3120026A                              , FwRev=3.76    , SerialNo=3LJ03GAH            
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=?16?
 CurCHS=65535/1/63, CurSects=4128705, LBA=yes, LBAsects=234441648
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5 
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 2:  ATA/ATAPI-1,2,3,4,5,6

 * signifies the current active mode


/dev/sdb:

 Model=Maxtor 6Y160P0                          , FwRev=YAR41BW0, SerialNo=Y42SNFCE            
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
 BuffType=DualPortCache, BuffSize=7936kB, MaxMultSect=16, MultSect=?16?
 CurCHS=65535/1/63, CurSects=4128705, LBA=yes, LBAsects=320173056
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5 udma6 
 AdvancedPM=yes: disabled (255) WriteCache=enabled
 Drive conforms to: ATA/ATAPI-7 T13 1532D revision 0:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode
Comment 22 Manfred 2008-03-03 03:57:37 UTC
Perhaps another example welcome?

ASUS M2N-SLI Deluxe with NVidia nForce 570 SLI MCP

Primary Master: Plextor PX-130A - fails to detect 80-wire
Primary Slave:  Plextor PX-760A + succeeds


$ uname -a
Linux mammut 2.6.24-gentoo-r3 #2 SMP Mon Mar 3 11:34:50 CET 2008 x86_64 AMD
Athlon(tm) 64 X2 Dual Core Processor 5200+ AuthenticAMD GNU/Linux


$ dmesg :

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
NFORCE-MCP55: IDE controller (0x10de:0x036e rev 0xa1) at  PCI slot 0000:00:04.0
NFORCE-MCP55: not 100% native mode: will probe irqs later
NFORCE-MCP55: BIOS didn't set cable bits correctly. Enabling workaround.
NFORCE-MCP55: 0000:00:04.0 (rev a1) UDMA133 controller
    ide0: BM-DMA at 0xf000-0xf007, BIOS settings: hda:DMA, hdb:DMA
NFORCE-MCP55: IDE port disabled
Probing IDE interface ide0...
hdb: PLEXTOR DVDR PX-760A, ATAPI CD/DVD-ROM drive
hda: PLEXTOR DVD-ROM PX-130A, ATAPI CD/DVD-ROM drive
hda: host max PIO5 wanted PIO255(auto-tune) selected PIO4
hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
hda: UDMA/33 mode selected
hdb: host max PIO5 wanted PIO255(auto-tune) selected PIO4
hdb: UDMA/66 mode selected
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

# hdparm -i /dev/hd[ab]

/dev/hda:

 Model=PLEXTOR DVD-ROM PX-130A, FwRev=1.03, SerialNo=
 Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }
 RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=13395, BuffSize=64kB, MaxMultSect=0
 (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5
 AdvancedPM=no

 * signifies the current active mode


/dev/hdb:

 Model=PLEXTOR DVDR PX-760A, FwRev=1.07, SerialNo=245097
 Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }
 RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=0kB, MaxMultSect=0
 (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 *udma4
 AdvancedPM=no
 Drive conforms to: Unspecified:  ATA/ATAPI-3,4,5,6

 * signifies the current active mode


# lspci
00:01.0 ISA bridge: nVidia Corporation MCP55 LPC Bridge (rev a2)
00:04.0 IDE interface: nVidia Corporation MCP55 IDE (rev a1)
Comment 23 Manfred 2008-03-03 04:10:53 UTC
(In reply to comment #22)

P.S.:

In earlier kernels, I could do a successful hard override
in drivers/ata/libata-core.c : ata_dev_xfermask()

Now (= 2.6.24-r3) the message is issued from 
drivers/ide/ide-iops.c : ide_ata66_check,
and the if-cascade in libata-core doesn't get fired any more.
Comment 24 Manfred 2008-03-03 04:14:26 UTC
 hdparm --Istdout /dev/hd[a,b]

/dev/hda:
85c0 0000 0000 0000 0000 0000 0000 0000
0000 0000 2020 2020 2020 2020 2020 2020
2020 2020 2020 2020 3453 0080 0000 312e
3033 2020 2020 504c 4558 544f 5220 4456
442d 524f 4d20 5058 2d31 3330 4120 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0f00 0000 0200 0200 0006 0000 0000
0000 0000 0000 0000 0000 0000 0000 0007
0003 0078 0078 0078 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0218 4000 4000 0218 0000 4000
043f 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

/dev/hdb:
85c0 0000 0000 0000 0000 0000 0000 0000
0000 0000 2020 2020 2020 2020 2020 2020
2020 3234 3530 3937 0000 0000 0000 312e
3037 2020 2020 504c 4558 544f 5220 4456
4452 2020 2050 582d 3736 3041 2020 2020
2020 2020 2020 2020 2020 2020 2020 0000
0000 0f00 0000 0400 0200 0006 0000 0000
0000 0000 0000 0000 0000 0000 0000 0007
0003 0078 0078 0078 0078 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0078 0000 0000 0000 0000 0000 0000 0000
101f 0000 0000 0000 0000 6b00 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
Comment 25 Jakub Moc 2008-03-03 04:19:35 UTC
(In reply to comment #23)
> Now (= 2.6.24-r3) the message is issued from 
> drivers/ide/ide-iops.c : ide_ata66_check,
> and the if-cascade in libata-core doesn't get fired any more.

Uhm... this bug is about libata + pata_via *only*. You apparently are not using either of those, re-read your dmesg output.
Comment 26 Manfred 2008-03-03 04:45:52 UTC
(In reply to comment #25)
 
> Uhm... this bug is about libata + pata_via *only*.

Sorrrry - IFF *only*, THEN surely my example is placed wrong here.

Would you want me to open a new bug for it?
Comment 27 Manfred 2008-03-06 05:08:48 UTC
(In reply to comment #26)
> Would you want me to open a new bug for it?

http://bugzilla.kernel.org/show_bug.cgi?id=10179 
Comment 28 Karl Tischler 2008-03-29 04:21:44 UTC
I'think I solved the problem!
I changed my OS from Suse to Debian and I had to compile a new kernel for my
system. My actually kernel build is 2.6.23.14.
At the moment I couldn't exectly say the matter, but I think, everybody, who
compiled all kernel releases from 2.6.18 .. to 2.6.23.. there was a change in
udev and other modules and if you made oldconfig you have over the structure of
kernel config.
My actually output:
debian-server:~# hdparm -i /dev/sdb

/dev/sdb:

 Model=SAMSUNG SP2514N                         , FwRev=VF100-41, SerialNo=S08BJ1JL530690
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4
 BuffType=DualPortCache, BuffSize=8192kB, MaxMultSect=16, MultSect=?16?
 CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=268435455
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-1 ATA/ATAPI-2 ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6 ATA/ATAPI-7

 * signifies the current active mode


I also put there a textfile with my kernel config on the following link, to
compare my config with yours:
http://unix-connection.h989210.serverkompetenz.net/kernel/config
Comment 29 Alan 2008-06-10 08:06:42 UTC
Good to know the upstream fixes sorted this

Note You need to log in before you can comment on or make changes to this bug.