Skip to contentSkip to conversation

PATCH: Stop megaraid trashing other i960 based devices

PATCH Alan Cox 3 participants 7 messages May 22, 2004 SCSI

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

In 2.4 the megaraid driver was careful to avoid stepping on wrong devices. Specifically the megaraid3 series devices used an intel pci ID (8086:1960) which is the generic i960 identifier not their own.

The code to do this in 2.4 worked for almost all cases, but even that code has mysteriously vanished in 2.6 meaning the megaraid driver trashes stuff like promise i2o cards and compaq management cards.

The following patch puts back the 2.4 stuff + one additional check so that the driver isn't quite as rude as it was before.

scsi/megaraid.c renamed from scsi/megaraid.c~ +15 -0
@@ -4609,6 +4609,21 @@
 
 	pci_bus = pdev->bus->number;
 	pci_dev_func = pdev->devfn;
+	
+	if(pdev->vendor == PCI_VENDOR_ID_INTEL)		/* The megaraid3 stuff reports the id of the intel
+							   part which is not remotely specific to the megaraid */
+	{
+		u16 magic;
+		/* Don't fall over the Compaq management cards using the same PCI identifier */
+		if(pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
+		   pdev->subsystem_device == 0xC000)
+		   	return -ENODEV;
+		/* Now check the magic signature byte */
+		pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
+		if(magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
+			return -ENODEV;
+		/* Ok it is probably a megaraid */
+	}
 
 	/*
 	 * For these vendor and device ids, signature offsets are not
#1 lore raw
Quoted 11 lines · Alan Cox
scsi/megaraid.c renamed from scsi/megaraid.c~ +5 -0
@@ -4609,6 +4609,21 @@
 
 	pci_bus = pdev->bus->number;
 	pci_dev_func = pdev->devfn;
+	
+	if(pdev->vendor == PCI_VENDOR_ID_INTEL)		/* The megaraid3 stuff reports the id of the intel
+							   part which is not remotely specific to the megaraid */
+	{
+		u16 magic;

scsi/megaraid.c line 4626

Quoted 10 lines
scsi/megaraid.c renamed from scsi/megaraid.c~ +10 -0
+		/* Don't fall over the Compaq management cards using the same PCI identifier */
+		if(pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
+		   pdev->subsystem_device == 0xC000)
+		   	return -ENODEV;
+		/* Now check the magic signature byte */
+		pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
+		if(magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
+			return -ENODEV;
+		/* Ok it is probably a megaraid */
+	}

I think we should add all valid subvendor ids to the pci_id table instead. Especially to not consude the hotplug package.

author
#2 lore raw
Quoted 10 lines · On Sat, May 22, 2004 at 12:02:05PM -0400, [email protected] wrote:

scsi/megaraid.c line 4626

Quoted 7 lines
scsi/megaraid.c renamed from scsi/megaraid.c~ +7 -0
+		   	return -ENODEV;
+		/* Now check the magic signature byte */
+		pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
+		if(magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
+			return -ENODEV;
+		/* Ok it is probably a megaraid */
+	}

I think we should add all valid subvendor ids to the pci_id table instead. Especially to not consude the hotplug package.

Most of the megaraids don't have subvendor ids... so that doesn't work at all.

#3 lore raw
Quoted 5 lines · Alan Cox
Quoted 2 lines

I think we should add all valid subvendor ids to the pci_id table instead. Especially to not consude the hotplug package.

Most of the megaraids don't have subvendor ids... so that doesn't work at all.

Okay. In that case we should apply the patch and shoot some megraid hardware engineer.

(and keep linux-scsi in the loop)

#4 lore raw
Quoted 6 lines · On Sat, May 22, 2004 at 12:07:18PM -0400, [email protected] wrote:
Quoted 2 lines · Alan Cox

Most of the megaraids don't have subvendor ids... so that doesn't work at all.

Okay. In that case we should apply the patch and shoot some megraid hardware engineer.

Now, I love a good megaraid bashing as much as the next guy. Just ask Peter Jarrett and Atul Mukker. But in this case I have to side with them. The cards w/o subsystem IDs all predate the existance of subsystem IDs in the PCI spec, and I'm pretty sure the IDs in the i960 of that vintage are hard-coded so AMI couldn't have changed them if they wanted to. So their magic words were the equivalent of what we now do with subsystem IDs. It's only the older cards that have a problem, AFAIK.

Thanks,
Matt

Signature · 4 lines
Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#5 lore raw
Quoted 8 lines · Matt Domsch

Now, I love a good megaraid bashing as much as the next guy. Just ask Peter Jarrett and Atul Mukker. But in this case I have to side with them. The cards w/o subsystem IDs all predate the existance of subsystem IDs in the PCI spec, and I'm pretty sure the IDs in the i960 of that vintage are hard-coded so AMI couldn't have changed them if they wanted to. So their magic words were the equivalent of what we now do with subsystem IDs. It's only the older cards that have a problem, AFAIK.

Okay, so let's shoot an i960 engineer instead. Intel bashing is even more fun anyway ;-)

author
#6 lore raw
In reply to Matt Domsch
Quoted 4 lines · Matt Domsch

of that vintage are hard-coded so AMI couldn't have changed them if they wanted to. So their magic words were the equivalent of what we now do with subsystem IDs. It's only the older cards that have a problem, AFAIK.

Certain megaraid 3 era cards - so yes quite old stuff only. Its not the only driver with these kind of problems although the other i960 stuff I have does all have a unique id or class.