diff options
Diffstat (limited to 'drivers/ata/libata-eh.c')
| -rw-r--r-- | drivers/ata/libata-eh.c | 50 | 
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c69fcce505c..dad83df555c 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -95,12 +95,13 @@ enum {   * represents timeout for that try.  The first try can be soft or   * hardreset.  All others are hardreset if available.  In most cases   * the first reset w/ 10sec timeout should succeed.  Following entries - * are mostly for error handling, hotplug and retarded devices. + * are mostly for error handling, hotplug and those outlier devices that + * take an exceptionally long time to recover from reset.   */  static const unsigned long ata_eh_reset_timeouts[] = {  	10000,	/* most drives spin up by 10sec */  	10000,	/* > 99% working drives spin up before 20sec */ -	35000,	/* give > 30 secs of idleness for retarded devices */ +	35000,	/* give > 30 secs of idleness for outlier devices */  	 5000,	/* and sweet one last chance */  	ULONG_MAX, /* > 1 min has elapsed, give up */  }; @@ -1322,14 +1323,14 @@ void ata_eh_qc_complete(struct ata_queued_cmd *qc)   *	should be retried.  To be used from EH.   *   *	SCSI midlayer limits the number of retries to scmd->allowed. - *	scmd->retries is decremented for commands which get retried + *	scmd->allowed is incremented for commands which get retried   *	due to unrelated failures (qc->err_mask is zero).   */  void ata_eh_qc_retry(struct ata_queued_cmd *qc)  {  	struct scsi_cmnd *scmd = qc->scsicmd; -	if (!qc->err_mask && scmd->retries) -		scmd->retries--; +	if (!qc->err_mask) +		scmd->allowed++;  	__ata_eh_qc_complete(qc);  } @@ -1810,7 +1811,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,  	case ATA_DEV_ATA:  		if (err & ATA_ICRC)  			qc->err_mask |= AC_ERR_ATA_BUS; -		if (err & ATA_UNC) +		if (err & (ATA_UNC | ATA_AMNF))  			qc->err_mask |= AC_ERR_MEDIA;  		if (err & ATA_IDNF)  			qc->err_mask |= AC_ERR_INVALID; @@ -2293,6 +2294,7 @@ const char *ata_get_cmd_descript(u8 command)  		{ ATA_CMD_IDLE, 		"IDLE" },  		{ ATA_CMD_EDD, 			"EXECUTE DEVICE DIAGNOSTIC" },  		{ ATA_CMD_DOWNLOAD_MICRO,   	"DOWNLOAD MICROCODE" }, +		{ ATA_CMD_DOWNLOAD_MICRO_DMA,	"DOWNLOAD MICROCODE DMA" },  		{ ATA_CMD_NOP,			"NOP" },  		{ ATA_CMD_FLUSH, 		"FLUSH CACHE" },  		{ ATA_CMD_FLUSH_EXT, 		"FLUSH CACHE EXT" }, @@ -2313,6 +2315,8 @@ const char *ata_get_cmd_descript(u8 command)  		{ ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" },  		{ ATA_CMD_FPDMA_READ,		"READ FPDMA QUEUED" },  		{ ATA_CMD_FPDMA_WRITE,		"WRITE FPDMA QUEUED" }, +		{ ATA_CMD_FPDMA_SEND,		"SEND FPDMA QUEUED" }, +		{ ATA_CMD_FPDMA_RECV,		"RECEIVE FPDMA QUEUED" },  		{ ATA_CMD_PIO_READ,		"READ SECTOR(S)" },  		{ ATA_CMD_PIO_READ_EXT,		"READ SECTOR(S) EXT" },  		{ ATA_CMD_PIO_WRITE,		"WRITE SECTOR(S)" }, @@ -2339,12 +2343,15 @@ const char *ata_get_cmd_descript(u8 command)  		{ ATA_CMD_WRITE_LOG_EXT,	"WRITE LOG EXT" },  		{ ATA_CMD_READ_LOG_DMA_EXT,	"READ LOG DMA EXT" },  		{ ATA_CMD_WRITE_LOG_DMA_EXT, 	"WRITE LOG DMA EXT" }, +		{ ATA_CMD_TRUSTED_NONDATA,	"TRUSTED NON-DATA" },  		{ ATA_CMD_TRUSTED_RCV,		"TRUSTED RECEIVE" },  		{ ATA_CMD_TRUSTED_RCV_DMA, 	"TRUSTED RECEIVE DMA" },  		{ ATA_CMD_TRUSTED_SND,		"TRUSTED SEND" },  		{ ATA_CMD_TRUSTED_SND_DMA, 	"TRUSTED SEND DMA" },  		{ ATA_CMD_PMP_READ,		"READ BUFFER" }, +		{ ATA_CMD_PMP_READ_DMA,		"READ BUFFER DMA" },  		{ ATA_CMD_PMP_WRITE,		"WRITE BUFFER" }, +		{ ATA_CMD_PMP_WRITE_DMA,	"WRITE BUFFER DMA" },  		{ ATA_CMD_CONF_OVERLAY,		"DEVICE CONFIGURATION OVERLAY" },  		{ ATA_CMD_SEC_SET_PASS,		"SECURITY SET PASSWORD" },  		{ ATA_CMD_SEC_UNLOCK,		"SECURITY UNLOCK" }, @@ -2363,6 +2370,8 @@ const char *ata_get_cmd_descript(u8 command)  		{ ATA_CMD_CFA_TRANS_SECT,	"CFA TRANSLATE SECTOR" },  		{ ATA_CMD_CFA_ERASE,		"CFA ERASE SECTORS" },  		{ ATA_CMD_CFA_WRITE_MULT_NE, 	"CFA WRITE MULTIPLE WITHOUT ERASE" }, +		{ ATA_CMD_REQ_SENSE_DATA,	"REQUEST SENSE DATA EXT" }, +		{ ATA_CMD_SANITIZE_DEVICE,	"SANITIZE DEVICE" },  		{ ATA_CMD_READ_LONG,		"READ LONG (with retries)" },  		{ ATA_CMD_READ_LONG_ONCE,	"READ LONG (without retries)" },  		{ ATA_CMD_WRITE_LONG,		"WRITE LONG (with retries)" }, @@ -2394,7 +2403,7 @@ static void ata_eh_link_report(struct ata_link *link)  	struct ata_port *ap = link->ap;  	struct ata_eh_context *ehc = &link->eh_context;  	const char *frozen, *desc; -	char tries_buf[6]; +	char tries_buf[6] = "";  	int tag, nr_failed = 0;  	if (ehc->i.flags & ATA_EHI_QUIET) @@ -2425,9 +2434,8 @@ static void ata_eh_link_report(struct ata_link *link)  	if (ap->pflags & ATA_PFLAG_FROZEN)  		frozen = " frozen"; -	memset(tries_buf, 0, sizeof(tries_buf));  	if (ap->eh_tries < ATA_EH_MAX_TRIES) -		snprintf(tries_buf, sizeof(tries_buf) - 1, " t%d", +		snprintf(tries_buf, sizeof(tries_buf), " t%d",  			 ap->eh_tries);  	if (ehc->i.dev) { @@ -2548,11 +2556,12 @@ static void ata_eh_link_report(struct ata_link *link)  		}  		if (cmd->command != ATA_CMD_PACKET && -		    (res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF | -				     ATA_ABORTED))) -			ata_dev_err(qc->dev, "error: { %s%s%s%s}\n", +		    (res->feature & (ATA_ICRC | ATA_UNC | ATA_AMNF | +				     ATA_IDNF | ATA_ABORTED))) +			ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n",  			  res->feature & ATA_ICRC ? "ICRC " : "",  			  res->feature & ATA_UNC ? "UNC " : "", +			  res->feature & ATA_AMNF ? "AMNF " : "",  			  res->feature & ATA_IDNF ? "IDNF " : "",  			  res->feature & ATA_ABORTED ? "ABRT " : "");  #endif @@ -3009,7 +3018,7 @@ static inline void ata_eh_pull_park_action(struct ata_port *ap)  	 * ourselves at the beginning of each pass over the loop.  	 *  	 * Additionally, all write accesses to &ap->park_req_pending -	 * through INIT_COMPLETION() (see below) or complete_all() +	 * through reinit_completion() (see below) or complete_all()  	 * (see ata_scsi_park_store()) are protected by the host lock.  	 * As a result we have that park_req_pending.done is zero on  	 * exit from this function, i.e. when ATA_EH_PARK actions for @@ -3023,7 +3032,7 @@ static inline void ata_eh_pull_park_action(struct ata_port *ap)  	 */  	spin_lock_irqsave(ap->lock, flags); -	INIT_COMPLETION(ap->park_req_pending); +	reinit_completion(&ap->park_req_pending);  	ata_for_each_link(link, ap, EDGE) {  		ata_for_each_dev(dev, link, ALL) {  			struct ata_eh_info *ehi = &link->eh_info; @@ -4062,7 +4071,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)  	ata_acpi_set_state(ap, ap->pm_mesg);   out: -	/* report result */ +	/* update the flags */  	spin_lock_irqsave(ap->lock, flags);  	ap->pflags &= ~ATA_PFLAG_PM_PENDING; @@ -4071,11 +4080,6 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)  	else if (ap->pflags & ATA_PFLAG_FROZEN)  		ata_port_schedule_eh(ap); -	if (ap->pm_result) { -		*ap->pm_result = rc; -		ap->pm_result = NULL; -	} -  	spin_unlock_irqrestore(ap->lock, flags);  	return; @@ -4127,13 +4131,9 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)  	/* tell ACPI that we're resuming */  	ata_acpi_on_resume(ap); -	/* report result */ +	/* update the flags */  	spin_lock_irqsave(ap->lock, flags);  	ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); -	if (ap->pm_result) { -		*ap->pm_result = rc; -		ap->pm_result = NULL; -	}  	spin_unlock_irqrestore(ap->lock, flags);  }  #endif /* CONFIG_PM */  | 
