aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-04-07 09:47:20 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:23 -0400
commit4c9bf4e799ce06a7378f1196587084802a414c03 (patch)
tree70a7d3741e756b975468850537f222349143a0be /drivers/scsi
parent79f97dadfe9b4b561634d202225ba2fa910dc225 (diff)
libata: replace tf_read with qc_fill_rtf for non-SFF drivers
Now that all SFF stuff is separated out of core layer, core layer doesn't call ops->tf_read directly. It gets called only via ops->qc_fill_rtf() for non-SFF drivers. This patch directly implements private ops->qc_fill_rtf() for non-SFF controllers and kill ops->tf_read(). This is much cleaner for non-SFF controllers as some of them have to cache SFF register values in private data structure and report the cached values via ops->tf_read(). Also, ops->tf_read() gets nasty for controllers which don't have clear notion of TF registers when operation is not in progress. As this change makes default ops->qc_fill_rtf unnecessary, move ata_sff_qc_fill_rtf() form ata_base_port_ops to ata_sff_port_ops where it belongs. Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ipr.c59
-rw-r--r--drivers/scsi/libsas/sas_ata.c17
2 files changed, 39 insertions, 37 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 2ecd32991522..b079f6c33711 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5041,33 +5041,6 @@ static void ipr_ata_post_internal(struct ata_queued_cmd *qc)
5041} 5041}
5042 5042
5043/** 5043/**
5044 * ipr_tf_read - Read the current ATA taskfile for the ATA port
5045 * @ap: ATA port
5046 * @tf: destination ATA taskfile
5047 *
5048 * Return value:
5049 * none
5050 **/
5051static void ipr_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
5052{
5053 struct ipr_sata_port *sata_port = ap->private_data;
5054 struct ipr_ioasa_gata *g = &sata_port->ioasa;
5055
5056 tf->feature = g->error;
5057 tf->nsect = g->nsect;
5058 tf->lbal = g->lbal;
5059 tf->lbam = g->lbam;
5060 tf->lbah = g->lbah;
5061 tf->device = g->device;
5062 tf->command = g->status;
5063 tf->hob_nsect = g->hob_nsect;
5064 tf->hob_lbal = g->hob_lbal;
5065 tf->hob_lbam = g->hob_lbam;
5066 tf->hob_lbah = g->hob_lbah;
5067 tf->ctl = g->alt_status;
5068}
5069
5070/**
5071 * ipr_copy_sata_tf - Copy a SATA taskfile to an IOA data structure 5044 * ipr_copy_sata_tf - Copy a SATA taskfile to an IOA data structure
5072 * @regs: destination 5045 * @regs: destination
5073 * @tf: source ATA taskfile 5046 * @tf: source ATA taskfile
@@ -5245,6 +5218,35 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
5245} 5218}
5246 5219
5247/** 5220/**
5221 * ipr_qc_fill_rtf - Read result TF
5222 * @qc: ATA queued command
5223 *
5224 * Return value:
5225 * true
5226 **/
5227static bool ipr_qc_fill_rtf(struct ata_queued_cmd *qc)
5228{
5229 struct ipr_sata_port *sata_port = qc->ap->private_data;
5230 struct ipr_ioasa_gata *g = &sata_port->ioasa;
5231 struct ata_taskfile *tf = &qc->result_tf;
5232
5233 tf->feature = g->error;
5234 tf->nsect = g->nsect;
5235 tf->lbal = g->lbal;
5236 tf->lbam = g->lbam;
5237 tf->lbah = g->lbah;
5238 tf->device = g->device;
5239 tf->command = g->status;
5240 tf->hob_nsect = g->hob_nsect;
5241 tf->hob_lbal = g->hob_lbal;
5242 tf->hob_lbam = g->hob_lbam;
5243 tf->hob_lbah = g->hob_lbah;
5244 tf->ctl = g->alt_status;
5245
5246 return true;
5247}
5248
5249/**
5248 * ipr_ata_check_status - Return last ATA status 5250 * ipr_ata_check_status - Return last ATA status
5249 * @ap: ATA port 5251 * @ap: ATA port
5250 * 5252 *
@@ -5277,10 +5279,9 @@ static struct ata_port_operations ipr_sata_ops = {
5277 .phy_reset = ipr_ata_phy_reset, 5279 .phy_reset = ipr_ata_phy_reset,
5278 .hardreset = ipr_sata_reset, 5280 .hardreset = ipr_sata_reset,
5279 .post_internal_cmd = ipr_ata_post_internal, 5281 .post_internal_cmd = ipr_ata_post_internal,
5280 .sff_tf_read = ipr_tf_read,
5281 .qc_prep = ata_noop_qc_prep, 5282 .qc_prep = ata_noop_qc_prep,
5282 .qc_issue = ipr_qc_issue, 5283 .qc_issue = ipr_qc_issue,
5283 .qc_fill_rtf = ata_sff_qc_fill_rtf, 5284 .qc_fill_rtf = ipr_qc_fill_rtf,
5284 .port_start = ata_sas_port_start, 5285 .port_start = ata_sas_port_start,
5285 .port_stop = ata_sas_port_stop 5286 .port_stop = ata_sas_port_stop
5286}; 5287};
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 2ec255839dcd..e81f2fd8ba8b 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -225,6 +225,14 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
225 return 0; 225 return 0;
226} 226}
227 227
228static bool sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc)
229{
230 struct domain_device *dev = qc->ap->private_data;
231
232 memcpy(&qc->result_tf, &dev->sata_dev.tf, sizeof(qc->result_tf));
233 return true;
234}
235
228static u8 sas_ata_check_status(struct ata_port *ap) 236static u8 sas_ata_check_status(struct ata_port *ap)
229{ 237{
230 struct domain_device *dev = ap->private_data; 238 struct domain_device *dev = ap->private_data;
@@ -292,12 +300,6 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc)
292 } 300 }
293} 301}
294 302
295static void sas_ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
296{
297 struct domain_device *dev = ap->private_data;
298 memcpy(tf, &dev->sata_dev.tf, sizeof (*tf));
299}
300
301static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in, 303static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
302 u32 val) 304 u32 val)
303{ 305{
@@ -353,10 +355,9 @@ static struct ata_port_operations sas_sata_ops = {
353 .sff_dev_select = ata_noop_dev_select, 355 .sff_dev_select = ata_noop_dev_select,
354 .phy_reset = sas_ata_phy_reset, 356 .phy_reset = sas_ata_phy_reset,
355 .post_internal_cmd = sas_ata_post_internal, 357 .post_internal_cmd = sas_ata_post_internal,
356 .sff_tf_read = sas_ata_tf_read,
357 .qc_prep = ata_noop_qc_prep, 358 .qc_prep = ata_noop_qc_prep,
358 .qc_issue = sas_ata_qc_issue, 359 .qc_issue = sas_ata_qc_issue,
359 .qc_fill_rtf = ata_sff_qc_fill_rtf, 360 .qc_fill_rtf = sas_ata_qc_fill_rtf,
360 .port_start = ata_sas_port_start, 361 .port_start = ata_sas_port_start,
361 .port_stop = ata_sas_port_stop, 362 .port_stop = ata_sas_port_stop,
362 .scr_read = sas_ata_scr_read, 363 .scr_read = sas_ata_scr_read,