Commit 468f4b8d authored by chenxiang's avatar chenxiang Committed by Martin K. Petersen

scsi: hisi_sas: Change frame type for SET MAX commands

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: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d5c15c2c
...@@ -441,7 +441,8 @@ extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba); ...@@ -441,7 +441,8 @@ extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba);
extern void hisi_sas_init_add(struct hisi_hba *hisi_hba); 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 int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost);
extern void hisi_sas_free(struct hisi_hba *hisi_hba); 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 struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port);
extern void hisi_sas_sata_done(struct sas_task *task, extern void hisi_sas_sata_done(struct sas_task *task,
struct hisi_sas_slot *slot); struct hisi_sas_slot *slot);
......
...@@ -25,9 +25,9 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device); ...@@ -25,9 +25,9 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device);
static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func, static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func,
void *funcdata); 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_WRITE:
case ATA_CMD_FPDMA_READ: case ATA_CMD_FPDMA_READ:
case ATA_CMD_FPDMA_RECV: case ATA_CMD_FPDMA_RECV:
...@@ -79,10 +79,26 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction) ...@@ -79,10 +79,26 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction)
case ATA_CMD_ZAC_MGMT_OUT: case ATA_CMD_ZAC_MGMT_OUT:
return HISI_SAS_SATA_PROTOCOL_NONDATA; return HISI_SAS_SATA_PROTOCOL_NONDATA;
default: 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) if (direction == DMA_NONE)
return HISI_SAS_SATA_PROTOCOL_NONDATA; return HISI_SAS_SATA_PROTOCOL_NONDATA;
return HISI_SAS_SATA_PROTOCOL_PIO; return HISI_SAS_SATA_PROTOCOL_PIO;
} }
}
} }
EXPORT_SYMBOL_GPL(hisi_sas_get_ata_protocol); EXPORT_SYMBOL_GPL(hisi_sas_get_ata_protocol);
......
...@@ -2539,7 +2539,7 @@ static int prep_ata_v2_hw(struct hisi_hba *hisi_hba, ...@@ -2539,7 +2539,7 @@ static int prep_ata_v2_hw(struct hisi_hba *hisi_hba,
dw1 |= 1 << CMD_HDR_RESET_OFF; dw1 |= 1 << CMD_HDR_RESET_OFF;
dw1 |= (hisi_sas_get_ata_protocol( 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; << CMD_HDR_FRAME_TYPE_OFF;
dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF; dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF;
hdr->dw1 = cpu_to_le32(dw1); hdr->dw1 = cpu_to_le32(dw1);
......
...@@ -1047,7 +1047,7 @@ static int prep_ata_v3_hw(struct hisi_hba *hisi_hba, ...@@ -1047,7 +1047,7 @@ static int prep_ata_v3_hw(struct hisi_hba *hisi_hba,
dw1 |= 1 << CMD_HDR_RESET_OFF; dw1 |= 1 << CMD_HDR_RESET_OFF;
dw1 |= (hisi_sas_get_ata_protocol( 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; << CMD_HDR_FRAME_TYPE_OFF;
dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF; dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment