Skip to contentSkip to conversation

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

RFC Athol Mullen 3 participants 3 messages Feb 9, 2004 – 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 8 lines · Willy Tarreau

On Sun, Feb 08, 2004 at 11:45:18AM +1100, Athol Mullen wrote:

I captured dmesg and /proc/ide/piix, but forgot to post them. They're at work now. But I did the change, by commenting out the call to eighty_ninety_three() in piix.c, and my disks came back to 54 MB/s each, and 64 MB/s cumulated. dmesg showed UDMA33 before and now displays UDMA100 again. But I obviously cannot let it like that because if I install this kernel in a 40-pin machine, I will get some surprizes !

That's what worries me...

Quoted 3 lines

I understand. But could you please post your ICH5 detection code so that I can try it on this machine. I still can play with it for a few days before it gets racked. And I can try with both 40 and 80-pin cables.

This patch inserts the piix code into eighty_ninty_three() - obviously this is for testing purposes only. The patch was diff'd against 2.4.22, but patches okay to 2.6.1 with:
Hunk #1 succeeded at 719 (offset -10 lines).

ide-iops.c renamed from ide-iops.c.orig +28 -0
@@ -729,6 +729,34 @@
 
 #else
 
+#ifdef CONFIG_BLK_DEV_PIIX
+	/* ICH BIOSes are supposed to set a bit flags for us */
+	
+	ide_hwif_t *hwif	= HWIF(drive);
+	struct pci_dev *dev	= hwif->pci_dev;
+	u16 cr_flag		= 0x10 << drive->dn;
+	u16			reg54;
+
+	if (hwif->pci_dev->vendor == PCI_VENDOR_ID_INTEL) {
+		switch(hwif->pci_dev->device) {
+			case PCI_DEVICE_ID_INTEL_82801BA_8:
+	    		case PCI_DEVICE_ID_INTEL_82801BA_9:
+	    		case PCI_DEVICE_ID_INTEL_82801CA_10:
+	    		case PCI_DEVICE_ID_INTEL_82801CA_11:
+	    		case PCI_DEVICE_ID_INTEL_82801E_11:
+	    		case PCI_DEVICE_ID_INTEL_82801DB_10:
+			case PCI_DEVICE_ID_INTEL_82801DB_11:
+			case PCI_DEVICE_ID_INTEL_82801EB_11:
+			case PCI_DEVICE_ID_INTEL_82801AA_1:
+			case PCI_DEVICE_ID_INTEL_82372FB_1:
+			    {
+			    pci_read_config_word(dev, 0x54, &reg54);
+			    return ((reg54 & cr_flag) ? 1 : 0);
+			    }
+		}
+	}
+#endif /* CONFIG_BLK_DEV_PIIX */
+
 	return ((u8) ((HWIF(drive)->udma_four) &&
 #ifndef CONFIG_IDEDMA_IVB
 			(drive->id->hw_config & 0x4000) &&

(Still fudging via Kmail because tin won't work 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

Hi,

Quoted 4 lines · Athol Mullen

This patch inserts the piix code into eighty_ninty_three() - obviously this is for testing purposes only. The patch was diff'd against 2.4.22, but patches okay to 2.6.1 with:
Hunk #1 succeeded at 719 (offset -10 lines).

OK, I will try it ASAP on 2.4.25-rc1.

BTW, are you sure that the trick is needed for all the chipsets below, or should it be necessary only for some of them ? perhaps word93 is already OK for a few ones ?

Quoted 6 lines
ide-iops.c renamed from ide-iops.c.orig +6 -0
+		switch(hwif->pci_dev->device) {
+			case PCI_DEVICE_ID_INTEL_82801BA_8:
+	    		case PCI_DEVICE_ID_INTEL_82801BA_9:
+	    		case PCI_DEVICE_ID_INTEL_82801CA_10:
+	    		case PCI_DEVICE_ID_INTEL_82801CA_11:
+	    		case PCI_DEVICE_ID_INTEL_82801E_11:

ide-iops.c line 756

Quoted 10 lines
ide-iops.c renamed from ide-iops.c.orig +10 -0
+	    		case PCI_DEVICE_ID_INTEL_82801DB_10:
+			case PCI_DEVICE_ID_INTEL_82801DB_11:
+			case PCI_DEVICE_ID_INTEL_82801EB_11:
+			case PCI_DEVICE_ID_INTEL_82801AA_1:
+			case PCI_DEVICE_ID_INTEL_82372FB_1:
+			    {
+			    pci_read_config_word(dev, 0x54, &reg54);
+			    return ((reg54 & cr_flag) ? 1 : 0);
+			    }
+		}

Regards,
Willy

#6 lore raw
In reply to Athol Mullen
Quoted 45 lines · Athol Mullen
Quoted 8 lines · Willy Tarreau

On Sun, Feb 08, 2004 at 11:45:18AM +1100, Athol Mullen wrote:

I captured dmesg and /proc/ide/piix, but forgot to post them. They're at work now. But I did the change, by commenting out the call to eighty_ninety_three() in piix.c, and my disks came back to 54 MB/s each, and 64 MB/s cumulated. dmesg showed UDMA33 before and now displays UDMA100 again. But I obviously cannot let it like that because if I install this kernel in a 40-pin machine, I will get some surprizes !

That's what worries me...

Quoted 3 lines

I understand. But could you please post your ICH5 detection code so that I can try it on this machine. I still can play with it for a few days before it gets racked. And I can try with both 40 and 80-pin cables.

This patch inserts the piix code into eighty_ninty_three() - obviously this is for testing purposes only. The patch was diff'd against 2.4.22, but patches okay to 2.6.1 with:
Hunk #1 succeeded at 719 (offset -10 lines).

ide-iops.c renamed from ide-iops.c.orig +18 -0
@@ -729,6 +729,34 @@
 
 #else
 
+#ifdef CONFIG_BLK_DEV_PIIX
+	/* ICH BIOSes are supposed to set a bit flags for us */
+
+	ide_hwif_t *hwif	= HWIF(drive);
+	struct pci_dev *dev	= hwif->pci_dev;
+	u16 cr_flag		= 0x10 << drive->dn;
+	u16			reg54;
+
+	if (hwif->pci_dev->vendor == PCI_VENDOR_ID_INTEL) {
+		switch(hwif->pci_dev->device) {
+			case PCI_DEVICE_ID_INTEL_82801BA_8:
+	    		case PCI_DEVICE_ID_INTEL_82801BA_9:
+	    		case PCI_DEVICE_ID_INTEL_82801CA_10:
+	    		case PCI_DEVICE_ID_INTEL_82801CA_11:
+	    		case PCI_DEVICE_ID_INTEL_82801E_11:
+	    		case PCI_DEVICE_ID_INTEL_82801DB_10:
+			case PCI_DEVICE_ID_INTEL_82801DB_11:
+			case PCI_DEVICE_ID_INTEL_82801EB_11:

ide-iops.c line 759

Quoted 10 lines
ide-iops.c renamed from ide-iops.c.orig +10 -0
+			case PCI_DEVICE_ID_INTEL_82801AA_1:
+			case PCI_DEVICE_ID_INTEL_82372FB_1:
+			    {
+			    pci_read_config_word(dev, 0x54, &reg54);
+			    return ((reg54 & cr_flag) ? 1 : 0);
+			    }
+		}
+	}
+#endif /* CONFIG_BLK_DEV_PIIX */
+

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

(...)

	u8 mask = hwif->channel ? 0xc0 : 0x30;
(...)
			pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h);
			pci_read_config_byte(hwif->pci_dev, 0x55, &reg55h);
			ata66 = (reg54h & mask) ? 1 : 0;
(...)
	if (!(hwif->udma_four))
		hwif->udma_four = ata66;

So you could just add:

	return hwif->udma_four;

for testing purposes.

ide-iops.c line 760

Quoted 1 line
ide-iops.c renamed from ide-iops.c.orig +0 -0
 	return ((u8) ((HWIF(drive)->udma_four) &&

Therefore this will be true.

ide-iops.c line 762

Quoted 2 lines
ide-iops.c renamed from ide-iops.c.orig +0 -0
 #ifndef CONFIG_IDEDMA_IVB
 			(drive->id->hw_config & 0x4000) &&

Here is your problem.

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.

--bart