Lines Matching defs:ccb
400 union ccb *ccb;
404 ccb = cam_getccb(device);
406 ccb->ccb_h.func_code = XPT_GDEVLIST;
407 ccb->ccb_h.flags = CAM_DIR_NONE;
408 ccb->ccb_h.retry_count = 1;
409 ccb->cgdl.index = 0;
410 ccb->cgdl.status = CAM_GDEVLIST_MORE_DEVS;
411 while (ccb->cgdl.status == CAM_GDEVLIST_MORE_DEVS) {
412 if (cam_send_ccb(device, ccb) < 0) {
414 cam_freeccb(ccb);
420 switch (ccb->cgdl.status) {
437 ccb->cgdl.periph_name,
438 ccb->cgdl.unit_number,
439 ccb->cgdl.generation,
440 ccb->cgdl.index,
447 if (ccb->cgdl.status == CAM_GDEVLIST_LIST_CHANGED)
448 ccb->cgdl.index = 0;
451 cam_freeccb(ccb);
459 union ccb ccb;
484 bzero(&ccb, sizeof(union ccb));
486 ccb.ccb_h.path_id = CAM_XPT_PATH_ID;
487 ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
488 ccb.ccb_h.target_lun = CAM_LUN_WILDCARD;
490 ccb.ccb_h.func_code = XPT_DEV_MATCH;
492 ccb.cdm.match_buf_len = bufsize;
493 ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);
494 if (ccb.cdm.matches == NULL) {
499 ccb.cdm.num_matches = 0;
505 ccb.cdm.num_patterns = 0;
506 ccb.cdm.pattern_buf_len = 0;
513 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
519 if ((ccb.ccb_h.status != CAM_REQ_CMP)
520 || ((ccb.cdm.status != CAM_DEV_MATCH_LAST)
521 && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) {
523 ccb.ccb_h.status, ccb.cdm.status);
528 for (i = 0; i < ccb.cdm.num_matches; i++) {
529 switch (ccb.cdm.matches[i].type) {
542 &ccb.cdm.matches[i].result.bus_result;
565 &ccb.cdm.matches[i].result.device_result;
629 &ccb.cdm.matches[i].result.periph_result;
650 } while ((ccb.ccb_h.status == CAM_REQ_CMP)
651 && (ccb.cdm.status == CAM_DEV_MATCH_MORE));
656 free(ccb.cdm.matches);
733 union ccb *ccb;
745 ccb = cam_getccb(dev);
746 if (ccb == NULL) {
752 advi = &ccb->cdai;
760 if (cam_send_ccb(dev, ccb) < 0) {
762 cam_freeccb(ccb);
775 cam_freeccb(ccb);
783 union ccb *ccb;
786 ccb = cam_getccb(dev);
787 if (ccb == NULL) {
793 advi = &ccb->cdai;
801 if (cam_send_ccb(dev, ccb) < 0) {
803 cam_freeccb(ccb);
809 cam_freeccb(ccb);
813 cam_freeccb(ccb);
850 union ccb *ccb = NULL;
867 ccb = cam_getccb(device);
868 if (ccb == NULL) {
874 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
878 scsi_request_sense(&ccb->csio,
890 cdb = (struct scsi_request_sense *)&ccb->csio.cdb_io.cdb_bytes;
894 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
897 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
899 if (cam_send_ccb(device, ccb) < 0) {
901 cam_freeccb(ccb);
912 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
914 cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
919 returned_bytes = ccb->csio.dxfer_len - ccb->csio.resid;
936 &device->inq_data, scsiio_cdb_ptr(&ccb->csio),
937 ccb->csio.cdb_len);
944 if (ccb != NULL)
945 cam_freeccb(ccb);
955 union ccb *ccb;
957 ccb = cam_getccb(device);
959 scsi_test_unit_ready(&ccb->csio,
967 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
970 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
972 if (cam_send_ccb(device, ccb) < 0) {
975 cam_freeccb(ccb);
979 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
988 cam_error_print(device, ccb, CAM_ESF_ALL,
993 cam_freeccb(ccb);
1002 union ccb *ccb;
1005 ccb = cam_getccb(device);
1020 scsi_start_stop(&ccb->csio,
1031 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
1034 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
1036 if (cam_send_ccb(device, ccb) < 0) {
1038 cam_freeccb(ccb);
1042 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
1066 cam_error_print(device, ccb, CAM_ESF_ALL,
1071 cam_freeccb(ccb);
1125 union ccb *ccb;
1129 ccb = cam_getccb(device);
1131 if (ccb == NULL) {
1140 cam_freeccb(ccb);
1179 scsi_inquiry(&ccb->csio,
1191 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
1194 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
1196 if (cam_send_ccb(device, ccb) < 0) {
1198 cam_freeccb(ccb);
1202 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
1206 cam_error_print(device, ccb, CAM_ESF_ALL,
1211 cam_freeccb(ccb);
1231 union ccb *ccb;
1236 ccb = cam_getccb(device);
1238 if (ccb == NULL) {
1247 cam_freeccb(ccb);
1252 scsi_inquiry(&ccb->csio,
1264 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
1267 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
1269 if (cam_send_ccb(device, ccb) < 0) {
1271 cam_freeccb(ccb);
1276 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
1280 cam_error_print(device, ccb, CAM_ESF_ALL,
1285 cam_freeccb(ccb);
1313 union ccb *ccb;
1320 ccb = cam_getccb(device);
1322 if (ccb == NULL) {
1327 ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
1328 ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS;
1330 if (((retval = cam_send_ccb(device, ccb)) < 0)
1331 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
1340 cam_error_print(device, ccb, CAM_ESF_ALL,
1351 if (ccb->cts.transport == XPORT_SPI) {
1353 &ccb->cts.xport_specific.spi;
1362 } else if (ccb->cts.transport == XPORT_FC) {
1364 &ccb->cts.xport_specific.fc;
1368 } else if (ccb->cts.transport == XPORT_SAS) {
1370 &ccb->cts.xport_specific.sas;
1374 } else if (ccb->cts.transport == XPORT_ATA) {
1376 &ccb->cts.xport_specific.ata;
1380 } else if (ccb->cts.transport == XPORT_SATA) {
1382 &ccb->cts.xport_specific.sata;
1399 if (ccb->cts.transport == XPORT_SPI) {
1401 &ccb->cts.xport_specific.spi;
1421 } else if (ccb->cts.transport == XPORT_ATA) {
1423 &ccb->cts.xport_specific.ata;
1433 } else if (ccb->cts.transport == XPORT_SATA) {
1435 &ccb->cts.xport_specific.sata;
1451 if (ccb->cts.protocol == PROTO_SCSI) {
1453 &ccb->cts.proto_specific.scsi;
1465 cam_freeccb(ccb);
1834 scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb)
1839 ata_pass_16 = (struct ata_pass_16 *)ccb->csio.cdb_io.cdb_bytes;
1847 ccb->csio.ccb_h.timeout);
1851 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
1854 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
1856 if (cam_send_ccb(device, ccb) < 0) {
1866 (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
1869 cam_error_print(device, ccb, CAM_ESF_ALL,
1880 ata_cam_send(struct cam_device *device, union ccb *ccb)
1884 ata_op_string(&(ccb->ataio.cmd)),
1885 ccb->ataio.ccb_h.timeout);
1889 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
1892 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
1894 if (cam_send_ccb(device, ccb) < 0) {
1895 warn("error sending ATA %s", ata_op_string(&(ccb->ataio.cmd)));
1903 if (!(ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT) &&
1904 (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
1905 warnx("ATA %s failed", ata_op_string(&(ccb->ataio.cmd)));
1907 cam_error_print(device, ccb, CAM_ESF_ALL,
1917 ata_do_pass_16(struct cam_device *device, union ccb *ccb, int retries,
1932 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
1934 scsi_ata_pass_16(&ccb->csio,
1951 return scsi_cam_pass_16_send(device, ccb);
1974 ata_do_cmd(struct cam_device *device, union ccb *ccb, int retries,
1987 return (ata_do_pass_16(device, ccb, retries, flags, protocol,
1993 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio);
1994 cam_fill_ataio(&ccb->ataio,
2004 ata_48bit_cmd(&ccb->ataio, command, features, lba, sector_count);
2006 ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count);
2009 ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT;
2011 return ata_cam_send(device, ccb);
2031 atahpa_proc_resp(struct cam_device *device, union ccb *ccb, u_int64_t *hpasize)
2038 retval = get_ata_status(device, ccb, &error, &count, &lba, &ata_device,
2042 cam_error_print(device, ccb, CAM_ESF_ALL,
2051 cam_error_print(device, ccb, CAM_ESF_ALL,
2075 uint32_t timeout, union ccb *ccb,
2093 ccb,
2111 return atahpa_proc_resp(device, ccb, hpasize);
2116 uint32_t timeout, union ccb *ccb,
2137 ccb,
2155 return atahpa_proc_resp(device, ccb, NULL);
2160 uint32_t timeout, union ccb *ccb,
2170 ccb,
2189 uint32_t timeout, union ccb *ccb, int is48bit)
2198 ccb,
2216 uint32_t timeout, union ccb *ccb,
2226 ccb,
2245 uint32_t timeout, union ccb *ccb, int is48bit)
2254 ccb,
2272 uint32_t timeout, union ccb *ccb,
2278 ccb,
2296 return atahpa_proc_resp(device, ccb, nativesize);
2301 uint32_t timeout, union ccb *ccb, u_int64_t maxsize)
2310 ccb,
2328 return atahpa_proc_resp(device, ccb, NULL);
2333 uint32_t timeout, union ccb *ccb)
2337 ccb,
2355 union ccb *ccb, struct ata_params** ident_bufp)
2393 ccb,
2444 union ccb *ccb;
2448 if ((ccb = cam_getccb(device)) == NULL) {
2453 if (ata_do_identify(device, retry_count, timeout, ccb, &ident_buf) != 0) {
2454 cam_freeccb(ccb);
2465 ata_read_native_max(device, retry_count, timeout, ccb,
2469 ata_get_native_max(device, retry_count, timeout, ccb,
2481 cam_freeccb(ccb);
2580 atasecurity_freeze(struct cam_device *device, union ccb *ccb,
2588 ccb,
2605 atasecurity_unlock(struct cam_device *device, union ccb *ccb,
2614 ccb,
2632 atasecurity_disable(struct cam_device *device, union ccb *ccb,
2640 ccb,
2690 atasecurity_erase(struct cam_device *device, union ccb *ccb,
2701 ccb,
2723 ccb,
2746 atasecurity_set_password(struct cam_device *device, union ccb *ccb,
2755 ccb,
2886 union ccb *ccb;
2967 ccb = cam_getccb(device);
2968 if (ccb == NULL) {
2973 error = ata_do_identify(device, retry_count, timeout, ccb, &ident_buf);
2975 cam_freeccb(ccb);
2988 ata_read_native_max(device, retry_count, timeout, ccb,
2992 cam_freeccb(ccb);
2999 cam_freeccb(ccb);
3006 cam_freeccb(ccb);
3023 cam_freeccb(ccb);
3029 ccb, ident_buf, &hpasize);
3032 ccb, is48bit, maxsize, persist);
3037 retry_count, timeout, ccb,
3049 ccb, is48bit, &pwd);
3056 ccb, is48bit);
3063 ccb, is48bit, &pwd);
3070 ccb, is48bit);
3079 cam_freeccb(ccb);
3095 union ccb *ccb;
3137 ccb = cam_getccb(device);
3138 if (ccb == NULL) {
3143 error = ata_do_identify(device, retry_count, timeout, ccb, &ident_buf);
3145 cam_freeccb(ccb);
3158 ata_get_native_max(device, retry_count, timeout, ccb,
3162 cam_freeccb(ccb);
3169 cam_freeccb(ccb);
3176 error = ata_get_native_max(device, retry_count, timeout, ccb,
3180 ccb, maxsize);
3185 retry_count, timeout, ccb,
3197 ccb);
3206 cam_freeccb(ccb);
3216 union ccb *ccb;
3332 if ((ccb = cam_getccb(device)) == NULL) {
3337 error = ata_do_identify(device, retry_count, timeout, ccb, &ident_buf);
3339 cam_freeccb(ccb);
3352 cam_freeccb(ccb);
3359 cam_freeccb(ccb);
3375 cam_freeccb(ccb);
3387 error = atasecurity_set_password(device, ccb, retry_count,
3390 cam_freeccb(ccb);
3399 error = atasecurity_freeze(device, ccb, retry_count,
3406 error = atasecurity_unlock(device, ccb,
3422 error = atasecurity_unlock(device, ccb,
3431 ccb,
3450 error = atasecurity_erase(device, ccb, retry_count,
3467 error = atasecurity_erase(device, ccb,
3483 cam_freeccb(ccb);
3499 union ccb ccb;
3501 bzero(&ccb, sizeof(ccb));
3502 ccb.ccb_h.func_code = XPT_GDEVLIST;
3503 if (cam_get_device(tstr, ccb.cgdl.periph_name,
3504 sizeof(ccb.cgdl.periph_name), &ccb.cgdl.unit_number) == -1) {
3518 if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
3520 ccb.cgdl.periph_name, ccb.cgdl.unit_number);
3525 if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
3528 entry = cam_fetch_status_entry(ccb.ccb_h.status);
3531 ccb.cgdl.periph_name, ccb.cgdl.unit_number,
3533 ccb.ccb_h.status);
3542 *bus = ccb.ccb_h.path_id;
3543 *target = ccb.ccb_h.target_id;
3544 *lun = ccb.ccb_h.target_lun;
3648 union ccb *ccb = NULL, *matchccb = NULL;
3660 ccb = malloc(sizeof(*ccb));
3661 if (ccb == NULL) {
3666 bzero(ccb, sizeof(*ccb));
3669 ccb->ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS;
3670 ccb->ccb_h.path_id = bus;
3671 ccb->ccb_h.target_id = CAM_TARGET_WILDCARD;
3672 ccb->ccb_h.target_lun = CAM_LUN_WILDCARD;
3673 ccb->crcn.flags = CAM_FLAG_NONE;
3676 ccb->ccb_h.pinfo.priority = 5;
3678 if (ioctl(fd, CAMIOCOMMAND, ccb) == -1) {
3684 if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
3690 ccb->ccb_h.status & CAM_STATUS_MASK);
3774 ccb->ccb_h.func_code = rescan ? XPT_SCAN_BUS :
3776 ccb->ccb_h.path_id = bus_result->path_id;
3777 ccb->ccb_h.target_id = CAM_TARGET_WILDCARD;
3778 ccb->ccb_h.target_lun = CAM_LUN_WILDCARD;
3779 ccb->crcn.flags = CAM_FLAG_NONE;
3782 ccb->ccb_h.pinfo.priority = 5;
3784 if (ioctl(fd, CAMIOCOMMAND, ccb) == -1) {
3790 if ((ccb->ccb_h.status & CAM_STATUS_MASK)==CAM_REQ_CMP){
3803 ccb->ccb_h.status & CAM_STATUS_MASK);
3820 free(ccb);
3828 union ccb ccb;
3851 bzero(&ccb, sizeof(union ccb));
3868 ccb.ccb_h.func_code = (scan)? XPT_SCAN_LUN : XPT_RESET_DEV;
3869 ccb.ccb_h.path_id = bus;
3870 ccb.ccb_h.target_id = target;
3871 ccb.ccb_h.target_lun = lun;
3872 ccb.ccb_h.timeout = 5000;
3873 ccb.crcn.flags = CAM_FLAG_NONE;
3876 ccb.ccb_h.pinfo.priority = 5;
3879 if (ioctl(fd, CAMIOCOMMAND, &ccb) < 0) {
3885 if (cam_send_ccb(device, &ccb) < 0) {
3900 if (((ccb.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
3902 && ((ccb.ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))) {
3909 ccb.ccb_h.status & CAM_STATUS_MASK);
3928 union ccb *ccb = NULL;
4023 ccb = cam_getccb(device);
4060 * payload portion of the ccb.
4062 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
4064 scsi_read_defects(&ccb->csio,
4077 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
4079 if (cam_send_ccb(device, ccb) < 0) {
4085 valid_len = ccb->csio.dxfer_len - ccb->csio.resid;
4144 if ((ccb->ccb_h.status & CAM_STATUS_MASK) ==
4149 sense = &ccb->csio.sense_data;
4150 scsi_extract_sense_len(sense, ccb->csio.sense_len -
4151 ccb->csio.sense_resid, &error_code, &sense_key,
4215 } else if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
4220 cam_error_print(device, ccb, CAM_ESF_ALL,
4257 if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR)
4258 && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND)
4259 && ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0)) {
4263 sense = &ccb->csio.sense_data;
4264 scsi_extract_sense_len(sense, ccb->csio.sense_len -
4265 ccb->csio.sense_resid, &error_code, &sense_key, &asc,
4303 cam_error_print(device, ccb, CAM_ESF_ALL,
4307 } else if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
4311 cam_error_print(device, ccb, CAM_ESF_ALL,
4467 if (ccb != NULL)
4468 cam_freeccb(ccb);
4477 union ccb *ccb;
4479 ccb = cam_getccb(device);
4481 cam_freeccb(ccb);
4490 union ccb *ccb;
4493 ccb = cam_getccb(device);
4494 if (ccb == NULL)
4505 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
4507 scsi_mode_sense_subpage(&ccb->csio,
4520 if (llbaa && ccb->csio.cdb_len == 10) {
4522 (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes;
4527 *cdb_len = ccb->csio.cdb_len;
4530 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
4533 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
4535 if (cam_send_ccb(device, ccb) < 0)
4540 ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID ||
4541 (scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq)
4547 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
4549 cam_error_print(device, ccb, CAM_ESF_ALL,
4552 cam_freeccb(ccb);
4557 cam_freeccb(ccb);
4564 union ccb *ccb;
4567 ccb = cam_getccb(device);
4569 if (ccb == NULL)
4572 scsi_mode_select_len(&ccb->csio,
4585 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
4588 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
4590 if (((retval = cam_send_ccb(device, ccb)) < 0)
4591 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
4593 cam_error_print(device, ccb, CAM_ESF_ALL,
4596 cam_freeccb(ccb);
4606 cam_freeccb(ccb);
4686 union ccb *ccb;
4703 ccb = cam_getccb(device);
4705 if (ccb == NULL) {
4706 warnx("scsicmd: error allocating ccb");
4921 bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len);
4923 cam_fill_csio(&ccb->csio,
4935 bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len);
4937 ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT;
4939 ccb->ataio.cmd.flags |= CAM_ATAIO_DMA;
4941 ccb->ataio.cmd.flags |= CAM_ATAIO_FPDMA;
4943 cam_fill_ataio(&ccb->ataio,
4953 if (((retval = cam_send_ccb(device, ccb)) < 0)
4954 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
4963 cam_error_print(device, ccb, CAM_ESF_ALL,
4973 buff_decode_visit(&ccb->ataio.res.status, 11, resstr,
4979 ccb->ataio.res.status,
4980 ccb->ataio.res.error,
4981 ccb->ataio.res.lba_low,
4982 ccb->ataio.res.lba_mid,
4983 ccb->ataio.res.lba_high,
4984 ccb->ataio.res.device,
4985 ccb->ataio.res.lba_low_exp,
4986 ccb->ataio.res.lba_mid_exp,
4987 ccb->ataio.res.lba_high_exp,
4988 ccb->ataio.res.sector_count,
4989 ccb->ataio.res.sector_count_exp);
4995 valid_bytes = ccb->csio.dxfer_len - ccb->csio.resid;
4997 valid_bytes = ccb->ataio.dxfer_len - ccb->ataio.resid;
4998 if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
5032 cam_freeccb(ccb);
5045 union ccb ccb;
5048 bzero(&ccb, sizeof(union ccb));
5054 ccb.cdbg.flags |= CAM_DEBUG_INFO;
5058 ccb.cdbg.flags |= CAM_DEBUG_PERIPH;
5062 ccb.cdbg.flags |= CAM_DEBUG_SUBTRACE;
5066 ccb.cdbg.flags |= CAM_DEBUG_TRACE;
5070 ccb.cdbg.flags |= CAM_DEBUG_XPT;
5074 ccb.cdbg.flags |= CAM_DEBUG_CDB;
5078 ccb.cdbg.flags |= CAM_DEBUG_PROBE;
5099 ccb.cdbg.flags = CAM_DEBUG_NONE;
5118 ccb.ccb_h.func_code = XPT_DEBUG;
5119 ccb.ccb_h.path_id = bus;
5120 ccb.ccb_h.target_id = target;
5121 ccb.ccb_h.target_lun = lun;
5123 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
5127 if ((ccb.ccb_h.status & CAM_STATUS_MASK) ==
5133 } else if ((ccb.ccb_h.status & CAM_STATUS_MASK) !=
5136 ccb.ccb_h.status);
5139 if (ccb.cdbg.flags == CAM_DEBUG_NONE) {
5160 union ccb *ccb;
5166 ccb = cam_getccb(device);
5168 if (ccb == NULL) {
5169 warnx("tagcontrol: error allocating ccb");
5194 ccb->ccb_h.func_code = XPT_REL_SIMQ;
5195 ccb->ccb_h.flags = CAM_DEV_QFREEZE;
5196 ccb->crs.release_flags = RELSIM_ADJUST_OPENINGS;
5197 ccb->crs.openings = numtags;
5200 if (cam_send_ccb(device, ccb) < 0) {
5206 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
5208 cam_error_print(device, ccb, CAM_ESF_ALL,
5217 pathstr, ccb->crs.openings);
5220 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgds);
5222 ccb->ccb_h.func_code = XPT_GDEV_STATS;
5224 if (cam_send_ccb(device, ccb) < 0) {
5230 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
5232 cam_error_print(device, ccb, CAM_ESF_ALL,
5240 fprintf(stdout, "dev_openings %d\n", ccb->cgds.dev_openings);
5242 fprintf(stdout, "dev_active %d\n", ccb->cgds.dev_active);
5244 fprintf(stdout, "allocated %d\n", ccb->cgds.allocated);
5246 fprintf(stdout, "queued %d\n", ccb->cgds.queued);
5248 fprintf(stdout, "held %d\n", ccb->cgds.held);
5250 fprintf(stdout, "mintags %d\n", ccb->cgds.mintags);
5252 fprintf(stdout, "maxtags %d\n", ccb->cgds.maxtags);
5258 fprintf(stdout, "%d\n", ccb->cgds.dev_openings +
5259 ccb->cgds.dev_active);
5264 cam_freeccb(ccb);
5441 union ccb *ccb;
5444 ccb = cam_getccb(device);
5445 if (ccb == NULL) {
5449 ccb->ccb_h.func_code = XPT_PATH_INQ;
5450 if (cam_send_ccb(device, ccb) < 0) {
5455 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
5457 cam_error_print(device, ccb, CAM_ESF_ALL,
5462 bcopy(&ccb->cpi, cpi, sizeof(struct ccb_pathinq));
5465 cam_freeccb(ccb);
5475 union ccb *ccb;
5478 ccb = cam_getccb(device);
5479 if (ccb == NULL) {
5483 ccb->ccb_h.func_code = XPT_GDEV_TYPE;
5484 if (cam_send_ccb(device, ccb) < 0) {
5489 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
5491 cam_error_print(device, ccb, CAM_ESF_ALL,
5496 bcopy(&ccb->cgd, cgd, sizeof(struct ccb_getdev));
5499 cam_freeccb(ccb);
5511 union ccb *ccb = NULL;
5516 ccb = cam_getccb(dev);
5517 if (ccb == NULL) {
5525 scsi_inquiry(&ccb->csio,
5537 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
5540 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
5542 if (cam_send_ccb(dev, ccb) < 0) {
5543 cam_freeccb(ccb);
5544 ccb = NULL;
5549 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
5551 cam_error_print(dev, ccb, CAM_ESF_ALL,
5564 if (ccb != NULL)
5565 cam_freeccb(ccb);
5648 build_ata_cmd(union ccb *ccb, uint32_t retry_count, uint32_t flags,
5658 cam_fill_ataio(&ccb->ataio,
5667 ata_48bit_cmd(&ccb->ataio, command, features, lba,
5670 ata_28bit_cmd(&ccb->ataio, command, features, lba,
5674 ccb->ataio.ata_flags |= ATA_FLAG_AUX;
5675 ccb->ataio.aux = auxiliary;
5679 ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT;
5682 ccb->ataio.cmd.flags |= CAM_ATAIO_DMA;
5684 ccb->ataio.cmd.flags |= CAM_ATAIO_FPDMA;
5689 retval = scsi_ata_pass(&ccb->csio,
5721 get_ata_status(struct cam_device *dev, union ccb *ccb, uint8_t *error,
5726 switch (ccb->ccb_h.func_code) {
5736 if (ccb->ccb_h.flags & CAM_CDB_POINTER)
5737 opcode = ccb->csio.cdb_io.cdb_ptr[0];
5739 opcode = ccb->csio.cdb_io.cdb_bytes[0];
5746 retval = scsi_extract_sense_ccb(ccb, &error_code, &sense_key,
5752 sense_len = ccb->csio.sense_len - ccb->csio.sense_resid;
5761 &ccb->csio.sense_data;
5766 cam_error_print(dev, ccb, CAM_ESF_ALL,
5823 scsi_get_sense_info(&ccb->csio.sense_data, sense_len,
5831 scsi_get_sense_info(&ccb->csio.sense_data, sense_len,
5849 if (cam_ccb_status(ccb) != CAM_REQ_CMP &&
5850 cam_ccb_status(ccb) != CAM_ATA_STATUS_ERROR)
5853 res = &ccb->ataio.res;
5861 if (ccb->ataio.cmd.flags & CAM_ATAIO_48BIT) {
6047 union ccb *ccb;
6050 ccb = cam_getccb(device);
6052 if (ccb == NULL) {
6053 warnx("get_print_cts: error allocating ccb");
6057 ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
6060 ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS;
6062 ccb->cts.type = CTS_TYPE_USER_SETTINGS;
6064 if (cam_send_ccb(device, ccb) < 0) {
6070 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
6073 cam_error_print(device, ccb, CAM_ESF_ALL,
6080 cts_print(device, &ccb->cts);
6083 bcopy(&ccb->cts, cts, sizeof(struct ccb_trans_settings));
6087 cam_freeccb(ccb);
6097 union ccb *ccb;
6109 ccb = cam_getccb(device);
6110 if (ccb == NULL) {
6111 warnx("ratecontrol: error allocating ccb");
6203 retval = get_print_cts(device, user_settings, quiet, &ccb->cts);
6218 if (ccb->cts.transport == XPORT_SPI)
6219 spi = &ccb->cts.xport_specific.spi;
6220 if (ccb->cts.transport == XPORT_ATA)
6221 pata = &ccb->cts.xport_specific.ata;
6222 if (ccb->cts.transport == XPORT_SATA)
6223 sata = &ccb->cts.xport_specific.sata;
6224 if (ccb->cts.protocol == PROTO_ATA)
6225 ata = &ccb->cts.proto_specific.ata;
6226 if (ccb->cts.protocol == PROTO_SCSI)
6227 scsi = &ccb->cts.proto_specific.scsi;
6228 ccb->cts.xport_specific.valid = 0;
6229 ccb->cts.proto_specific.valid = 0;
6383 ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
6384 if (cam_send_ccb(device, ccb) < 0) {
6389 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
6392 cam_error_print(device, ccb, CAM_ESF_ALL,
6412 (ccb->cts.transport == XPORT_ATA ||
6413 ccb->cts.transport == XPORT_SATA || send_tur)) {
6419 cam_freeccb(ccb);
6427 union ccb *ccb;
6440 ccb = cam_getccb(device);
6442 if (ccb == NULL) {
6443 warnx("scsiformat: error allocating ccb");
6541 scsi_format_unit(&ccb->csio,
6553 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
6556 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
6558 if (((retval = cam_send_ccb(device, ccb)) < 0)
6560 && ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP))) {
6569 cam_error_print(device, ccb, CAM_ESF_ALL,
6593 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
6600 scsi_test_unit_ready(&ccb->csio,
6608 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
6610 retval = cam_send_ccb(device, ccb);
6622 status = ccb->ccb_h.status & CAM_STATUS_MASK;
6626 && ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0)) {
6630 sense = &ccb->csio.sense_data;
6631 scsi_extract_sense_len(sense, ccb->csio.sense_len -
6632 ccb->csio.sense_resid, &error_code, &sense_key,
6646 if ((scsi_get_sks(sense, ccb->csio.sense_len -
6647 ccb->csio.sense_resid, sks) == 0)
6669 scsi_sense_print(device, &ccb->csio,
6680 cam_error_print(device, ccb, CAM_ESF_ALL,
6689 cam_error_print(device, ccb, CAM_ESF_ALL,
6695 } while((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP);
6702 cam_freeccb(ccb);
6708 sanitize_wait_ata(struct cam_device *device, union ccb *ccb, int quiet,
6718 retval = build_ata_cmd(ccb,
6743 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
6744 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
6745 retval = cam_send_ccb(device, ccb);
6751 retval = get_ata_status(device, ccb, &error, &count, &lba,
6801 sanitize_wait_scsi(struct cam_device *device, union ccb *ccb, int task_attr, int quiet)
6808 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
6815 scsi_test_unit_ready(&ccb->csio,
6823 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
6825 retval = cam_send_ccb(device, ccb);
6836 status = ccb->ccb_h.status & CAM_STATUS_MASK;
6838 ((ccb->ccb_h.status & CAM_AUTOSNS_VALID) != 0)) {
6842 sense = &ccb->csio.sense_data;
6843 scsi_extract_sense_len(sense, ccb->csio.sense_len -
6844 ccb->csio.sense_resid, &error_code, &sense_key,
6858 if ((scsi_get_sks(sense, ccb->csio.sense_len -
6859 ccb->csio.sense_resid, sks) == 0)
6873 scsi_sense_print(device, &ccb->csio,
6884 cam_error_print(device, ccb, CAM_ESF_ALL,
6892 cam_error_print(device, ccb, CAM_ESF_ALL,
6896 } while ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP);
6904 union ccb *ccb;
6933 ccb = cam_getccb(device);
6935 if (ccb == NULL) {
6936 warnx("sanitize: error allocating ccb");
7083 ccb, &ident_buf);
7147 scsi_sanitize(&ccb->csio,
7158 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
7160 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
7161 if (cam_send_ccb(device, ccb) < 0) {
7197 ccb,
7213 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
7217 if ((ccb->ccb_h.status & CAM_STATUS_MASK) ==
7219 sense = &ccb->csio.sense_data;
7220 scsi_extract_sense_len(sense, ccb->csio.sense_len -
7221 ccb->csio.sense_resid, &error_code, &sense_key,
7234 cam_error_print(device, ccb, CAM_ESF_ALL,
7256 error = sanitize_wait_scsi(device, ccb, task_attr, quiet);
7258 error = sanitize_wait_ata(device, ccb, quiet, dt);
7269 cam_freeccb(ccb);
7278 union ccb *ccb;
7289 ccb = cam_getccb(device);
7291 if (ccb == NULL) {
7292 warnx("%s: error allocating ccb", __func__);
7348 scsi_report_luns(&ccb->csio,
7359 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
7362 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
7364 if (cam_send_ccb(device, ccb) < 0) {
7370 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
7371 cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
7502 cam_freeccb(ccb);
7513 union ccb *ccb;
7531 ccb = cam_getccb(device);
7533 if (ccb == NULL) {
7534 warnx("%s: error allocating ccb", __func__);
7599 scsi_read_capacity(&ccb->csio,
7608 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
7611 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
7613 if (cam_send_ccb(device, ccb) < 0) {
7619 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
7620 cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
7637 scsi_read_capacity_16(&ccb->csio,
7650 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
7653 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
7655 if (cam_send_ccb(device, ccb) < 0) {
7661 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
7662 cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
7708 cam_freeccb(ccb);
7718 union ccb *ccb;
7731 ccb = cam_getccb(device);
7732 if (ccb == NULL) {
7837 cam_fill_smpio(&ccb->smpio,
7847 ccb->smpio.flags = SMP_FLAG_NONE;
7849 if (((retval = cam_send_ccb(device, ccb)) < 0)
7850 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
7859 cam_error_print(device, ccb, CAM_ESF_ALL,
7864 if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
7894 if (ccb != NULL)
7895 cam_freeccb(ccb);
7911 union ccb *ccb;
7933 ccb = cam_getccb(device);
7934 if (ccb == NULL) {
7939 bzero(&(&ccb->ccb_h)[1],
7940 sizeof(union ccb) - sizeof(struct ccb_hdr));
8053 ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
8054 ccb->ccb_h.flags = 0;
8055 cts = &ccb->cts.proto_specific.mmc;
8058 if (((retval = cam_send_ccb(device, ccb)) < 0)
8059 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8064 cam_freeccb(ccb);
8070 ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
8071 ccb->ccb_h.flags = 0;
8072 cts = &ccb->cts.proto_specific.mmc;
8075 if (((retval = cam_send_ccb(device, ccb)) < 0)
8076 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8081 cam_freeccb(ccb);
8088 ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
8089 ccb->ccb_h.flags = 0;
8090 cts = &ccb->cts.proto_specific.mmc;
8093 if (((retval = cam_send_ccb(device, ccb)) < 0)
8094 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8099 cam_freeccb(ccb);
8105 ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
8106 ccb->ccb_h.flags = 0;
8108 cts = &ccb->cts.proto_specific.mmc;
8109 if (((retval = cam_send_ccb(device, ccb)) < 0)
8110 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8203 cam_fill_mmcio(&ccb->mmcio,
8213 if (((retval = cam_send_ccb(device, ccb)) < 0)
8214 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8223 cam_error_print(device, ccb, CAM_ESF_ALL,
8228 if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)) {
8230 ccb->mmcio.cmd.error, ccb->mmcio.cmd.resp[0],
8231 ccb->mmcio.cmd.resp[1],
8232 ccb->mmcio.cmd.resp[2],
8233 ccb->mmcio.cmd.resp[3]);
8238 SD_R5_DATA(ccb->mmcio.cmd.resp),
8239 (ccb->mmcio.cmd.resp[0] >> 12) & 0x3);
8246 printf("SEND_RELATIVE_ADDR: published RCA %02x\n", ccb->mmcio.cmd.resp[0] >> 16);
8255 if (ccb != NULL)
8256 cam_freeccb(ccb);
8268 union ccb *ccb;
8280 ccb = cam_getccb(device);
8281 if (ccb == NULL) {
8312 smp_report_general(&ccb->smpio,
8322 if (((retval = cam_send_ccb(device, ccb)) < 0)
8323 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8332 cam_error_print(device, ccb, CAM_ESF_ALL,
8345 ccb->ccb_h.status = CAM_REQ_INPROG;
8346 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
8370 if (ccb != NULL)
8371 cam_freeccb(ccb);
8402 union ccb *ccb;
8422 ccb = cam_getccb(device);
8423 if (ccb == NULL) {
8607 smp_phy_control(&ccb->smpio,
8626 if (((retval = cam_send_ccb(device, ccb)) < 0)
8627 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8640 cam_error_print(device, ccb, CAM_ESF_ALL,
8649 if (ccb != NULL)
8650 cam_freeccb(ccb);
8665 union ccb *ccb;
8677 ccb = cam_getccb(device);
8678 if (ccb == NULL) {
8695 smp_report_manuf_info(&ccb->smpio,
8705 if (((retval = cam_send_ccb(device, ccb)) < 0)
8706 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
8715 cam_error_print(device, ccb, CAM_ESF_ALL,
8739 if (ccb != NULL)
8740 cam_freeccb(ccb);
8752 union ccb *ccb = NULL;
8768 ccb = cam_getccb(dev);
8769 if (ccb == NULL) {
8780 ccb->ccb_h.func_code = XPT_DEV_ADVINFO;
8781 ccb->ccb_h.flags = CAM_DIR_IN;
8782 ccb->cdai.flags = CDAI_FLAG_NONE;
8783 ccb->cdai.buftype = CDAI_TYPE_SCSI_DEVID;
8784 ccb->cdai.bufsiz = item->device_id_len;
8786 ccb->cdai.buf = (uint8_t *)item->device_id;
8788 if (cam_send_ccb(dev, ccb) < 0) {
8794 if (ccb->ccb_h.status != CAM_REQ_CMP) {
8795 warnx("%s: CAM status %#x", __func__, ccb->ccb_h.status);
8805 if (ccb->cdai.provsiz == 0) {
8811 item->device_id_len = ccb->cdai.provsiz;
8819 ccb->ccb_h.status = CAM_REQ_INPROG;
8827 if (ccb != NULL)
8828 cam_freeccb(ccb);
8839 union ccb ccb;
8851 bzero(&ccb, sizeof(union ccb));
8853 ccb.ccb_h.path_id = CAM_XPT_PATH_ID;
8854 ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
8855 ccb.ccb_h.target_lun = CAM_LUN_WILDCARD;
8857 ccb.ccb_h.func_code = XPT_DEV_MATCH;
8859 ccb.cdm.match_buf_len = bufsize;
8860 ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);
8861 if (ccb.cdm.matches == NULL) {
8866 ccb.cdm.num_matches = 0;
8867 ccb.cdm.num_patterns = 2;
8868 ccb.cdm.pattern_buf_len = sizeof(struct dev_match_pattern) *
8869 ccb.cdm.num_patterns;
8871 patterns = (struct dev_match_pattern *)malloc(ccb.cdm.pattern_buf_len);
8878 ccb.cdm.patterns = patterns;
8879 bzero(patterns, ccb.cdm.pattern_buf_len);
8895 if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
8901 if ((ccb.ccb_h.status != CAM_REQ_CMP)
8902 || ((ccb.cdm.status != CAM_DEV_MATCH_LAST)
8903 && (ccb.cdm.status != CAM_DEV_MATCH_MORE))) {
8905 ccb.ccb_h.status, ccb.cdm.status);
8910 for (i = 0; i < ccb.cdm.num_matches; i++) {
8911 switch (ccb.cdm.matches[i].type) {
8916 &ccb.cdm.matches[i].result.device_result;
8948 &ccb.cdm.matches[i].result.periph_result;
8971 ccb.cdm.matches[i].type);
8977 } while ((ccb.ccb_h.status == CAM_REQ_CMP)
8978 && (ccb.cdm.status == CAM_DEV_MATCH_MORE));
8986 free(ccb.cdm.matches);
9041 union ccb *ccb;
9052 ccb = cam_getccb(device);
9053 if (ccb == NULL) {
9089 smp_report_general(&ccb->smpio,
9099 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
9101 if (((retval = cam_send_ccb(device, ccb)) < 0)
9102 || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
9111 cam_error_print(device, ccb, CAM_ESF_ALL,
9161 CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->smpio);
9163 ccb->ccb_h.status = CAM_REQ_INPROG;
9164 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
9166 smp_discover(&ccb->smpio,
9178 if (((retval = cam_send_ccb(device, ccb)) < 0)
9179 || (((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
9189 cam_error_print(device, ccb, CAM_ESF_ALL,
9270 if (ccb != NULL)
9271 cam_freeccb(ccb);
9287 atapm_proc_resp(struct cam_device *device, union ccb *ccb)
9294 retval = get_ata_status(device, ccb, &error, &count, &lba, &ata_device,
9298 cam_error_print(device, ccb, CAM_ESF_ALL,
9306 cam_error_print(device, ccb, CAM_ESF_ALL,
9352 union ccb *ccb;
9359 ccb = cam_getccb(device);
9361 if (ccb == NULL) {
9362 warnx("%s: error allocating ccb", __func__);
9407 ccb,
9423 retval = atapm_proc_resp(device, ccb);
9425 cam_freeccb(ccb);
9433 union ccb *ccb;
9439 ccb = cam_getccb(device);
9441 if (ccb == NULL) {
9442 warnx("%s: error allocating ccb", __func__);
9473 ccb,
9488 cam_freeccb(ccb);
9498 union ccb *ccb = NULL;
9514 ccb = cam_getccb(device);
9515 if (ccb == NULL) {
9557 scsi_report_supported_opcodes(&ccb->csio,
9569 ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
9572 ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
9574 if (cam_send_ccb(device, ccb) < 0) {
9580 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
9582 cam_error_print(device, ccb, CAM_ESF_ALL,
9588 valid_len = ccb->csio.dxfer_len - ccb->csio.resid;
9631 cam_freeccb(ccb);
9948 union ccb *ccb;
9951 ccb = cam_getccb(device);
9953 if (ccb == NULL) {
9954 warnx("%s: error allocating ccb", __func__);
9958 ccb->ccb_h.func_code = XPT_REPROBE_LUN;
9960 if (cam_send_ccb(device, ccb) < 0) {
9966 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
9967 cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr);
9973 cam_freeccb(ccb);