All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Change frame type for SET MAX commands
@ 2017-12-28 10:20 chenxiang
  2017-12-28 10:20 ` [PATCH 1/2] ata: enhance the definition of SET MAX feature field value chenxiang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: chenxiang @ 2017-12-28 10:20 UTC (permalink / raw)
  To: martin.petersen, tj; +Cc: linux-ide, linux-scsi, linuxarm, chenxiang

According to ATA protocol, there are two other values for SET MAX commands' 
feature field. So definite them. Also those SET MAX commands belong to 
different frame types,and judge feature field of SET MAX commands to decide
which frame type they belongs to.

chenxiang (2):
  ata: enhance the definition of SET MAX feature field value
  scsi: hisi_sas: Change frame type for SET MAX commands

 drivers/scsi/hisi_sas/hisi_sas.h       |  3 ++-
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 20 ++++++++++++++++++--
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c |  2 +-
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |  2 +-
 include/linux/ata.h                    |  2 ++
 5 files changed, 24 insertions(+), 5 deletions(-)

-- 
1.9.1


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

* [PATCH 1/2] ata: enhance the definition of SET MAX feature field value
  2017-12-28 10:20 [PATCH 0/2] Change frame type for SET MAX commands chenxiang
@ 2017-12-28 10:20 ` chenxiang
  2018-01-09  3:16   ` Martin K. Petersen
  2017-12-28 10:20 ` [PATCH 2/2] scsi: hisi_sas: Change frame type for SET MAX commands chenxiang
  2018-01-09  3:47 ` [PATCH 0/2] " Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: chenxiang @ 2017-12-28 10:20 UTC (permalink / raw)
  To: martin.petersen, tj
  Cc: linux-ide, linux-scsi, linuxarm, chenxiang, John Garry

There are two other values for SET MAX feature field according to ata
protocol. So definite them.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 include/linux/ata.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/ata.h b/include/linux/ata.h
index c7a3538..40d150a 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -448,6 +448,8 @@ enum {
 	ATA_SET_MAX_LOCK	= 0x02,
 	ATA_SET_MAX_UNLOCK	= 0x03,
 	ATA_SET_MAX_FREEZE_LOCK	= 0x04,
+	ATA_SET_MAX_PASSWD_DMA	= 0x05,
+	ATA_SET_MAX_UNLOCK_DMA	= 0x06,
 
 	/* feature values for DEVICE CONFIGURATION OVERLAY */
 	ATA_DCO_RESTORE		= 0xC0,
-- 
1.9.1

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

* [PATCH 2/2] scsi: hisi_sas: Change frame type for SET MAX commands
  2017-12-28 10:20 [PATCH 0/2] Change frame type for SET MAX commands chenxiang
  2017-12-28 10:20 ` [PATCH 1/2] ata: enhance the definition of SET MAX feature field value chenxiang
@ 2017-12-28 10:20 ` chenxiang
  2018-01-09  3:47 ` [PATCH 0/2] " Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: chenxiang @ 2017-12-28 10:20 UTC (permalink / raw)
  To: martin.petersen, tj
  Cc: linux-ide, linux-scsi, linuxarm, chenxiang, John Garry

According to ATA protocol, SET MAX commands belong to different frame types.
So judge features field of SET MAX commands to decide which frame type they
belongs to.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas.h       |  3 ++-
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 20 ++++++++++++++++++--
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c |  2 +-
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |  2 +-
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index cc05029..4000de4 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -441,7 +441,8 @@ struct hisi_sas_slot_buf_table {
 extern void hisi_sas_init_add(struct hisi_hba *hisi_hba);
 extern int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost);
 extern void hisi_sas_free(struct hisi_hba *hisi_hba);
-extern u8 hisi_sas_get_ata_protocol(u8 cmd, int direction);
+extern u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis,
+				int direction);
 extern struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port);
 extern void hisi_sas_sata_done(struct sas_task *task,
 			    struct hisi_sas_slot *slot);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 04e1172b..6792c1a 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -25,9 +25,9 @@ static int hisi_sas_debug_issue_ssp_tmf(struct domain_device *device,
 static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func,
 				void *funcdata);
 
