linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libata-2.6] AHCI: support for tf_read (RFC)
@ 2005-02-24 23:24 Brett Russ
  2005-02-24 23:33 ` Jeff Garzik
  2005-02-25 23:19 ` [PATCH] " Jeff Garzik
  0 siblings, 2 replies; 6+ messages in thread
From: Brett Russ @ 2005-02-24 23:24 UTC (permalink / raw)
  To: linux-ide; +Cc: ric

I coded this because ata_pass_thru_cc() (in the dev branch) and other
functions call tf_read() which is supported for most except ahci.
I've been unable to test because I'm leaving on vacation and am in a
last minute rush but wanted to get this out there for comments.

Signed-off-by: Brett Russ <russb@emc.com>

===== drivers/scsi/ahci.c 1.15 vs edited =====
--- 1.15/drivers/scsi/ahci.c	Wed Feb 23 14:47:04 2005
+++ edited/drivers/scsi/ahci.c	Thu Feb 24 18:18:59 2005
@@ -177,6 +177,7 @@
 static int ahci_port_start(struct ata_port *ap);
 static void ahci_port_stop(struct ata_port *ap);
 static void ahci_host_stop(struct ata_host_set *host_set);
+static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void ahci_qc_prep(struct ata_queued_cmd *qc);
 static u8 ahci_check_status(struct ata_port *ap);
 static u8 ahci_check_err(struct ata_port *ap);
@@ -222,6 +223,8 @@
 	.scr_read		= ahci_scr_read,
 	.scr_write		= ahci_scr_write,
 
+	.tf_read		= ahci_tf_read,
+
 	.port_start		= ahci_port_start,
 	.port_stop		= ahci_port_stop,
 	.host_stop		= ahci_host_stop,
@@ -483,6 +486,28 @@
 		pp->cmd_tbl_sg[i].addr_hi = cpu_to_le32((addr >> 16) >> 16);
 		pp->cmd_tbl_sg[i].flags_size = cpu_to_le32(sg_len - 1);
 	}
+}
+
+static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
+{
+	struct ahci_port_priv *pp = ap->private_data;
+	u32 *rx_fis_reg = pp->rx_fis + RX_FIS_D2H_REG;
+
+	tf->lbal = rx_fis_reg[1] & 0xff;
+	tf->hob_lbal = rx_fis_reg[2] & 0xff;
+
+	tf->lbam = (rx_fis_reg[1] >> 8) & 0xff;
+	tf->hob_lbam = (rx_fis_reg[2] >> 8) & 0xff;
+
+	tf->lbah = (rx_fis_reg[1] >> 16) & 0xff;
+	tf->hob_lbah = (rx_fis_reg[2] >> 16) & 0xff;
+
+	tf->nsect = rx_fis_reg[3] & 0xff;
+	tf->hob_nsect = (rx_fis_reg[3] >> 8) & 0xff;
+
+	tf->device = (rx_fis_reg[1] >> 24) & 0xff;
+
+	/* feature not filled b/c doesn't exist in D2H reg FIS */
 }
 
 static void ahci_qc_prep(struct ata_queued_cmd *qc)

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

* Re: [PATCH libata-2.6] AHCI: support for tf_read (RFC)
  2005-02-24 23:24 [PATCH libata-2.6] AHCI: support for tf_read (RFC) Brett Russ
@ 2005-02-24 23:33 ` Jeff Garzik
  2005-02-25 23:19 ` [PATCH] " Jeff Garzik
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2005-02-24 23:33 UTC (permalink / raw)
  To: Brett Russ; +Cc: linux-ide, ric

