Commit 75904077 authored by Xiang Chen's avatar Xiang Chen Committed by Martin K. Petersen

scsi: hisi_sas: relocate sata_done_v2_hw()

Relocate get_ata_protocol() to a common location, as future hw versions
will require it.  Also rename with "hisi_sas_" prefix for consistency.
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 6c7bb8a1
...@@ -364,6 +364,8 @@ union hisi_sas_command_table { ...@@ -364,6 +364,8 @@ union hisi_sas_command_table {
extern u8 hisi_sas_get_ata_protocol(u8 cmd, int direction); extern u8 hisi_sas_get_ata_protocol(u8 cmd, 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,
struct hisi_sas_slot *slot);
extern int hisi_sas_probe(struct platform_device *pdev, extern int hisi_sas_probe(struct platform_device *pdev,
const struct hisi_sas_hw *ops); const struct hisi_sas_hw *ops);
extern int hisi_sas_remove(struct platform_device *pdev); extern int hisi_sas_remove(struct platform_device *pdev);
......
...@@ -82,6 +82,21 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction) ...@@ -82,6 +82,21 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction)
} }
EXPORT_SYMBOL_GPL(hisi_sas_get_ata_protocol); EXPORT_SYMBOL_GPL(hisi_sas_get_ata_protocol);
void hisi_sas_sata_done(struct sas_task *task,
struct hisi_sas_slot *slot)
{
struct task_status_struct *ts = &task->task_status;
struct ata_task_resp *resp = (struct ata_task_resp *)ts->buf;
struct dev_to_host_fis *d2h = slot->status_buffer +
sizeof(struct hisi_sas_err_record);
resp->frame_len = sizeof(struct dev_to_host_fis);
memcpy(&resp->ending_fis[0], d2h, sizeof(struct dev_to_host_fis));
ts->buf_valid_size = sizeof(*resp);
}
EXPORT_SYMBOL_GPL(hisi_sas_sata_done);
static struct hisi_hba *dev_to_hisi_hba(struct domain_device *device) static struct hisi_hba *dev_to_hisi_hba(struct domain_device *device)
{ {
return device->port->ha->lldd_ha; return device->port->ha->lldd_ha;
......
...@@ -1683,20 +1683,6 @@ static int prep_ssp_v2_hw(struct hisi_hba *hisi_hba, ...@@ -1683,20 +1683,6 @@ static int prep_ssp_v2_hw(struct hisi_hba *hisi_hba,
return 0; return 0;
} }
static void sata_done_v2_hw(struct hisi_hba *hisi_hba, struct sas_task *task,
struct hisi_sas_slot *slot)
{
struct task_status_struct *ts = &task->task_status;
struct ata_task_resp *resp = (struct ata_task_resp *)ts->buf;
struct dev_to_host_fis *d2h = slot->status_buffer +
sizeof(struct hisi_sas_err_record);
resp->frame_len = sizeof(struct dev_to_host_fis);
memcpy(&resp->ending_fis[0], d2h, sizeof(struct dev_to_host_fis));
ts->buf_valid_size = sizeof(*resp);
}
#define TRANS_TX_ERR 0 #define TRANS_TX_ERR 0
#define TRANS_RX_ERR 1 #define TRANS_RX_ERR 1
#define DMA_TX_ERR 2 #define DMA_TX_ERR 2
...@@ -2189,7 +2175,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, ...@@ -2189,7 +2175,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,
break; break;
} }
} }
sata_done_v2_hw(hisi_hba, task, slot); hisi_sas_sata_done(task, slot);
} }
break; break;
default: default:
...@@ -2317,7 +2303,7 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) ...@@ -2317,7 +2303,7 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot)
case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
{ {
ts->stat = SAM_STAT_GOOD; ts->stat = SAM_STAT_GOOD;
sata_done_v2_hw(hisi_hba, task, slot); hisi_sas_sata_done(task, slot);
break; break;
} }
default: default:
......
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