35 static int asd_enqueue_internal(
struct asd_ascb *ascb,
38 void (*timed_out)(
unsigned long))
46 ascb->
timer.function = timed_out;
66 #define DECLARE_TCS(tcs) \
67 struct tasklet_completion_status tcs = { \
75 static void asd_clear_nexus_tasklet_complete(
struct asd_ascb *ascb,
81 ASD_DPRINTK(
"%s: couldn't delete timer\n", __func__);
90 static void asd_clear_nexus_timedout(
unsigned long data)
92 struct asd_ascb *ascb = (
void *)data;
100 #define CLEAR_NEXUS_PRE \
101 struct asd_ascb *ascb; \
104 DECLARE_COMPLETION_ONSTACK(completion); \
107 ASD_DPRINTK("%s: PRE\n", __func__); \
109 ascb = asd_ascb_alloc_list(asd_ha, &res, GFP_KERNEL); \
113 ascb->completion = &completion; \
114 ascb->uldd_task = &tcs; \
116 scb->header.opcode = CLEAR_NEXUS
118 #define CLEAR_NEXUS_POST \
119 ASD_DPRINTK("%s: POST\n", __func__); \
120 res = asd_enqueue_internal(ascb, asd_clear_nexus_tasklet_complete, \
121 asd_clear_nexus_timedout); \
124 ASD_DPRINTK("%s: clear nexus posted, waiting...\n", __func__); \
125 wait_for_completion(&completion); \
126 res = tcs.dl_opcode; \
127 if (res == TC_NO_ERROR) \
128 res = TMF_RESP_FUNC_COMPLETE; \
131 asd_ascb_free(ascb); \
193 reset_type ?
"hard" :
"soft", dev_name(&phy->
dev));
201 for (i = 0 ; i < 3; i++) {
212 "Failed to resume nexus after reset 0x%x\n", tmp_res);
216 sas_put_local_phy(phy);
242 if (task->
dev->tproto)
244 task->
dev->lldd_dev);
248 static int asd_clear_nexus_index(
struct sas_task *task)
255 if (task->
dev->tproto)
257 task->
dev->lldd_dev);
264 static void asd_tmf_timedout(
unsigned long data)
266 struct asd_ascb *ascb = (
void *) data;
274 static int asd_get_tmf_resp_tasklet(
struct asd_ascb *ascb,
279 struct tc_resp_sb_struct {
285 int edb_id = ((resp_sb->flags & 0x70) >> 4)-1;
288 struct ssp_frame_hdr *fh;
289 struct ssp_response_iu *ru;
295 escb = asd_tc_index_find(&asd_ha->
seq,
297 spin_unlock_irqrestore(&asd_ha->
seq.tc_index_lock, flags);
306 fh = edb->
vaddr + 16;
307 ru = edb->
vaddr + 16 +
sizeof(*fh);
309 if (ru->datapres == 1)
310 res = ru->resp_data[3];
320 static void asd_tmf_tasklet_complete(
struct asd_ascb *ascb,
334 tcs->
tmf_state = asd_get_tmf_resp_tasklet(ascb, dl);
343 static int asd_clear_nexus(
struct sas_task *task)
355 res = asd_clear_nexus_tag(task);
357 res = asd_clear_nexus_index(task);
359 AIC94XX_SCB_TIMEOUT);
424 ASD_DPRINTK(
"%s: task 0x%p done\n", __func__, task);
458 task->
dev->port->ha->hashed_sas_addr,
469 (
u16)(
unsigned long)task->
dev->lldd_dev);
474 res = asd_enqueue_internal(ascb, asd_tmf_tasklet_complete,
488 ASD_DPRINTK(
"%s: task 0x%p done\n", __func__, task);
497 res = asd_clear_nexus(task);
511 res = asd_clear_nexus(task);
526 AIC94XX_SCB_TIMEOUT);
549 asd_ascb_free(tascb);
551 ASD_DPRINTK(
"task 0x%p aborted, res: 0x%x\n", task, res);
556 ASD_DPRINTK(
"task 0x%p aborted, res: 0x%x\n", task, res);
601 scb->
ssp_tmf.proto_conn_rate = (1 << 4);
622 res = asd_enqueue_internal(ascb, asd_tmf_tasklet_complete,
662 asd_clear_nexus_I_T_L(dev, lun);
671 asd_clear_nexus_I_T_L(dev, lun);
680 asd_clear_nexus_I_T_L(dev, lun);
686 int res = asd_initiate_ssp_tmf(dev, lun,
TMF_LU_RESET, 0);
689 asd_clear_nexus_I_T_L(dev, lun);
710 return asd_initiate_ssp_tmf(task->
dev, task->
ssp_task.LUN,