linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.21-rc7-mm2 2/2] sata_promise: move port reset from error intr to EH prereset
@ 2007-04-29  2:03 Mikael Pettersson
  2007-04-30  9:27 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Pettersson @ 2007-04-29  2:03 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide

When sata_promise detects an error, it resets the port and
triggers EH. This is how it has always done things. New-style
EH however appears to prefer (based on ahci and sata_sil24)
error detection to just freeze the port or otherwise render
it harmless, and for the reset to be delayed until EH runs.

This patch updates sata_promise EH according to this principle.
When an error is detected in pdc_error_intr, the port is frozen
but not reset. Later in the error handler, the prereset procedure
performs the necessary Promise-specific reset of the port.

Notes:
- Since pdc_error_intr no longer resets the port, ata_do_eh()
  can do its error analysis on the current register contents, so
  pdc_error_intr doesn't need to copy SCR_ERROR to ehi->serror.
- The reset is done in prereset since that is the one point that
  (a) comes after libata's error analysis, and (b) dominates
  (in a control-flow sense) all subsequent reset parts of EH.

Tested on SATA300 TX4, SATA300 TX2plus, SATAII-150 TX2plus,
SATA150 TX2plus, and TX4000.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
---
 drivers/ata/sata_promise.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

--- linux-2.6.21-rc7-mm2/drivers/ata/sata_promise.c.~1~	2007-04-28 23:16:57.000000000 +0200
+++ linux-2.6.21-rc7-mm2/drivers/ata/sata_promise.c	2007-04-28 23:55:49.000000000 +0200
@@ -45,7 +45,7 @@
 #include "sata_promise.h"
 
 #define DRV_NAME	"sata_promise"
-#define DRV_VERSION	"2.06"
+#define DRV_VERSION	"2.07"
 
 
 enum {
@@ -598,13 +598,16 @@ static void pdc_thaw(struct ata_port *ap
 	readl(mmio + PDC_CTLSTAT); /* flush */
 }
 
-static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset)
+static int pdc_prereset(struct ata_port *ap, unsigned long deadline)
 {
-	if (!(ap->pflags & ATA_PFLAG_FROZEN))
-		pdc_reset_port(ap);
+	pdc_reset_port(ap);
+	return ata_std_prereset(ap, deadline);
+}
 
+static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset)
+{
 	/* perform recovery */
-	ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
+	ata_do_eh(ap, pdc_prereset, ata_std_softreset, hardreset,
 		  ata_std_postreset);
 }
 
@@ -647,12 +650,10 @@ static void pdc_error_intr(struct ata_po
 			   | PDC_PCI_SYS_ERR | PDC1_PCI_PARITY_ERR))
 		ac_err_mask |= AC_ERR_HOST_BUS;
 
-	if (sata_scr_valid(ap))
-		ehi->serror |= pdc_sata_scr_read(ap, SCR_ERROR);
-
+	ehi->action |= ATA_EH_SOFTRESET;
 	qc->err_mask |= ac_err_mask;
 
-	pdc_reset_port(ap);
+	ata_port_freeze(ap);
 }
 
 static inline unsigned int pdc_host_intr( struct ata_port *ap,

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.21-rc7-mm2 2/2] sata_promise: move port reset from error intr to EH prereset
@ 2007-05-01 20:29 Mikael Pettersson
  2007-05-02  1:15 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Pettersson @ 2007-05-01 20:29 UTC (permalink / raw)
  To: htejun, mikpe; +Cc: jgarzik, linux-ide

On Mon, 30 Apr 2007 11:27:46 +0200, Tejun Heo wrote:
>Mikael Pettersson wrote:
>> @@ -647,12 +650,10 @@ static void pdc_error_intr(struct ata_po
>>  			   | PDC_PCI_SYS_ERR | PDC1_PCI_PARITY_ERR))
>>  		ac_err_mask |= AC_ERR_HOST_BUS;
>>  
>> -	if (sata_scr_valid(ap))
>> -		ehi->serror |= pdc_sata_scr_read(ap, SCR_ERROR);
>> -
>> +	ehi->action |= ATA_EH_SOFTRESET;
>>  	qc->err_mask |= ac_err_mask;
>>  
>> -	pdc_reset_port(ap);
>> +	ata_port_freeze(ap);
>>  }
>
>You really don't wanna schedule ATA_EH_SOFTRESET and freeze the port on
>every error.  If you do that, ATAPI devices will be reset after each
>CHECK CONDITION and it probably won't work properly.

Would that be hal polling to see if media has been inserted?

>  FWIW, libata EH
>automatically issues softreset if the port is frozen (as that's the only
>way to thaw the port), so setting EH_SOFTRESET is optional if you freeze
>the port.
>
>Another problem is that EH may issue other commands to while trying to
>recover - e.g. PACKET - REQUEST SENSE or READ LOG PAGE.  This only
>happens if the port is ready for commands, IOW, !frozen.  Before, the
>pdc_reset_port() used to be called on entry to EH if it's not frozen but
>it's not after this patch.  Is this safe?

Oh dear. I assumed EH would only want to inspect the standard
status registers, and that's why I wanted to delay the reset.
If EH wants to talk to the device then it's a very bad idea to
not have issued a pdc_reset_port() first.

Jeff, please toss this patch in the dust bin.

/Mikael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-02  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-29  2:03 [PATCH 2.6.21-rc7-mm2 2/2] sata_promise: move port reset from error intr to EH prereset Mikael Pettersson
2007-04-30  9:27 ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2007-05-01 20:29 Mikael Pettersson
2007-05-02  1:15 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).