mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]>
This commit is contained in:
parent
79f97dadfe
commit
4c9bf4e799
7 changed files with 66 additions and 65 deletions
|
|
@ -5040,33 +5040,6 @@ static void ipr_ata_post_internal(struct ata_queued_cmd *qc)
|
|||
spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* ipr_tf_read - Read the current ATA taskfile for the ATA port
|
||||
* @ap: ATA port
|
||||
* @tf: destination ATA taskfile
|
||||
*
|
||||
* Return value:
|
||||
* none
|
||||
**/
|
||||
static void ipr_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
|
||||
{
|
||||
struct ipr_sata_port *sata_port = ap->private_data;
|
||||
struct ipr_ioasa_gata *g = &sata_port->ioasa;
|
||||
|
||||
tf->feature = g->error;
|
||||
tf->nsect = g->nsect;
|
||||
tf->lbal = g->lbal;
|
||||
tf->lbam = g->lbam;
|
||||
tf->lbah = g->lbah;
|
||||
tf->device = g->device;
|
||||
tf->command = g->status;
|
||||
tf->hob_nsect = g->hob_nsect;
|
||||
tf->hob_lbal = g->hob_lbal;
|
||||
tf->hob_lbam = g->hob_lbam;
|
||||
tf->hob_lbah = g->hob_lbah;
|
||||
tf->ctl = g->alt_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipr_copy_sata_tf - Copy a SATA taskfile to an IOA data structure
|
||||
* @regs: destination
|
||||
|
|
@ -5244,6 +5217,35 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipr_qc_fill_rtf - Read result TF
|
||||
* @qc: ATA queued command
|
||||
*
|
||||
* Return value:
|
||||
* true
|
||||
**/
|
||||
static bool ipr_qc_fill_rtf(struct ata_queued_cmd *qc)
|
||||
{
|
||||
struct ipr_sata_port *sata_port = qc->ap->private_data;
|
||||
struct ipr_ioasa_gata *g = &sata_port->ioasa;
|
||||
struct ata_taskfile *tf = &qc->result_tf;
|
||||
|
||||
tf->feature = g->error;
|
||||
tf->nsect = g->nsect;
|
||||
tf->lbal = g->lbal;
|
||||
tf->lbam = g->lbam;
|
||||
tf->lbah = g->lbah;
|
||||
tf->device = g->device;
|
||||
tf->command = g->status;
|
||||
tf->hob_nsect = g->hob_nsect;
|
||||
tf->hob_lbal = g->hob_lbal;
|
||||
tf->hob_lbam = g->hob_lbam;
|
||||
tf->hob_lbah = g->hob_lbah;
|
||||
tf->ctl = g->alt_status;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipr_ata_check_status - Return last ATA status
|
||||
* @ap: ATA port
|
||||
|
|
@ -5277,10 +5279,9 @@ static struct ata_port_operations ipr_sata_ops = {
|
|||
.phy_reset = ipr_ata_phy_reset,
|
||||
.hardreset = ipr_sata_reset,
|
||||
.post_internal_cmd = ipr_ata_post_internal,
|
||||
.sff_tf_read = ipr_tf_read,
|
||||
.qc_prep = ata_noop_qc_prep,
|
||||
.qc_issue = ipr_qc_issue,
|
||||
.qc_fill_rtf = ata_sff_qc_fill_rtf,
|
||||
.qc_fill_rtf = ipr_qc_fill_rtf,
|
||||
.port_start = ata_sas_port_start,
|
||||
.port_stop = ata_sas_port_stop
|
||||
};
|
||||
|
|
|
|||
|
|
@ -225,6 +225,14 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc)
|
||||
{
|
||||
struct domain_device *dev = qc->ap->private_data;
|
||||
|
||||
memcpy(&qc->result_tf, &dev->sata_dev.tf, sizeof(qc->result_tf));
|
||||
return true;
|
||||
}
|
||||
|
||||
static u8 sas_ata_check_status(struct ata_port *ap)
|
||||
{
|
||||
struct domain_device *dev = ap->private_data;
|
||||
|
|
@ -292,12 +300,6 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc)
|
|||
}
|
||||
}
|
||||
|
||||
static void sas_ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
|
||||
{
|
||||
struct domain_device *dev = ap->private_data;
|
||||
memcpy(tf, &dev->sata_dev.tf, sizeof (*tf));
|
||||
}
|
||||
|
||||
static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
|
||||
u32 val)
|
||||
{
|
||||
|
|
@ -353,10 +355,9 @@ static struct ata_port_operations sas_sata_ops = {
|
|||
.sff_dev_select = ata_noop_dev_select,
|
||||
.phy_reset = sas_ata_phy_reset,
|
||||
.post_internal_cmd = sas_ata_post_internal,
|
||||
.sff_tf_read = sas_ata_tf_read,
|
||||
.qc_prep = ata_noop_qc_prep,
|
||||
.qc_issue = sas_ata_qc_issue,
|
||||
.qc_fill_rtf = ata_sff_qc_fill_rtf,
|
||||
.qc_fill_rtf = sas_ata_qc_fill_rtf,
|
||||
.port_start = ata_sas_port_start,
|
||||
.port_stop = ata_sas_port_stop,
|
||||
.scr_read = sas_ata_scr_read,
|
||||
|
|
|
|||
Loading…
Reference in a new issue