Brett Russ wrote:
> I coded this because ata_pass_thru_cc() (in the dev branch) and other
> functions call tf_read() which is supported for most except ahci.
> I've been unable to test because I'm leaving on vacation and am in a
> last minute rush but wanted to get this out there for comments.
> 
> Signed-off-by: Brett Russ <russb@emc.com>
> 
> ===== drivers/scsi/ahci.c 1.15 vs edited =====
> --- 1.15/drivers/scsi/ahci.c	Wed Feb 23 14:47:04 2005
> +++ edited/drivers/scsi/ahci.c	Thu Feb 24 18:18:59 2005
> @@ -177,6 +177,7 @@
>  static int ahci_port_start(struct ata_port *ap);
>  static void ahci_port_stop(struct ata_port *ap);
>  static void ahci_host_stop(struct ata_host_set *host_set);
> +static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
>  static void ahci_qc_prep(struct ata_queued_cmd *qc);
>  static u8 ahci_check_status(struct ata_port *ap);
>  static u8 ahci_check_err(struct ata_port *ap);
> @@ -222,6 +223,8 @@
>  	.scr_read		= ahci_scr_read,
>  	.scr_write		= ahci_scr_write,
>  
> +	.tf_read		= ahci_tf_read,
> +
>  	.port_start		= ahci_port_start,
>  	.port_stop		= ahci_port_stop,
>  	.host_stop		= ahci_host_stop,
> @@ -483,6 +486,28 @@
>  		pp->cmd_tbl_sg[i].addr_hi = cpu_to_le32((addr >> 16) >> 16);
>  		pp->cmd_tbl_sg[i].flags_size = cpu_to_le32(sg_len - 1);
>  	}
> +}
> +
> +static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
> +{
> +	struct ahci_port_priv *pp = ap->private_data;
> +	u32 *rx_fis_reg = pp->rx_fis + RX_FIS_D2H_REG;
> +
> +	tf->lbal = rx_fis_reg[1] & 0xff;
> +	tf->hob_lbal = rx_fis_reg[2] & 0xff;
> +
> +	tf->lbam = (rx_fis_reg[1] >> 8) & 0xff;
> +	tf->hob_lbam = (rx_fis_reg[2] >> 8) & 0xff;
> +
> +	tf->lbah = (rx_fis_reg[1] >> 16) & 0xff;
> +	tf->hob_lbah = (rx_fis_reg[2] >> 16) & 0xff;
> +
> +	tf->nsect = rx_fis_reg[3] & 0xff;
> +	tf->hob_nsect = (rx_fis_reg[3] >> 8) & 0xff;
> +
> +	tf->device = (rx_fis_reg[1] >> 24) & 0xff;
> +
> +	/* feature not filled b/c doesn't exist in D2H reg FIS */
>  }

Not bad...  But if you use ata_tf_from_fis(), your job is a lot easier ;-)

Otherwise OK.  We do indeed need to be able to get results from the D2H 
FIS, for various purposes (including better device error handling).

	Jeff




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

* [PATCH] Re: AHCI: support for tf_read (RFC)
  2005-02-24 23:24 [PATCH libata-2.6] AHCI: support for tf_read (RFC) Brett Russ
  2005-02-24 23:33 ` Jeff Garzik
@ 2005-02-25 23:19 ` Jeff Garzik
  2005-03-07 16:43   ` Brett Russ
  2005-03-10 16:50   ` Brett Russ
  1 sibling, 2 replies; 6+ messages in thread
From: Jeff Garzik @ 2005-02-25 23:19 UTC (permalink / raw)
  To: Brett Russ; +Cc: linux-ide, ric

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

Brett Russ wrote:
> I coded this because ata_pass_thru_cc() (in the dev branch) and other
> functions call tf_read() which is supported for most except ahci.
> I've been unable to test because I'm leaving on vacation and am in a
> last minute rush but wanted to get this out there for comments.
> 
> Signed-off-by: Brett Russ <russb@emc.com>

I checked the attached patch into a local repository, but haven't yet 
merged it into libata-dev-2.6, or tested it.

	Jeff



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1416 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/25 18:18:09-05:00 jgarzik@pobox.com 
#   [libata ahci] support ->tf_read hook
# 
# drivers/scsi/ahci.c
#   2005/02/25 18:18:03-05:00 jgarzik@pobox.com +11 -0
#   [libata ahci] support ->tf_read hook
# 
diff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
--- a/drivers/scsi/ahci.c	2005-02-25 18:18:23 -05:00
+++ b/drivers/scsi/ahci.c	2005-02-25 18:18:23 -05:00
@@ -177,6 +177,7 @@
 static int ahci_port_start(struct ata_port *ap);
 static void ahci_port_stop(struct ata_port *ap);
 static void ahci_host_stop(struct ata_host_set *host_set);
+static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void ahci_qc_prep(struct ata_queued_cmd *qc);
 static u8 ahci_check_status(struct ata_port *ap);
 static u8 ahci_check_err(struct ata_port *ap);
@@ -209,6 +210,8 @@
 	.check_err		= ahci_check_err,
 	.dev_select		= ata_noop_dev_select,
 
+	.tf_read		= ahci_tf_read,
+
 	.phy_reset		= ahci_phy_reset,
 
 	.qc_prep		= ahci_qc_prep,
@@ -460,6 +463,14 @@
 	void *mmio = (void *) ap->ioaddr.cmd_addr;
 
 	return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF;
+}
+
+static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
+{
+	struct ahci_port_priv *pp = ap->private_data;
+	u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
+
+	ata_tf_from_fis(d2h_fis, tf);
 }
 
 static void ahci_fill_sg(struct ata_queued_cmd *qc)

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

