Commit 27a3f229 authored by John Garry's avatar John Garry Committed by Martin K. Petersen

hisi_sas: Add cq interrupt handler

Add cq interrupt handler and also slot error handler function.
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 42e7a693
...@@ -93,6 +93,8 @@ struct hisi_sas_slot { ...@@ -93,6 +93,8 @@ struct hisi_sas_slot {
u64 n_elem; u64 n_elem;
int dlvry_queue; int dlvry_queue;
int dlvry_queue_slot; int dlvry_queue_slot;
int cmplt_queue;
int cmplt_queue_slot;
int idx; int idx;
void *cmd_hdr; void *cmd_hdr;
dma_addr_t cmd_hdr_dma; dma_addr_t cmd_hdr_dma;
...@@ -117,6 +119,10 @@ struct hisi_sas_hw { ...@@ -117,6 +119,10 @@ struct hisi_sas_hw {
int (*prep_ssp)(struct hisi_hba *hisi_hba, int (*prep_ssp)(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot, int is_tmf, struct hisi_sas_slot *slot, int is_tmf,
struct hisi_sas_tmf_task *tmf); struct hisi_sas_tmf_task *tmf);
int (*slot_complete)(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot, int abort);
void (*free_device)(struct hisi_hba *hisi_hba,
struct hisi_sas_device *dev);
int complete_hdr_size; int complete_hdr_size;
}; };
...@@ -311,4 +317,7 @@ extern int hisi_sas_probe(struct platform_device *pdev, ...@@ -311,4 +317,7 @@ 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);
extern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba,
struct sas_task *task,
struct hisi_sas_slot *slot);
#endif #endif
...@@ -60,6 +60,41 @@ static void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba) ...@@ -60,6 +60,41 @@ static void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba)
for (i = 0; i < hisi_hba->slot_index_count; ++i) for (i = 0; i < hisi_hba->slot_index_count; ++i)
hisi_sas_slot_index_clear(hisi_hba, i); hisi_sas_slot_index_clear(hisi_hba, i);
} }
void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
struct hisi_sas_slot *slot)
{
struct device *dev = &hisi_hba->pdev->dev;
if (!slot->task)
return;
if (!sas_protocol_ata(task->task_proto))
if (slot->n_elem)
dma_unmap_sg(dev, task->scatter, slot->n_elem,
task->data_dir);
if (slot->command_table)
dma_pool_free(hisi_hba->command_table_pool,
slot->command_table, slot->command_table_dma);
if (slot->status_buffer)
dma_pool_free(hisi_hba->status_buffer_pool,
slot->status_buffer, slot->status_buffer_dma);
if (slot->sge_page)
dma_pool_free(hisi_hba->sge_page_pool, slot->sge_page,
slot->sge_page_dma);
list_del_init(&slot->entry);
task->lldd_task = NULL;
slot->task = NULL;
slot->port = NULL;
hisi_sas_slot_index_free(hisi_hba, slot->idx);
memset(slot, 0, sizeof(*slot));
}
EXPORT_SYMBOL_GPL(hisi_sas_slot_task_free);
static int hisi_sas_task_prep_ssp(struct hisi_hba *hisi_hba, static int hisi_sas_task_prep_ssp(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot, int is_tmf, struct hisi_sas_slot *slot, int is_tmf,
struct hisi_sas_tmf_task *tmf) struct hisi_sas_tmf_task *tmf)
......
This diff is collapsed.
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