login
Header Space

 
 

ahci: don't attach if ICH6 is in combined mode

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, December 7, 2007 - 5:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c4f779...
Commit:     c4f7792c021cda9bbf65d0bc2253a593fd652b91
Parent:     d1aa690a7d1afa673c3383bfcd6e96ddb350939a
Author:     Tejun Heo <htejun@gmail.com>
AuthorDate: Thu Dec 6 15:09:43 2007 +0900
Committer:  Jeff Garzik <jeff@garzik.org>
CommitDate: Fri Dec 7 15:27:54 2007 -0500

    ahci: don't attach if ICH6 is in combined mode
    
    ICH6 R/Ms share PCI ID between piix and ahci modes and we've been
    allowing ahci to attach regardless of how BIOS configured it.
    However, enabling AHCI mode when the controller is in combined mode
    can result in unexpected behavior.  Don't attach if the controller is
    in combined mode.
    
    Signed-off-by: Tejun Heo <htejun@gmail.com>
    Cc: Bill Nottingham <notting@redhat.com>
    Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
 drivers/ata/ahci.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 588ab2f..cb7853b 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -193,6 +193,8 @@ enum {
 					  ATA_FLAG_ACPI_SATA | ATA_FLAG_AN |
 					  ATA_FLAG_IPM,
 	AHCI_LFLAG_COMMON		= ATA_LFLAG_SKIP_D2H_BSY,
+
+	ICH_MAP				= 0x90, /* ICH MAP register */
 };
 
 struct ahci_cmd_hdr {
@@ -2273,6 +2275,22 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (rc)
 		return rc;
 
+	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
+	    (pdev->device == 0x2652 || pdev->device == 0x2653)) {
+		u8 map;
+
+		/* ICH6s share the same PCI ID for both piix and ahci
+		 * modes.  Enabling ahci mode while MAP indicates
+		 * combined mode is a bad idea.  Yield to ata_piix.
+		 */
+		pci_read_config_byte(pdev, ICH_MAP, &map);
+		if (map & 0x3) {
+			dev_printk(KERN_INFO, &pdev->dev, "controller is in "
+				   "combined mode, can't enable AHCI mode\n");
+			return -ENODEV;
+		}
+	}
+
 	hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
 	if (!hpriv)
 		return -ENOMEM;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ahci: don't attach if ICH6 is in combined mode, Linux Kernel Mailing List..., (Fri Dec 7, 5:59 pm)
speck-geostationary