Lines Matching refs:cp
187 void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid) in sym_set_cam_result_error() argument
189 struct scsi_cmnd *cmd = cp->cmd; in sym_set_cam_result_error()
194 scsi_status = cp->ssss_status; in sym_set_cam_result_error()
196 if (cp->host_flags & HF_SENSE) { in sym_set_cam_result_error()
197 scsi_status = cp->sv_scsi_status; in sym_set_cam_result_error()
198 resid = cp->sv_resid; in sym_set_cam_result_error()
199 if (sym_verbose && cp->sv_xerr_status) in sym_set_cam_result_error()
200 sym_print_xerr(cmd, cp->sv_xerr_status); in sym_set_cam_result_error()
201 if (cp->host_status == HS_COMPLETE && in sym_set_cam_result_error()
202 cp->ssss_status == S_GOOD && in sym_set_cam_result_error()
203 cp->xerr_status == 0) { in sym_set_cam_result_error()
205 cp->sv_xerr_status); in sym_set_cam_result_error()
211 memcpy(cmd->sense_buffer, cp->sns_bbuf, in sym_set_cam_result_error()
224 cp->target,cp->lun, -1); in sym_set_cam_result_error()
237 } else if (cp->host_status == HS_COMPLETE) /* Bad SCSI status */ in sym_set_cam_result_error()
239 else if (cp->host_status == HS_SEL_TIMEOUT) /* Selection timeout */ in sym_set_cam_result_error()
241 else if (cp->host_status == HS_UNEXPECTED) /* Unexpected BUS FREE*/ in sym_set_cam_result_error()
246 cp->host_status, cp->ssss_status, in sym_set_cam_result_error()
247 cp->xerr_status); in sym_set_cam_result_error()
252 cam_status = sym_xerr_cam_status(DID_ERROR, cp->xerr_status); in sym_set_cam_result_error()
258 static int sym_scatter(struct sym_hcb *np, struct sym_ccb *cp, struct scsi_cmnd *cmd) in sym_scatter() argument
263 cp->data_len = 0; in sym_scatter()
268 struct sym_tcb *tp = &np->target[cp->target]; in sym_scatter()
276 data = &cp->phys.data[SYM_CONF_MAX_SG - use_sg]; in sym_scatter()
284 cp->odd_byte_adjustment++; in sym_scatter()
288 cp->data_len += len; in sym_scatter()
305 struct sym_ccb *cp; in sym_queue_command() local
322 cp = sym_get_ccb(np, cmd, order); in sym_queue_command()
323 if (!cp) in sym_queue_command()
325 sym_queue_scsiio(np, cmd, cp); in sym_queue_command()
332 static inline int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) in sym_setup_cdb() argument
334 memcpy(cp->cdb_buf, cmd->cmnd, cmd->cmd_len); in sym_setup_cdb()
336 cp->phys.cmd.addr = CCB_BA(cp, cdb_buf[0]); in sym_setup_cdb()
337 cp->phys.cmd.size = cpu_to_scr(cmd->cmd_len); in sym_setup_cdb()
345 int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) in sym_setup_data_and_start() argument
353 if (sym_setup_cdb(np, cmd, cp)) in sym_setup_data_and_start()
361 cp->segments = sym_scatter(np, cp, cmd); in sym_setup_data_and_start()
362 if (cp->segments < 0) { in sym_setup_data_and_start()
370 if (!cp->segments) in sym_setup_data_and_start()
373 cp->data_len = 0; in sym_setup_data_and_start()
374 cp->segments = 0; in sym_setup_data_and_start()
387 lastp = goalp - 8 - (cp->segments * (2*4)); in sym_setup_data_and_start()
390 cp->host_flags |= HF_DATA_IN; in sym_setup_data_and_start()
392 lastp = goalp - 8 - (cp->segments * (2*4)); in sym_setup_data_and_start()
403 cp->phys.head.lastp = cpu_to_scr(lastp); in sym_setup_data_and_start()
404 cp->phys.head.savep = cpu_to_scr(lastp); in sym_setup_data_and_start()
405 cp->startp = cp->phys.head.savep; in sym_setup_data_and_start()
406 cp->goalp = cpu_to_scr(goalp); in sym_setup_data_and_start()
415 switch (cp->cdb_buf[0]) { in sym_setup_data_and_start()
427 sym_put_start_queue(np, cp); in sym_setup_data_and_start()
431 sym_free_ccb(np, cp); in sym_setup_data_and_start()
638 struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); in sym_eh_handler() local
639 if (cp->cmd == cmd) { in sym_eh_handler()