Skip to contentSkip to conversation

IDE 80-core cable detect - chipset-specific code to over-ride eighty_ninty_three()

RFC Athol Mullen 2 participants 2 messages Feb 10, 2004 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 1 line · Bartlomiej Zolnierkiewicz

On Monday 09 of February 2004 03:50, Athol Mullen wrote:

(Don't CC. I read lkml via linux.kernel newsgroup.)

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +3 -0
+     u16 cr_flag             = 0x10 << drive->dn;
 
+                         pci_read_config_word(dev, 0x54, &reg54);
+                         return ((reg54 & cr_flag) ? 1 : 0);

This is plain wrong, piix.c already does it for you. piix.c:init_hwif_piix():

The penny drops...

I missed this code because I was looking for cable detection on a drive-by-drive basis, and this is taking drives in pairs.

That's why the drive was being correctly initialised as a UDMA5 drive even though eighty_ninty_three() was returning zero.

The existing code was written before the ICH5 came out, and will always work for ICH4 and older, but is wrong in its method of detecting 80-core cables on an ICH5, and could fail if SATA and PATA drives are mixed and used in compatability mode. The bit flags should be taken on a drive-by-drive basis, because the ICH5 is capable of logical mapping such as:

SATA0 -> IDE0 Master
SATA1 -> IDE0 Slave
PATA0 master -> IDE1 Master
PATA1 master -> IDE1 Slave

Note that this now sees two PATA drives on different physical interfaces looking like master and slave on one interface. In this scenario, if PATA1 has a 40-core and PATA0 an 80-core or vise versa, both would be detected as having 80-core with the existing code.

Why do I feel like I just pulled the lid off a can of worms?

The options are essentially that we:
1. Always force the SATA interfaces into native mode and PATA into native or normal mode (desirable - the compatability mode described above make only 2 PATA drives visible),
2. Modify the above code to work on a drive-by-drive basis instead of interface-by-interface (according to Intel, this is the correct answer),
3. Do nothing, and hope nobody notices. :-)

Quoted 2 lines

Please make sure you have CONFIG_IDEDMA_IVB=n in your config. If it is okay, please send me a copy of /proc/ide/hdX/identify.

I definately had CONFIG_IDEDMA_IVB=n.

/proc/ide/hda/identify and /proc/ide/hda/model emailed.

(Apologies if messages don't thread properly.)

Signature · 4 lines
Athol
<http://cust.idl.com.au/athol>
Linux Registered User # 254000
I'm a Libran Engineer. I don't argue, I discuss.
#5 lore raw
Quoted 33 lines · Athol Mullen
Quoted 1 line · Bartlomiej Zolnierkiewicz

On Monday 09 of February 2004 03:50, Athol Mullen wrote:

(Don't CC. I read lkml via linux.kernel newsgroup.)

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +3 -0
+     u16 cr_flag             = 0x10 << drive->dn;
 
+                         pci_read_config_word(dev, 0x54, &reg54);
+                         return ((reg54 & cr_flag) ? 1 : 0);

This is plain wrong, piix.c already does it for you. piix.c:init_hwif_piix():

The penny drops...

I missed this code because I was looking for cable detection on a drive-by-drive basis, and this is taking drives in pairs.

That's why the drive was being correctly initialised as a UDMA5 drive even though eighty_ninty_three() was returning zero.

The existing code was written before the ICH5 came out, and will always work for ICH4 and older, but is wrong in its method of detecting 80-core cables on an ICH5, and could fail if SATA and PATA drives are mixed and used in compatability mode. The bit flags should be taken on a drive-by-drive basis, because the ICH5 is capable of logical mapping such as:

SATA0 -> IDE0 Master
SATA1 -> IDE0 Slave
PATA0 master -> IDE1 Master
PATA1 master -> IDE1 Slave

Quoted 6 lines

Note that this now sees two PATA drives on different physical interfaces looking like master and slave on one interface. In this scenario, if PATA1 has a 40-core and PATA0 an 80-core or vise versa, both would be detected as having 80-core with the existing code.

Why do I feel like I just pulled the lid off a can of worms?

:-)

Quoted 8 lines

The options are essentially that we:
1. Always force the SATA interfaces into native mode and PATA into native or normal mode (desirable - the compatability mode described above make only 2 PATA drives visible),
2. Modify the above code to work on a drive-by-drive basis instead of interface-by-interface (according to Intel, this is the correct answer),
3. Do nothing, and hope nobody notices. :-)

Solution 1. is good also for other things, but changes order of the drives so it is 2.7.x thing. For now you can just add code for ICH5 setting hwif->udma_four only if both drives report 80-c, something like:

	if ((reg54h & mask) == mask)
		ata66 = 1;

--bart