PCI: Add ALI M5229 comaptibility mode quirk
The libata driver will not work with an M5229 set into native IDE mode (the old drivers/pci one does) if the M5229 does not provide it's own IRQ.
The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Note, I belive that the check for an valid interrupt line is correct, I only have an M5229 in an ALI M1543 to check this on. It would be useful to confirm that a M5229 with an valid IRQ does not trigger this quirk.
drivers/pci/quirks.c +28 -0
@@ -905,6 +905,34 @@ static void __devinit quirk_svwks_csb5id }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE , quirk_svwks_csb5ide); +/* Some systems set the ALI M5229 in the ALI M1543 bridge to native mode, +* which cannot be supported by the pata_ali.c driver (the old drivers/ide +* makes a compatibility effort to change the IDE interrupts). +*/ +static void __devinit quirk_ali_ide_compatibility (struct pci_dev *pdev) +{ +u8 tmp; + +/* pdev->irq and pdev->pin have yet to be initialised, so check +* by reading from the configuration header to see if we've got +* a valid interrupt line. */ + +pci_read_config_byte (pdev,PCI_INTERRUPT_LINE , &tmp); +if (tmp !=0xff ) +return ; + +pci_read_config_byte (pdev,PCI_CLASS_PROG , &tmp); +if (tmp &0x5 ) { +dev_info (&pdev->dev,"quirk: changing to IDE compatibility mode\n" ); + + tmp &= ~0x05 ; + pdev->class &= ~0x05 ; +pci_write_config_byte (pdev,PCI_CLASS_PROG , tmp); + } +} + +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AL ,PCI_DEVICE_ID_AL_M5229 , quirk_ali_ide_compatibility); +/* * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same */
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes'
Quoted 10 lines · Ben Dooks
The libata driver will not work with an M5229 set into native IDE mode (the old
drivers/pcione does) if the M5229 does not provide it's own IRQ.The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Quoted 4 lines
Note, I belive that the check for an valid interrupt line is correct, I only have an M5229 in an ALI M1543 to check this on. It would be useful to confirm that a M5229 with an valid IRQ does not trigger this quirk.
Why does this need to be a quirk rather than something in the libata ALi driver?
Quoted 50 lines
Signed-off-by Ben Dooks <[email protected]>Index:
linux-2.6.27-rc6-cats1/drivers/pci/quirks.c
===================================================================drivers/pci/quirks.c +28
-0@@ -905,6 +905,34 @@ static void __devinit quirk_svwks_csb5id }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE , quirk_svwks_csb5ide); +/* Some systems set the ALI M5229 in the ALI M1543 bridge to native mode, +* which cannot be supported by the pata_ali.c driver (the old drivers/ide +* makes a compatibility effort to change the IDE interrupts). +*/ +static void __devinit quirk_ali_ide_compatibility (struct pci_dev *pdev) +{ +u8 tmp; + +/* pdev->irq and pdev->pin have yet to be initialised, so check +* by reading from the configuration header to see if we've got +* a valid interrupt line. */ + +pci_read_config_byte (pdev,PCI_INTERRUPT_LINE , &tmp); +if (tmp !=0xff ) +return ; + +pci_read_config_byte (pdev,PCI_CLASS_PROG , &tmp); +if (tmp &0x5 ) { +dev_info (&pdev->dev,"quirk: changing to IDE compatibility mode\n" ); + + tmp &= ~0x05 ; + pdev->class &= ~0x05 ; +pci_write_config_byte (pdev,PCI_CLASS_PROG , tmp); + } +} + +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AL ,PCI_DEVICE_ID_AL_M5229 , quirk_ali_ide_compatibility); +/* * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same */ Signature · 8 lines
-- Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes' -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 11 lines · Matthew Wilcox
Quoted 10 lines · Ben Dooks
The libata driver will not work with an M5229 set into native IDE mode (the old
drivers/pcione does) if the M5229 does not provide it's own IRQ.The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Quoted 7 lines
Quoted 4 lines
Note, I belive that the check for an valid interrupt line is correct, I only have an M5229 in an ALI M1543 to check this on. It would be useful to confirm that a M5229 with an valid IRQ does not trigger this quirk.
Why does this need to be a quirk rather than something in the libata ALi driver?
The short answer is that "Alan Cox says not in libata", the longer one can be found:
http://www.archivum.info/[email protected]/2008-07/msg00410.html
Quoted 60 lines
Quoted 50 lines
Signed-off-by Ben Dooks <[email protected]>Index:
linux-2.6.27-rc6-cats1/drivers/pci/quirks.c
===================================================================drivers/pci/quirks.c +28
-0@@ -905,6 +905,34 @@ static void __devinit quirk_svwks_csb5id }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE , quirk_svwks_csb5ide); +/* Some systems set the ALI M5229 in the ALI M1543 bridge to native mode, +* which cannot be supported by the pata_ali.c driver (the old drivers/ide +* makes a compatibility effort to change the IDE interrupts). +*/ +static void __devinit quirk_ali_ide_compatibility (struct pci_dev *pdev) +{ +u8 tmp; + +/* pdev->irq and pdev->pin have yet to be initialised, so check +* by reading from the configuration header to see if we've got +* a valid interrupt line. */ + +pci_read_config_byte (pdev,PCI_INTERRUPT_LINE , &tmp); +if (tmp !=0xff ) +return ; + +pci_read_config_byte (pdev,PCI_CLASS_PROG , &tmp); +if (tmp &0x5 ) { +dev_info (&pdev->dev,"quirk: changing to IDE compatibility mode\n" ); + + tmp &= ~0x05 ; + pdev->class &= ~0x05 ; +pci_write_config_byte (pdev,PCI_CLASS_PROG , tmp); + } +} + +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AL ,PCI_DEVICE_ID_AL_M5229 , quirk_ali_ide_compatibility); +/* * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same */ Signature · 8 lines
-- Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes' -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 8 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 8 lines · Ben Dooks
Quoted 7 lines · Matthew Wilcox
Quoted 5 lines · Ben Dooks
The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Quoted 7 lines
Quoted 2 lines
Why does this need to be a quirk rather than something in the libata ALi driver?
The short answer is that "Alan Cox says not in libata", the longer one can be found:
http://www.archivum.info/[email protected]/2008-07/msg00410.html
Thanks for the reference. I've now read that thread. I'm not entirely convinced Alan is right; I think it's preferable to confine this quirking to the driver and fix up the BARs in the driver as well.
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 12 lines · Matthew Wilcox
Quoted 11 lines · Ben Dooks
Quoted 9 lines · Matthew Wilcox
Quoted 5 lines · Ben Dooks
The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Why does this need to be a quirk rather than something in the libata ALi driver?
Quoted 8 lines
Quoted 4 lines
The short answer is that "Alan Cox says not in libata", the longer one can be found:
http://www.archivum.info/[email protected]/2008-07/msg00410.html
Thanks for the reference. I've now read that thread. I'm not entirely convinced Alan is right; I think it's preferable to confine this quirking to the driver and fix up the BARs in the driver as well.
I'm not convinced by that, I've no idea how that will affect the system moving PCI BARs after the fact.
Quoted 5 lines
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 42 lines · Ben Dooks
The libata driver will not work with an M5229 set into native IDE mode (the old
drivers/pcione does) if the M5229 does not provide it's own IRQ.The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Note, I belive that the check for an valid interrupt line is correct, I only have an M5229 in an ALI M1543 to check this on. It would be useful to confirm that a M5229 with an valid IRQ does not trigger this quirk.
Signed-off-by Ben Dooks <[email protected]>Index:
linux-2.6.27-rc6-cats1/drivers/pci/quirks.c
===================================================================drivers/pci/quirks.c +17
-0@@ -905,6 +905,34 @@ static void __devinit quirk_svwks_csb5id }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE , quirk_svwks_csb5ide); +/* Some systems set the ALI M5229 in the ALI M1543 bridge to native mode, +* which cannot be supported by the pata_ali.c driver (the old drivers/ide +* makes a compatibility effort to change the IDE interrupts). +*/ +static void __devinit quirk_ali_ide_compatibility (struct pci_dev *pdev) +{ +u8 tmp; + +/* pdev->irq and pdev->pin have yet to be initialised, so check +* by reading from the configuration header to see if we've got +* a valid interrupt line. */ + +pci_read_config_byte (pdev,PCI_INTERRUPT_LINE , &tmp); +if (tmp !=0xff ) +return ; + +pci_read_config_byte (pdev,PCI_CLASS_PROG , &tmp);
drivers/pci/quirks.c static void __devinit quirk_svwks_csb5id · line 934
Quoted 10 lines
drivers/pci/quirks.c +10
-0+if (tmp &0x5 ) { +dev_info (&pdev->dev,"quirk: changing to IDE compatibility mode\n" ); + + tmp &= ~0x05 ; + pdev->class &= ~0x05 ; +pci_write_config_byte (pdev,PCI_CLASS_PROG , tmp); + } +} + +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AL ,PCI_DEVICE_ID_AL_M5229 , quirk_ali_ide_compatibility);
This is a bit surprising, considering that libata works for all IDE mode of other controllers...
Jeff
Quoted 49 lines · Jeff Garzik
Quoted 48 lines · Ben Dooks
The libata driver will not work with an M5229 set into native IDE mode (the old
drivers/pcione does) if the M5229 does not provide it's own IRQ.The M5229 implementation embedded into the ALI M1543 uses the M1543's ISA PIC to provide the interrupts and thus does not have an valid PCI IRQ set. This quirk detects the abscence of IRQ and sets the M5229 back into compatibility mode to use IRQs 14 and 15 so that libata works correctly.
Note, I belive that the check for an valid interrupt line is correct, I only have an M5229 in an ALI M1543 to check this on. It would be useful to confirm that a M5229 with an valid IRQ does not trigger this quirk.
Signed-off-by Ben Dooks <[email protected]>Index:
linux-2.6.27-rc6-cats1/drivers/pci/quirks.c
===================================================================drivers/pci/quirks.c +22
-0@@ -905,6 +905,34 @@ static void __devinit quirk_svwks_csb5id }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE , quirk_svwks_csb5ide); +/* Some systems set the ALI M5229 in the ALI M1543 bridge to native mode, +* which cannot be supported by the pata_ali.c driver (the old drivers/ide +* makes a compatibility effort to change the IDE interrupts). +*/ +static void __devinit quirk_ali_ide_compatibility(struct pci_dev *pdev) +{ +u8 tmp; + +/* pdev->irq and pdev->pin have yet to be initialised, so check +* by reading from the configuration header to see if we've got +* a valid interrupt line. */ + +pci_read_config_byte (pdev,PCI_INTERRUPT_LINE , &tmp); +if (tmp !=0xff ) +return ; + +pci_read_config_byte (pdev,PCI_CLASS_PROG , &tmp); +if (tmp &0x5 ) { +dev_info (&pdev->dev,"quirk: changing to IDE compatibility mode\n" ); + + tmp &= ~0x05 ; + pdev->class &= ~0x05 ; +pci_write_config_byte (pdev,PCI_CLASS_PROG , tmp);
Quoted 8 lines
drivers/pci/quirks.c static void __devinit quirk_svwks_csb5id · line 934
Quoted 4 lines
drivers/pci/quirks.c +4
-0+ } +} + +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AL ,PCI_DEVICE_ID_AL_M5229 , quirk_ali_ide_compatibility);This is a bit surprising, considering that libata works for all IDE mode of other controllers...
The problem is that when the M5229 is embedded into an M1543, the PCI IRQ is ignored, and the IRQ is routed directly into the ISA-PIC in the M1543. This routing is done via a different set of configuration registers, so that each channel can have its own IRQ.
This means that in pci-native mode, there is no pcidev.irq field set, as there is no PCI IRQ setup. Alan Cox has stated that this is too broken to be worked around in libata.
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes'