aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-bmdma.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-05-31 05:27:48 -0400
committerTejun Heo <htejun@gmail.com>2006-05-31 05:27:48 -0400
commitf5914a461eb9703773226a0813f6ffcae10c0861 (patch)
tree3441af53250530c3135a8fa55f06dd7bc62da037 /drivers/scsi/libata-bmdma.c
parentd7bb4cc7575929a60b0a718daa1bce87bea9a9cc (diff)
[PATCH] libata-hp-prep: add prereset() method and implement ata_std_prereset()
With hotplug, every reset might be a probing reset and thus something similar to probe_init() is needed. prereset() method is called before a series of resets to a port and is the counterpart of postreset(). prereset() can tell EH to use different type of reset or skip reset by modifying ehc->i.action. This patch also implements ata_std_prereset(). Most controllers should be able to use this function directly or with some wrapping. After hotplug, different controllers need different actions to resume the PHY and detect the newly attached device. Controllers can be categorized as follows. * Controllers which can wait for the first D2H FIS after hotplug. Note that if the waiting is implemented by polling TF status, there needs to be a way to set BSY on PHY status change. It can be implemented by hardware or with the help of the driver. * Controllers which can wait for the first D2H FIS after sending COMRESET. These controllers need to issue COMRESET to wait for the first FIS. Note that the received D2H FIS could be the first D2H FIS after POR (power-on-reset) or D2H FIS in response to the COMRESET. Some controllers use COMRESET as TF status synchronization point and clear TF automatically (sata_sil). * Controllers which cannot wait for the first D2H FIS reliably. Blindly issuing SRST to spinning-up device often results in command issue failure or timeout, causing extended delay. For these controllers, ata_std_prereset() explicitly waits ATA_SPINUP_WAIT (currently 8s) to give newly attached device time to spin up, then issues reset. Note that failing to getting ready in ATA_SPINUP_WAIT is not critical. libata will retry. So, the timeout needs to be long enough to spin up most devices. LLDDs can tell ata_std_prereset() which of above action is needed with ATA_FLAG_HRST_TO_RESUME and ATA_FLAG_SKIP_D2H_BSY flags. These flags are PHY-specific property and will be moved to ata_link later. While at it, this patch unifies function typedef's such that they all have named arguments. Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/scsi/libata-bmdma.c')
-rw-r--r--drivers/scsi/libata-bmdma.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c
index 6d30d2c52960..4bc05371737c 100644
--- a/drivers/scsi/libata-bmdma.c
+++ b/drivers/scsi/libata-bmdma.c
@@ -695,6 +695,7 @@ void ata_bmdma_thaw(struct ata_port *ap)
695/** 695/**
696 * ata_bmdma_drive_eh - Perform EH with given methods for BMDMA controller 696 * ata_bmdma_drive_eh - Perform EH with given methods for BMDMA controller
697 * @ap: port to handle error for 697 * @ap: port to handle error for
698 * @prereset: prereset method (can be NULL)
698 * @softreset: softreset method (can be NULL) 699 * @softreset: softreset method (can be NULL)
699 * @hardreset: hardreset method (can be NULL) 700 * @hardreset: hardreset method (can be NULL)
700 * @postreset: postreset method (can be NULL) 701 * @postreset: postreset method (can be NULL)
@@ -710,8 +711,9 @@ void ata_bmdma_thaw(struct ata_port *ap)
710 * LOCKING: 711 * LOCKING:
711 * Kernel thread context (may sleep) 712 * Kernel thread context (may sleep)
712 */ 713 */
713void ata_bmdma_drive_eh(struct ata_port *ap, ata_reset_fn_t softreset, 714void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
714 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 715 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
716 ata_postreset_fn_t postreset)
715{ 717{
716 struct ata_host_set *host_set = ap->host_set; 718 struct ata_host_set *host_set = ap->host_set;
717 struct ata_eh_context *ehc = &ap->eh_context; 719 struct ata_eh_context *ehc = &ap->eh_context;
@@ -759,7 +761,7 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_reset_fn_t softreset,
759 ata_eh_thaw_port(ap); 761 ata_eh_thaw_port(ap);
760 762
761 /* PIO and DMA engines have been stopped, perform recovery */ 763 /* PIO and DMA engines have been stopped, perform recovery */
762 ata_do_eh(ap, softreset, hardreset, postreset); 764 ata_do_eh(ap, prereset, softreset, hardreset, postreset);
763} 765}
764 766
765/** 767/**
@@ -779,7 +781,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)
779 if (sata_scr_valid(ap)) 781 if (sata_scr_valid(ap))
780 hardreset = sata_std_hardreset; 782 hardreset = sata_std_hardreset;
781 783
782 ata_bmdma_drive_eh(ap, ata_std_softreset, hardreset, ata_std_postreset); 784 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
785 ata_std_postreset);
783} 786}
784 787
785/** 788/**