* Re: [PATCH] Re: AHCI: support for tf_read (RFC)
  2005-02-25 23:19 ` [PATCH] " Jeff Garzik
@ 2005-03-07 16:43   ` Brett Russ
  2005-03-10 16:50   ` Brett Russ
  1 sibling, 0 replies; 6+ messages in thread
From: Brett Russ @ 2005-03-07 16:43 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, ric

Jeff Garzik wrote:
> Brett Russ wrote:
> 
>> I coded this because ata_pass_thru_cc() (in the dev branch) and other
>> functions call tf_read() which is supported for most except ahci.
>> I've been unable to test because I'm leaving on vacation and am in a
>> last minute rush but wanted to get this out there for comments.
>>
>> Signed-off-by: Brett Russ <russb@emc.com>
> 
> 
> I checked the attached patch into a local repository, but haven't yet 
> merged it into libata-dev-2.6, or tested it.

The reason I didn't just use ata_tf_from_fis() was because I didn't 
think it was valid to overload tf->command with status and tf->feature 
with error.  It was commented as a host->device FIS translation, where 
those fields would line up with the properly named tf fields.

As long as the overload is fine then this is certainly simpler than my 
patch.

BR

<snip>

> +static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
> +{
> +	struct ahci_port_priv *pp = ap->private_data;
> +	u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
> +
> +	ata_tf_from_fis(d2h_fis, tf);
>  }
>  
>  static void ahci_fill_sg(struct ata_queued_cmd *qc)


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

* Re: [PATCH] Re: AHCI: support for tf_read (RFC)
  2005-02-25 23:19 ` [PATCH] " Jeff Garzik
  2005-03-07 16:43   ` Brett Russ
@ 2005-03-10 16:50   ` Brett Russ
  2005-03-10 18:32     ` Jeff Garzik
  1 sibling, 1 reply; 6+ messages in thread
From: Brett Russ @ 2005-03-10 16:50 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide, ric

Jeff Garzik wrote:
> I checked the attached patch into a local repository, but haven't yet 
> merged it into libata-dev-2.6, or tested it.

Jeff,

The below works for me in testing.  Can you push into libata-2.6?

Thanks,
BR

> ------------------------------------------------------------------------
> 
> # This is a BitKeeper generated diff -Nru style patch.
> #
> # ChangeSet
> #   2005/02/25 18:18:09-05:00 jgarzik@pobox.com 
> #   [libata ahci] support ->tf_read hook
> # 
> # drivers/scsi/ahci.c
> #   2005/02/25 18:18:03-05:00 jgarzik@pobox.com +11 -0
> #   [libata ahci] support ->tf_read hook
> # 
> diff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
> --- a/drivers/scsi/ahci.c	2005-02-25 18:18:23 -05:00
> +++ b/drivers/scsi/ahci.c	2005-02-25 18:18:23 -05:00
> @@ -177,6 +177,7 @@
>  static int ahci_port_start(struct ata_port *ap);
>  static void ahci_port_stop(struct ata_port *ap);
>  static void ahci_host_stop(struct ata_host_set *host_set);
> +static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
>  static void ahci_qc_prep(struct ata_queued_cmd *qc);
>  static u8 ahci_check_status(struct ata_port *ap);
>  static u8 ahci_check_err(struct ata_port *ap);
> @@ -209,6 +210,8 @@
>  	.check_err		= ahci_check_err,
>  	.dev_select		= ata_noop_dev_select,
>  
> +	.tf_read		= ahci_tf_read,
> +
>  	.phy_reset		= ahci_phy_reset,
>  
>  	.qc_prep		= ahci_qc_prep,
> @@ -460,6 +463,14 @@
>  	void *mmio = (void *) ap->ioaddr.cmd_addr;
>  
>  	return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF;
> +}
> +
> +static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
> +{
> +	struct ahci_port_priv *pp = ap->private_data;
> +	u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
> +
> +	ata_tf_from_fis(d2h_fis, tf);
>  }
>  
>  static void ahci_fill_sg(struct ata_queued_cmd *qc)


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

* Re: [PATCH] Re: AHCI: support for tf_read (RFC)
  2005-03-10 16:50   ` Brett Russ
@ 2005-03-10 18:32     ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2005-03-10 18:32 UTC (permalink / raw)
  To: Brett Russ; +Cc: linux-ide, ric

Brett Russ wrote:
> Jeff Garzik wrote:
> 
>> I checked the attached patch into a local repository, but haven't yet 
>> merged it into libata-dev-2.6, or tested it.
> 
> 
> Jeff,
> 
> The below works for me in testing.  Can you push into libata-2.6?

pulled



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

end of thread, other threads:[~2005-03-10 18:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-24 23:24 [PATCH libata-2.6] AHCI: support for tf_read (RFC) Brett Russ
2005-02-24 23:33 ` Jeff Garzik
2005-02-25 23:19 ` [PATCH] " Jeff Garzik
2005-03-07 16:43   ` Brett Russ
2005-03-10 16:50   ` Brett Russ
2005-03-10 18:32     ` Jeff Garzik

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).