-u8 hisi_sas_get_ata_protocol(u8 cmd, int direction)
+u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis, int direction)
 {
-	switch (cmd) {
+	switch (fis->command) {
 	case ATA_CMD_FPDMA_WRITE:
 	case ATA_CMD_FPDMA_READ:
 	case ATA_CMD_FPDMA_RECV:
@@ -79,10 +79,26 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction)
 	case ATA_CMD_ZAC_MGMT_OUT:
 	return HISI_SAS_SATA_PROTOCOL_NONDATA;
 	default:
+	{
+		if (fis->command == ATA_CMD_SET_MAX) {
+			switch (fis->features) {
+			case ATA_SET_MAX_PASSWD:
+			case ATA_SET_MAX_LOCK:
+			return HISI_SAS_SATA_PROTOCOL_PIO;
+
+			case ATA_SET_MAX_PASSWD_DMA:
+			case ATA_SET_MAX_UNLOCK_DMA:
+			return HISI_SAS_SATA_PROTOCOL_DMA;
+
+			default:
+			return HISI_SAS_SATA_PROTOCOL_NONDATA;
+			}
+		}
 		if (direction == DMA_NONE)
 			return HISI_SAS_SATA_PROTOCOL_NONDATA;
 		return HISI_SAS_SATA_PROTOCOL_PIO;
 	}
+	}
 }
 EXPORT_SYMBOL_GPL(hisi_sas_get_ata_protocol);
 
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index b8fe08d..ebee2e4 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -2539,7 +2539,7 @@ static int prep_ata_v2_hw(struct hisi_hba *hisi_hba,
 		dw1 |= 1 << CMD_HDR_RESET_OFF;
 
 	dw1 |= (hisi_sas_get_ata_protocol(
-		task->ata_task.fis.command, task->data_dir))
+		&task->ata_task.fis, task->data_dir))
 		<< CMD_HDR_FRAME_TYPE_OFF;
 	dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF;
 	hdr->dw1 = cpu_to_le32(dw1);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 6a408d2..a1f1868 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -1047,7 +1047,7 @@ static int prep_ata_v3_hw(struct hisi_hba *hisi_hba,
 		dw1 |= 1 << CMD_HDR_RESET_OFF;
 
 	dw1 |= (hisi_sas_get_ata_protocol(
-		task->ata_task.fis.command, task->data_dir))
+		&task->ata_task.fis, task->data_dir))
 		<< CMD_HDR_FRAME_TYPE_OFF;
 	dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF;
 
-- 
1.9.1

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

* Re: [PATCH 1/2] ata: enhance the definition of SET MAX feature field value
  2017-12-28 10:20 ` [PATCH 1/2] ata: enhance the definition of SET MAX feature field value chenxiang
@ 2018-01-09  3:16   ` Martin K. Petersen
  2018-01-09  3:38     ` Tejun Heo
  0 siblings, 1 reply; 6+ messages in thread
From: Martin K. Petersen @ 2018-01-09  3:16 UTC (permalink / raw)
  To: tj
  Cc: martin.petersen, chenxiang, linux-ide, linux-scsi, linuxarm, John Garry


Tejun,

Are you OK with me pulling this change through the SCSI tree?

> There are two other values for SET MAX feature field according to ata
> protocol. So definite them.
>
> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
> Signed-off-by: John Garry <john.garry@huawei.com>
> ---
>  include/linux/ata.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/ata.h b/include/linux/ata.h
> index c7a3538..40d150a 100644
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -448,6 +448,8 @@ enum {
>  	ATA_SET_MAX_LOCK	= 0x02,
>  	ATA_SET_MAX_UNLOCK	= 0x03,
>  	ATA_SET_MAX_FREEZE_LOCK	= 0x04,
> +	ATA_SET_MAX_PASSWD_DMA	= 0x05,
> +	ATA_SET_MAX_UNLOCK_DMA	= 0x06,
>  
>  	/* feature values for DEVICE CONFIGURATION OVERLAY */
>  	ATA_DCO_RESTORE		= 0xC0,

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 1/2] ata: enhance the definition of SET MAX feature field value
  2018-01-09  3:16   ` Martin K. Petersen
@ 2018-01-09  3:38     ` Tejun Heo
  0 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2018-01-09  3:38 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: chenxiang, linux-ide, linux-scsi, linuxarm, John Garry

On Mon, Jan 08, 2018 at 10:16:55PM -0500, Martin K. Petersen wrote:
> 
> Tejun,
> 
> Are you OK with me pulling this change through the SCSI tree?

Sure, yeah, please go ahead.

Thanks.

-- 
tejun

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

* Re: [PATCH 0/2] Change frame type for SET MAX commands
  2017-12-28 10:20 [PATCH 0/2] Change frame type for SET MAX commands chenxiang
  2017-12-28 10:20 ` [PATCH 1/2] ata: enhance the definition of SET MAX feature field value chenxiang
  2017-12-28 10:20 ` [PATCH 2/2] scsi: hisi_sas: Change frame type for SET MAX commands chenxiang
@ 2018-01-09  3:47 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2018-01-09  3:47 UTC (permalink / raw)
  To: chenxiang; +Cc: martin.petersen, tj, linux-ide, linux-scsi, linuxarm


chenxiang,

> According to ATA protocol, there are two other values for SET MAX commands' 
> feature field. So definite them. Also those SET MAX commands belong to 
> different frame types,and judge feature field of SET MAX commands to decide
> which frame type they belongs to.

Applied to 4.16/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2018-01-09  3:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-28 10:20 [PATCH 0/2] Change frame type for SET MAX commands chenxiang
2017-12-28 10:20 ` [PATCH 1/2] ata: enhance the definition of SET MAX feature field value chenxiang
2018-01-09  3:16   ` Martin K. Petersen
2018-01-09  3:38     ` Tejun Heo
2017-12-28 10:20 ` [PATCH 2/2] scsi: hisi_sas: Change frame type for SET MAX commands chenxiang
2018-01-09  3:47 ` [PATCH 0/2] " Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.