Lines Matching defs:ccb

81 static void aac_cam_action(struct cam_sim *, union ccb *);
87 static u_int32_t aac_cam_reset_bus(struct cam_sim *, union ccb *);
88 static u_int32_t aac_cam_abort_ccb(struct cam_sim *, union ccb *);
89 static u_int32_t aac_cam_term_io(struct cam_sim *, union ccb *);
114 union ccb *ccb;
127 ccb = xpt_alloc_ccb_nowait();
128 if (ccb == NULL) {
130 "Cannot allocate ccb for bus rescan.\n");
134 if (xpt_create_path(&ccb->ccb_h.path, NULL,
137 xpt_free_ccb(ccb);
142 xpt_rescan(ccb);
150 union ccb *ccb;
155 ccb = arg;
156 camsc = ccb->ccb_h.sim_priv.entries[0].ptr;
159 ccb->ccb_h.status = CAM_REQUEUE_REQ;
160 xpt_done(ccb);
257 aac_cam_action(struct cam_sim *sim, union ccb *ccb)
271 switch(ccb->ccb_h.func_code) {
282 ccg = &ccb->ccg;
298 ccb->ccb_h.status = CAM_REQ_CMP;
299 xpt_done(ccb);
304 struct ccb_pathinq *cpi = &ccb->cpi;
329 ccb->ccb_h.status = CAM_REQ_CMP;
330 xpt_done(ccb);
336 &ccb->cts.proto_specific.scsi;
338 &ccb->cts.xport_specific.spi;
339 ccb->cts.protocol = PROTO_SCSI;
340 ccb->cts.protocol_version = SCSI_REV_2;
341 ccb->cts.transport = XPORT_SPI;
342 ccb->cts.transport_version = 2;
343 if (ccb->ccb_h.target_lun != CAM_LUN_WILDCARD) {
349 ccb->ccb_h.status = CAM_REQ_CMP;
350 xpt_done(ccb);
354 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
355 xpt_done(ccb);
359 ccb->ccb_h.status = aac_cam_reset_bus(sim, ccb);
361 ccb->ccb_h.status = CAM_REQ_CMP;
363 xpt_done(ccb);
366 ccb->ccb_h.status = aac_cam_abort_ccb(sim, ccb);
367 xpt_done(ccb);
370 ccb->ccb_h.status = aac_cam_term_io(sim, ccb);
371 xpt_done(ccb);
375 ccb->ccb_h.func_code);
376 ccb->ccb_h.status = CAM_PROVIDE_FAIL;
377 xpt_done(ccb);
387 ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
388 ccb->ccb_h.sim_priv.entries[0].ptr = camsc;
397 event->ev_arg = ccb;
407 switch (ccb->ccb_h.flags & CAM_DIR_MASK) {
425 switch(ccb->ccb_h.func_code) {
428 struct ccb_scsiio *csio = &ccb->csio;
437 if (ccb->ccb_h.flags & CAM_CDB_POINTER)
449 if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
450 switch ((ccb->ccb_h.flags & CAM_DATA_MASK)) {
488 ccb->ccb_h.status = CAM_REQ_CMP;
489 xpt_done(ccb);
497 srb->target = ccb->ccb_h.target_id;
498 srb->lun = ccb->ccb_h.target_lun;
499 srb->timeout = ccb->ccb_h.timeout; /* XXX */
503 cm->cm_private = ccb;
529 aac_cam_fix_inquiry(struct aac_softc *sc, union ccb *ccb)
536 if (ccb->ccb_h.flags & CAM_CDB_POINTER)
537 data = ccb->csio.cdb_io.cdb_ptr;
539 data = ccb->csio.cdb_io.cdb_bytes;
544 if (ccb->ccb_h.status == CAM_REQ_CMP) {
545 inq = (struct scsi_inquiry_data *)ccb->csio.data_ptr;
566 ccb->csio.data_ptr[0] = (qual << 5) | T_NODEVICE;
568 } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT &&
569 ccb->ccb_h.target_lun != 0) {
571 ccb->ccb_h.status = CAM_DEV_NOT_THERE;
578 union ccb *ccb;
585 ccb = cm->cm_private;
590 ccb->ccb_h.status = CAM_REQ_ABORTED;
596 ccb->ccb_h.status = srbr->srb_status;
599 if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
600 ccb->csio.scsi_status = srbr->scsi_status;
605 if (sense_returned < ccb->csio.sense_len)
606 ccb->csio.sense_resid =
607 ccb->csio.sense_len -
610 ccb->csio.sense_resid = 0;
611 bzero(&ccb->csio.sense_data,
613 bcopy(&srbr->sense[0], &ccb->csio.sense_data,
614 min(ccb->csio.sense_len, sense_returned));
615 ccb->ccb_h.status |= CAM_AUTOSNS_VALID;
616 // scsi_sense_print(&ccb->csio);
619 aac_cam_fix_inquiry(sc, ccb);
624 xpt_done(ccb);
628 aac_cam_reset_bus(struct cam_sim *sim, union ccb *ccb)
673 aac_cam_abort_ccb(struct cam_sim *sim, union ccb *ccb)
679 aac_cam_term_io(struct cam_sim *sim, union ccb *ccb)