[PATCH 1/2] Add Legacy IDE mode support for SB600 SATA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: [email protected]

ATI SB600 SATA controller supports 4 modes: Legacy IDE, Native IDE, AHCI and RAID.IDE modes are used for compatibility with some old OS without AHCI driver,but now they are not necessary for Linux since the kernel has supported AHCI.Some BIOS set Legacy IDE as SB600 SATA's default mode, but the AHCI driver cannot run in Legacy IDE.So, we should set the controller back to AHCI mode if it has been set as IDE by BIOS.

Signed-off-by:  Luugi Marsan <[email protected]>

--- linux-2.6.19-rc4-git5/drivers/pci/quirks.c.orig     2006-11-04 03:50:25.000000000 +0800
+++ linux-2.6.19-rc4-git5/drivers/pci/quirks.c  2006-11-04 03:53:56.000000000 +0800
@@ -796,6 +796,35 @@ static void __init quirk_mediagx_master(
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX,   PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master );
 
+
+/*
+ * ATI SB600 SATA controller supports 4 modes: Legacy IDE, Native IDE, AHCI
+ * and RAID.
+ * IDE modes are used for compatibility with some old OS without AHCI driver,
+ * but now they are not necessary for Linux since the kernel has supported
+ * AHCI.
+ * Some BIOS set Legacy IDE as SB600 SATA's default mode, but the AHCI driver
+ * cannot run in Legacy IDE.
+ * So, we should set the controller back to AHCI mode if it has been set as IDE
+ * by BIOS.
+ */
+static void __devinit quirk_sb600_sata(struct pci_dev *pdev)
+{
+       if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE)
+       {
+               u8 tmp;
+
+               pci_read_config_byte(pdev, 0x40, &tmp);
+               pci_write_config_byte(pdev, 0x40, tmp|1);
+               pci_write_config_byte(pdev, 0x9, 1);
+               pci_write_config_byte(pdev, 0xa, 6);
+               pci_write_config_byte(pdev, 0x40, tmp);
+              
+               pdev->class = 0x010601;
+       }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_sb600_sata);
+
 /*
  * As per PCI spec, ignore base address registers 0-3 of the IDE controllers
  * running in Compatible mode (bits 0 and 2 in the ProgIf for primary and 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux