Re: libata interface fatal error

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

 



Florian Effenberger wrote:
> Hi,
> 
>> Currently, there is no mechanism to do that but hard drives usually have
>> dip switch to force 1.5Gbps.  Please try that.  If your harddrive
>> doesn't have that, please lemme know.  I'll prepare a simple patch.
> 
> unfortunately, the disks have a jumper board, but the jumpers are
> missing... could you write a patch for me? Would be much appreciated!

Okay, there was a bug in link speed limit logic.  That's probably why
speed down to 1.5Gbps didn't kick in.  The attached patch contains the
fix and hack to force 1.5Gbps.  Please give it a shot.

Thanks.

-- 
tejun
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7baeaff..f9550f1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -219,6 +219,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
 static void ahci_irq_clear(struct ata_port *ap);
 static int ahci_port_start(struct ata_port *ap);
+static int ahci_vt8251_port_start(struct ata_port *ap);
 static void ahci_port_stop(struct ata_port *ap);
 static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void ahci_qc_prep(struct ata_queued_cmd *qc);
@@ -284,7 +285,7 @@ static const struct ata_port_operations ahci_ops = {
 	.port_resume		= ahci_port_resume,
 #endif
 
-	.port_start		= ahci_port_start,
+	.port_start		= ahci_vt8251_port_start,
 	.port_stop		= ahci_port_stop,
 };
 
@@ -318,7 +319,7 @@ static const struct ata_port_operations ahci_vt8251_ops = {
 	.port_resume		= ahci_port_resume,
 #endif
 
-	.port_start		= ahci_port_start,
+	.port_start		= ahci_vt8251_port_start,
 	.port_stop		= ahci_port_stop,
 };
 
@@ -1558,6 +1559,19 @@ static int ahci_port_start(struct ata_port *ap)
 	return 0;
 }
 
+static int ahci_vt8251_port_start(struct ata_port *ap)
+{
+	struct ahci_host_priv *hpriv = ap->host->private_data;
+
+	if (((hpriv->cap >> 20) & 0xf) != 1) {
+		printk("limiting SATA link speed to 1.5Gbps\n");
+		ap->hw_sata_spd_limit = 1;
+		ap->eh_info.action |= ATA_EH_HARDRESET;
+	}
+
+	return ahci_port_start(ap);
+}
+
 static void ahci_port_stop(struct ata_port *ap)
 {
 	const char *emsg = NULL;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4733f00..57940ba 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6313,7 +6313,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
 		/* init sata_spd_limit to the current value */
 		if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) {
 			int spd = (scontrol >> 4) & 0xf;
-			ap->hw_sata_spd_limit &= (1 << spd) - 1;
+			if (spd)
+				ap->hw_sata_spd_limit &= (1 << spd) - 1;
 		}
 		ap->sata_spd_limit = ap->hw_sata_spd_limit;
 

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux