Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1676

kernel-2.6.18-238.el5.src.rpm

From: David Milburn <dmilburn@redhat.com>
Date: Mon, 17 Nov 2008 10:00:02 -0600
Subject: [libata] force sb600/700 ide mode into ahci on resume
Message-id: 20081117160002.GA10220@dhcp-210.hsv.redhat.com
O-Subject: [RHEL5.3 PATCH] libata: force sb600/700 ide mode into ahci on resume
Bugzilla: 466422
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>
RH-Acked-by: Alan Cox <alan@redhat.com>

This patch is from Shane Huang (AMD), RHEL5 uses a
PCI quirk to force SB600/SB700 IDE mode into AHCI
mode to use the ahci driver. However on S3 resume,
the force is lost. This patch fixes the S3 resume
failure and resolves BZ 466422.

These exact bits were originally posted by Bhavana
and committed in -88.el5, but, I inadvertently lost
the changes in the 5.3 driver update.

http://post-office.corp.redhat.com/archives/rhkernel-list/2008-March/msg00931.html

AMD has verified a -123.el5 test kernel (task 1573257) built with
this patch on a SB700 platform, please review and
ack.

Thanks,
David

 drivers/ata/ahci.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 92505f7..f35a647 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -2255,6 +2255,22 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
 	struct ata_host *host = dev_get_drvdata(&pdev->dev);
 	int rc;
 
+	if (pdev->vendor == PCI_VENDOR_ID_ATI &&
+	    (pdev->device == 0x4380 || pdev->device == 0x4390)) {
+		u8 tmp;
+		pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp);
+		if (tmp == 0x01) {
+			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 = PCI_CLASS_STORAGE_SATA_AHCI;
+			printk(KERN_INFO "PCI: set SATA to AHCI mode\n");
+		}
+	}
+
 	rc = ata_pci_device_do_resume(pdev);
 	if (rc)
 		return rc;