Re: [PATCH 1/5] libata: prefer hardreset

2008-01-27 Thread Tejun Heo
Tejun Heo wrote:
 - /* prereset() might have modified ehc-i.action */
 - if (ehc-i.action  ATA_EH_HARDRESET)
 - reset = hardreset;
 - else if (ehc-i.action  ATA_EH_SOFTRESET)
 - reset = softreset;
 - else {

Seems we'll need this chunk.  Will post updated version.

Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] libata: prefer hardreset

2008-01-27 Thread Tejun Heo
Tejun Heo wrote:
 Tejun Heo wrote:
 -/* prereset() might have modified ehc-i.action */
 -if (ehc-i.action  ATA_EH_HARDRESET)
 -reset = hardreset;
 -else if (ehc-i.action  ATA_EH_SOFTRESET)
 -reset = softreset;
 -else {
 
 Seems we'll need this chunk.  Will post updated version.

Ek... Never mind.  I was confused.  Sorry about the noise.

-- 
tejun
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] libata: prefer hardreset

2008-01-23 Thread Tejun Heo
When both soft and hard resets are available, libata preferred
softreset till now.  The logic behind it was to be softer to devices;
however, this doesn't really help much.  Rationales for the change:

* BIOS may freeze lock certain things during boot and softreset can't
  unlock those.  This by itself is okay but during operation PHY event
  or other error conditions can trigger hardreset and the device may
  end up with different configuration.

  For example, after a hardreset, previously unlockable HPA can be
  unlocked resulting in different device size and thus revalidation
  failure.  Similar condition can occur during or after resume.

* Certain ATAPI devices require hardreset to recover after certain
  error conditions.  On PATA, this is done by issuing the DEVICE RESET
  command.  On SATA, COMRESET has equivalent effect.  The problem is
  that DEVICE RESET needs its own execution protocol.

  For SFF controllers with bare TF access, it can be easily
  implemented but more advanced controllers (e.g. ahci and sata_sil24)
  require specialized implementations.  Simply using hardreset solves
  the problem nicely.

* COMRESET initialization sequence is the norm in SATA land and many
  SATA devices don't work properly if only SRST is used.  For example,
  some PMPs behave this way and libata works around by always issuing
  hardreset if the host supports PMP.

  Like the above example, libata has developed a number of mechanisms
  aiming to promote softreset to hardreset if softreset is not going
  to work.  This approach is time consuming and error prone.

  Also, note that, dependingon how you read the specs, it could be
  argued that PMP fan-out ports require COMRESET to start operation.
  In fact, all the PMPs on the market except one don't work properly
  if COMRESET is not issued to fan-out ports after PMP reset.

* COMRESET is an integral part of SATA connection and any working
  device should be able to handle COMRESET properly.  After all, it's
  the way to signal hardreset during reboot.  This is the most used
  and recommended (at least by the ahci spec) method of resetting
  devices.

So, this patch makes libata prefer hardreset over softreset by making
the following changes.

* Rename ATA_EH_RESET_MASK to ATA_EH_RESET and use it whereever
  ATA_EH_{SOFT|HARD}RESET used to be used.  ATA_EH_{SOFT|HARD}RESET is
  now only used to tell prereset whether soft or hard reset will be
  issued.

* Strip out now unneeded promote-to-hardreset logics from
  ata_eh_reset(), ata_std_prereset(), sata_pmp_std_prereset() and
  other places.

Signed-off-by: Tejun Heo [EMAIL PROTECTED]
---
 drivers/ata/ahci.c|   10 ++--
 drivers/ata/libata-core.c |   19 ++---
 drivers/ata/libata-eh.c   |   99 -
 drivers/ata/libata-pmp.c  |   28 -
 drivers/ata/libata-scsi.c |4 +-
 drivers/ata/sata_fsl.c|2 +-
 drivers/ata/sata_mv.c |   29 +++--
 drivers/ata/sata_nv.c |   12 +++---
 drivers/ata/sata_sil24.c  |   54 
 drivers/ata/sata_via.c|2 +-
 include/linux/libata.h|8 ++--
 11 files changed, 100 insertions(+), 167 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 6f089b8..a3caa01 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1605,7 +1605,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 
irq_stat)
u32 *unk = (u32 *)(pp-rx_fis + RX_FIS_UNK);
 
active_ehi-err_mask |= AC_ERR_HSM;
-   active_ehi-action |= ATA_EH_SOFTRESET;
+   active_ehi-action |= ATA_EH_RESET;
ata_ehi_push_desc(active_ehi,
  unknown FIS %08x %08x %08x %08x ,
  unk[0], unk[1], unk[2], unk[3]);
@@ -1613,19 +1613,19 @@ static void ahci_error_intr(struct ata_port *ap, u32 
irq_stat)
 
if (ap-nr_pmp_links  (irq_stat  PORT_IRQ_BAD_PMP)) {
active_ehi-err_mask |= AC_ERR_HSM;
-   active_ehi-action |= ATA_EH_SOFTRESET;
+   active_ehi-action |= ATA_EH_RESET;
ata_ehi_push_desc(active_ehi, incorrect PMP);
}
 
if (irq_stat  (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) {
host_ehi-err_mask |= AC_ERR_HOST_BUS;
-   host_ehi-action |= ATA_EH_SOFTRESET;
+   host_ehi-action |= ATA_EH_RESET;
ata_ehi_push_desc(host_ehi, host bus error);
}
 
if (irq_stat  PORT_IRQ_IF_ERR) {
host_ehi-err_mask |= AC_ERR_ATA_BUS;
-   host_ehi-action |= ATA_EH_SOFTRESET;
+   host_ehi-action |= ATA_EH_RESET;
ata_ehi_push_desc(host_ehi, interface fatal error);
}
 
@@ -1713,7 +1713,7 @@ static void ahci_port_intr(struct ata_port *ap)
/* while resetting, invalid completions are expected */
if (unlikely(rc  0  !resetting)) {
ehi-err_mask |= AC_ERR_HSM;
-