Skip to contentSkip to conversation

libata fixes

PATCH New Jeff Garzik 1 participant 1 message Nov 3, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata fixes

Fixes, fixes and more fixes.

Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git upstream-linus

to receive the following updates:

 drivers/ata/libata-core.c  |   38 ++++++++---
 drivers/ata/libata-eh.c    |  148 ++++++++++++++++++++++------------------
 drivers/ata/libata-scsi.c  |    2 +-
 drivers/ata/sata_fsl.c     |  159 +++++++++-----------------------------------
 drivers/ata/sata_promise.c |    2 +-
 include/linux/ata.h        |    6 ++
 6 files changed, 149 insertions(+), 206 deletions(-)

Adrian Bunk (1):
make ata_scsi_lpm_get() static

Jeff Garzik (4):
ata/sata_fsl: Remove unnecessary SCR cases ata/sata_fsl: cleanup needless casts to/from void __iomem * ata/sata_fsl: remove unneeded on-stack copy of FIS ata/sata_fsl: remove unneeded sata_fsl_hardreset()

Li Yang (5):
ata/sata_fsl: Update for ata_link introduction ata/sata_fsl: Remove deprecated hooks ata/sata_fsl: save irq in private data for irq unmapping ata/sata_fsl: Kill ata_sg_is_last() ata/sata_fsl: cleanup style problem

Mikael Pettersson (1):
sata_promise: fix endianess bug in ASIC PRD bug workaround

Stephen Hemminger (1):
libata: fix docbook

Stephen Rothwell (1):
libata: suppress two warnings

Tejun Heo (6):
libata: fix timing computation in ata_eh_reset()
libata: cosmetic clean up / reorganization of ata_eh_reset()
libata: more robust reset failure handling
libata: consider errors not associated with commands for speed down
libata: request PHY speed configuration on SControl access failure
libata: don't configure downstream links faster than the upstream link

Tony Battersby (1):
libata: increase 128 KB / cmd limit for ATAPI tape drives

ashish kalra (3):
ata/sata_fsl: Move MPC8315DS link speed limit workaround to specific ifdef ata/sata_fsl: Remove sending LOG EXT command in sata_fsl_softreset() ata/sata_fsl: Remove ata_scsi_suspend/resume callbacks

drivers/ata/libata-core.c +28 -10
index 63035d7..164c7d9 100644
@@ -704,8 +704,8 @@ static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
 
 /**
  *	ata_dev_enable_pm - enable SATA interface power management
- *	@device - device to enable ipm for
- *	@policy - the link power management policy
+ *	@dev:  device to enable power management
+ *	@policy: the link power management policy
  *
  *	Enable SATA Interface power management.  This will enable
  *	Device Interface Power Management (DIPM) for min_power
@@ -735,9 +735,10 @@ enable_pm_out:
 	return /* rc */;	/* hopefully we can use 'rc' eventually */
 }
 
+#ifdef CONFIG_PM
 /**
  *	ata_dev_disable_pm - disable SATA interface power management
- *	@device - device to enable ipm for
+ *	@dev: device to disable power management
  *
  *	Disable SATA Interface power management.  This will disable
  *	Device Interface Power Management (DIPM) without changing
@@ -755,6 +756,7 @@ static void ata_dev_disable_pm(struct ata_device *dev)
 	if (ap->ops->disable_pm)
 		ap->ops->disable_pm(ap);
 }
+#endif	/* CONFIG_PM */
 
 void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
 {
@@ -764,6 +766,7 @@ void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
 	ata_port_schedule_eh(ap);
 }
 
+#ifdef CONFIG_PM
 static void ata_lpm_enable(struct ata_host *host)
 {
 	struct ata_link *link;
@@ -789,6 +792,7 @@ static void ata_lpm_disable(struct ata_host *host)
 		ata_lpm_schedule(ap, ap->pm_policy);
 	}
 }
+#endif	/* CONFIG_PM */
 
 
 /**
@@ -2300,6 +2304,10 @@ int ata_dev_configure(struct ata_device *dev)
 		dev->max_sectors = ATA_MAX_SECTORS;
 	}
 
+	if ((dev->class == ATA_DEV_ATAPI) &&
+	    (atapi_command_packet_set(id) == TYPE_TAPE))
+		dev->max_sectors = ATA_MAX_SECTORS_TAPE;
+
 	if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
 		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
 					 dev->max_sectors);
@@ -2743,17 +2751,27 @@ int sata_down_spd_limit(struct ata_link *link)
 
 static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
 {
-	u32 spd, limit;
+	struct ata_link *host_link = &link->ap->link;
+	u32 limit, target, spd;
+
+	limit = link->sata_spd_limit;
 
-	if (link->sata_spd_limit == UINT_MAX)
-		limit = 0;
+	/* Don't configure downstream link faster than upstream link.
+	 * It doesn't speed up anything and some PMPs choke on such
+	 * configuration.
+	 */
+	if (!ata_is_host_link(link) && host_link->sata_spd)
+		limit &= (1 << host_link->sata_spd) - 1;
+
+	if (limit == UINT_MAX)
+		target = 0;
 	else
-		limit = fls(link->sata_spd_limit);
+		target = fls(limit);
 
 	spd = (*scontrol >> 4) & 0xf;
-	*scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4);
+	*scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
 
-	return spd != limit;
+	return spd != target;
 }
 
 /**
@@ -2776,7 +2794,7 @@ int sata_set_spd_needed(struct ata_link *link)
 	u32 scontrol;
 
 	if (sata_scr_read(link, SCR_CONTROL, &scontrol))
-		return 0;
+		return 1;
 
 	return __sata_set_spd_needed(link, &scontrol);
 }
drivers/ata/libata-eh.c +81 -67

216 lines not on this page · raw message

drivers/ata/libata-scsi.c +1 -1
index fc89590..245057d 100644
@@ -120,7 +120,7 @@ static const struct {
 	{ MEDIUM_POWER, "medium_power" },
 };
 
-const char *ata_scsi_lpm_get(enum link_pm policy)
+static const char *ata_scsi_lpm_get(enum link_pm policy)
 {
 	int i;
 
drivers/ata/sata_fsl.c +32 -127

369 lines not on this page · raw message

drivers/ata/sata_promise.c +1 -1
index 825e717..7914def 100644
@@ -587,7 +587,7 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
 			VPRINTK("Splitting last PRD.\n");
 
 			addr = le32_to_cpu(ap->prd[idx - 1].addr);
-			ap->prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG);
+			ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
 			VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
 
 			addr = addr + len - SG_COUNT_ASIC_BUG;
include/linux/ata.h +6 -0
index 128dc7a..61535e7 100644
@@ -43,6 +43,7 @@ enum {
 	ATA_MAX_SECTORS_128	= 128,
 	ATA_MAX_SECTORS		= 256,
 	ATA_MAX_SECTORS_LBA48	= 65535,/* TODO: 65536? */
+	ATA_MAX_SECTORS_TAPE	= 65535,
 
 	ATA_ID_WORDS		= 256,
 	ATA_ID_SERNO		= 10,
@@ -544,6 +545,11 @@ static inline int atapi_cdb_len(const u16 *dev_id)
 	}
 }
 
+static inline int atapi_command_packet_set(const u16 *dev_id)
+{
+	return (dev_id[0] >> 8) & 0x1f;
+}
+
 static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
 {
 	return (tf->protocol == ATA_PROT_ATAPI) ||