• Home
  • Raw
  • Download

Lines Matching full:scp

914 static void mk_sense_invalid_fld(struct scsi_cmnd *scp,  in mk_sense_invalid_fld()  argument
922 sbuff = scp->sense_buffer; in mk_sense_invalid_fld()
924 sdev_printk(KERN_ERR, scp->device, in mk_sense_invalid_fld()
949 sdev_printk(KERN_INFO, scp->device, "%s: [sense_key,asc,ascq" in mk_sense_invalid_fld()
954 static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq) in mk_sense_buffer() argument
958 sbuff = scp->sense_buffer; in mk_sense_buffer()
960 sdev_printk(KERN_ERR, scp->device, in mk_sense_buffer()
969 sdev_printk(KERN_INFO, scp->device, in mk_sense_buffer()
974 static void mk_sense_invalid_opcode(struct scsi_cmnd *scp) in mk_sense_invalid_opcode() argument
976 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_OPCODE, 0); in mk_sense_invalid_opcode()
1069 static int make_ua(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in make_ua() argument
1079 mk_sense_buffer(scp, UNIT_ATTENTION, UA_RESET_ASC, in make_ua()
1085 mk_sense_buffer(scp, UNIT_ATTENTION, UA_RESET_ASC, in make_ua()
1091 mk_sense_buffer(scp, UNIT_ATTENTION, UA_CHANGED_ASC, in make_ua()
1097 mk_sense_buffer(scp, UNIT_ATTENTION, UA_CHANGED_ASC, in make_ua()
1103 mk_sense_buffer(scp, UNIT_ATTENTION, in make_ua()
1110 mk_sense_buffer(scp, UNIT_ATTENTION, in make_ua()
1127 mk_sense_buffer(scp, UNIT_ATTENTION, in make_ua()
1141 sdev_printk(KERN_INFO, scp->device, in make_ua()
1150 static int fill_from_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr, in fill_from_dev_buffer() argument
1154 struct scsi_data_buffer *sdb = &scp->sdb; in fill_from_dev_buffer()
1158 if (scp->sc_data_direction != DMA_FROM_DEVICE) in fill_from_dev_buffer()
1163 scsi_set_resid(scp, scsi_bufflen(scp) - act_len); in fill_from_dev_buffer()
1173 static int p_fill_from_dev_buffer(struct scsi_cmnd *scp, const void *arr, in p_fill_from_dev_buffer() argument
1177 struct scsi_data_buffer *sdb = &scp->sdb; in p_fill_from_dev_buffer()
1182 if (scp->sc_data_direction != DMA_FROM_DEVICE) in p_fill_from_dev_buffer()
1188 __func__, off_dst, scsi_bufflen(scp), act_len, in p_fill_from_dev_buffer()
1189 scsi_get_resid(scp)); in p_fill_from_dev_buffer()
1190 n = scsi_bufflen(scp) - (off_dst + act_len); in p_fill_from_dev_buffer()
1191 scsi_set_resid(scp, min_t(u32, scsi_get_resid(scp), n)); in p_fill_from_dev_buffer()
1198 static int fetch_to_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr, in fetch_to_dev_buffer() argument
1201 if (!scsi_bufflen(scp)) in fetch_to_dev_buffer()
1203 if (scp->sc_data_direction != DMA_TO_DEVICE) in fetch_to_dev_buffer()
1206 return scsi_sg_copy_to_buffer(scp, arr, arr_len); in fetch_to_dev_buffer()
1559 static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_inquiry() argument
1563 unsigned char *cmd = scp->cmnd; in resp_inquiry()
1575 have_wlun = scsi_is_wlun(scp->device->lun); in resp_inquiry()
1584 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 1); in resp_inquiry()
1676 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1); in resp_inquiry()
1681 ret = fill_from_dev_buffer(scp, arr, in resp_inquiry()
1717 ret = fill_from_dev_buffer(scp, arr, in resp_inquiry()
1727 static int resp_requests(struct scsi_cmnd *scp, in resp_requests() argument
1730 unsigned char *cmd = scp->cmnd; in resp_requests()
1778 return fill_from_dev_buffer(scp, arr, min_t(u32, len, alloc_len)); in resp_requests()
1781 static int resp_start_stop(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_start_stop() argument
1783 unsigned char *cmd = scp->cmnd; in resp_start_stop()
1789 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 4, 7); in resp_start_stop()
1810 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 4, 0 /* START bit */); in resp_start_stop()
1836 static int resp_readcap(struct scsi_cmnd *scp, in resp_readcap() argument
1851 return fill_from_dev_buffer(scp, arr, SDEBUG_READCAP_ARR_SZ); in resp_readcap()
1855 static int resp_readcap16(struct scsi_cmnd *scp, in resp_readcap16() argument
1858 unsigned char *cmd = scp->cmnd; in resp_readcap16()
1888 return fill_from_dev_buffer(scp, arr, in resp_readcap16()
1894 static int resp_report_tgtpgs(struct scsi_cmnd *scp, in resp_report_tgtpgs() argument
1897 unsigned char *cmd = scp->cmnd; in resp_report_tgtpgs()
1965 ret = fill_from_dev_buffer(scp, arr, in resp_report_tgtpgs()
1971 static int resp_rsup_opcodes(struct scsi_cmnd *scp, in resp_rsup_opcodes() argument
1982 u8 *cmd = scp->cmnd; in resp_rsup_opcodes()
1990 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 6, -1); in resp_rsup_opcodes()
1999 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, in resp_rsup_opcodes()
2060 mk_sense_invalid_fld(scp, SDEB_IN_CDB, in resp_rsup_opcodes()
2068 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 4, -1); in resp_rsup_opcodes()
2111 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 2); in resp_rsup_opcodes()
2117 errsts = fill_from_dev_buffer(scp, arr, len); in resp_rsup_opcodes()
2122 static int resp_rsup_tmfs(struct scsi_cmnd *scp, in resp_rsup_tmfs() argument
2128 u8 *cmd = scp->cmnd; in resp_rsup_tmfs()
2134 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 6, -1); in resp_rsup_tmfs()
2146 return fill_from_dev_buffer(scp, arr, len); in resp_rsup_tmfs()
2311 static int resp_mode_sense(struct scsi_cmnd *scp, in resp_mode_sense() argument
2318 int target = scp->device->id; in resp_mode_sense()
2321 unsigned char *cmd = scp->cmnd; in resp_mode_sense()
2339 mk_sense_buffer(scp, ILLEGAL_REQUEST, SAVING_PARAMS_UNSUP, 0); in resp_mode_sense()
2383 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); in resp_mode_sense()
2417 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); in resp_mode_sense()
2457 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); in resp_mode_sense()
2466 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5); in resp_mode_sense()
2473 return fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, offset)); in resp_mode_sense()
2478 static int resp_mode_select(struct scsi_cmnd *scp, in resp_mode_select() argument
2484 unsigned char *cmd = scp->cmnd; in resp_mode_select()
2492 mk_sense_invalid_fld(scp, SDEB_IN_CDB, mselect6 ? 4 : 7, -1); in resp_mode_select()
2495 res = fetch_to_dev_buffer(scp, arr, param_len); in resp_mode_select()
2499 sdev_printk(KERN_INFO, scp->device, in resp_mode_select()
2506 mk_sense_invalid_fld(scp, SDEB_IN_DATA, 0, -1); in resp_mode_select()
2512 mk_sense_invalid_fld(scp, SDEB_IN_DATA, off, 7); in resp_mode_select()
2519 mk_sense_buffer(scp, ILLEGAL_REQUEST, in resp_mode_select()
2553 mk_sense_invalid_fld(scp, SDEB_IN_DATA, off, 5); in resp_mode_select()
2585 static int resp_log_sense(struct scsi_cmnd *scp, in resp_log_sense() argument
2591 unsigned char *cmd = scp->cmnd; in resp_log_sense()
2597 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, ppc ? 1 : 0); in resp_log_sense()
2620 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5); in resp_log_sense()
2652 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5); in resp_log_sense()
2656 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); in resp_log_sense()
2660 return fill_from_dev_buffer(scp, arr, in resp_log_sense()
2791 static int check_zbc_access_params(struct scsi_cmnd *scp, in check_zbc_access_params() argument
2794 struct scsi_device *sdp = scp->device; in check_zbc_access_params()
2806 mk_sense_buffer(scp, ILLEGAL_REQUEST, in check_zbc_access_params()
2817 mk_sense_buffer(scp, ILLEGAL_REQUEST, in check_zbc_access_params()
2828 mk_sense_buffer(scp, ILLEGAL_REQUEST, in check_zbc_access_params()
2835 mk_sense_buffer(scp, ILLEGAL_REQUEST, in check_zbc_access_params()
2841 mk_sense_buffer(scp, ILLEGAL_REQUEST, in check_zbc_access_params()
2852 mk_sense_buffer(scp, DATA_PROTECT, in check_zbc_access_params()
2864 (struct scsi_cmnd *scp, unsigned long long lba, in check_device_access_params() argument
2867 struct scsi_device *sdp = scp->device; in check_device_access_params()
2871 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in check_device_access_params()
2877 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in check_device_access_params()
2881 mk_sense_buffer(scp, DATA_PROTECT, WRITE_PROTECTED, 0x2); in check_device_access_params()
2885 return check_zbc_access_params(scp, lba, num, write); in check_device_access_params()
2907 static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp, in do_device_access() argument
2913 struct scsi_data_buffer *sdb = &scp->sdb; in do_device_access()
2925 if (scp->sc_data_direction != dir) in do_device_access()
2950 static int do_dout_fetch(struct scsi_cmnd *scp, u32 num, u8 *doutp) in do_dout_fetch() argument
2952 struct scsi_data_buffer *sdb = &scp->sdb; in do_dout_fetch()
2956 if (scp->sc_data_direction != DMA_TO_DEVICE) in do_dout_fetch()
3034 static void dif_copy_prot(struct scsi_cmnd *scp, sector_t sector, in dif_copy_prot() argument
3040 scp->device->hostdata, true); in dif_copy_prot()
3048 sg_miter_start(&miter, scsi_prot_sglist(scp), in dif_copy_prot()
3049 scsi_prot_sg_count(scp), SG_MITER_ATOMIC | in dif_copy_prot()
3080 static int prot_verify_read(struct scsi_cmnd *scp, sector_t start_sec, in prot_verify_read() argument
3086 scp->device->hostdata, true); in prot_verify_read()
3106 dif_copy_prot(scp, start_sec, sectors, true); in prot_verify_read()
3112 static int resp_read_dt0(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_read_dt0() argument
3121 u8 *cmd = scp->cmnd; in resp_read_dt0()
3165 mk_sense_invalid_opcode(scp); in resp_read_dt0()
3171 sdev_printk(KERN_ERR, scp->device, "Unprotected RD " in resp_read_dt0()
3180 ret = check_device_access_params(scp, lba, num, false); in resp_read_dt0()
3187 mk_sense_buffer(scp, MEDIUM_ERROR, UNRECOVERED_READ_ERR, 0); in resp_read_dt0()
3189 if (0x70 == (scp->sense_buffer[0] & 0x7f)) { in resp_read_dt0()
3190 scp->sense_buffer[0] |= 0x80; /* Valid bit */ in resp_read_dt0()
3193 put_unaligned_be32(ret, scp->sense_buffer + 3); in resp_read_dt0()
3195 scsi_set_resid(scp, scsi_bufflen(scp)); in resp_read_dt0()
3202 if (unlikely(sdebug_dix && scsi_prot_sg_count(scp))) { in resp_read_dt0()
3203 int prot_ret = prot_verify_read(scp, lba, num, ei_lba); in resp_read_dt0()
3207 mk_sense_buffer(scp, ABORTED_COMMAND, 0x10, prot_ret); in resp_read_dt0()
3212 ret = do_device_access(sip, scp, 0, lba, num, false); in resp_read_dt0()
3217 scsi_set_resid(scp, scsi_bufflen(scp) - ret); in resp_read_dt0()
3222 mk_sense_buffer(scp, RECOVERED_ERROR, THRESHOLD_EXCEEDED, 0); in resp_read_dt0()
3227 mk_sense_buffer(scp, ABORTED_COMMAND, 0x10, 1); in resp_read_dt0()
3231 mk_sense_buffer(scp, ILLEGAL_REQUEST, 0x10, 1); in resp_read_dt0()
3415 static int resp_write_dt0(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_write_dt0() argument
3424 u8 *cmd = scp->cmnd; in resp_write_dt0()
3468 mk_sense_invalid_opcode(scp); in resp_write_dt0()
3474 sdev_printk(KERN_ERR, scp->device, "Unprotected WR " in resp_write_dt0()
3479 ret = check_device_access_params(scp, lba, num, true); in resp_write_dt0()
3486 if (unlikely(sdebug_dix && scsi_prot_sg_count(scp))) { in resp_write_dt0()
3487 int prot_ret = prot_verify_write(scp, lba, num, ei_lba); in resp_write_dt0()
3491 mk_sense_buffer(scp, ILLEGAL_REQUEST, 0x10, prot_ret); in resp_write_dt0()
3496 ret = do_device_access(sip, scp, 0, lba, num, true); in resp_write_dt0()
3507 sdev_printk(KERN_INFO, scp->device, in resp_write_dt0()
3514 mk_sense_buffer(scp, RECOVERED_ERROR, THRESHOLD_EXCEEDED, 0); in resp_write_dt0()
3519 mk_sense_buffer(scp, ABORTED_COMMAND, 0x10, 1); in resp_write_dt0()
3523 mk_sense_buffer(scp, ILLEGAL_REQUEST, 0x10, 1); in resp_write_dt0()
3535 static int resp_write_scat(struct scsi_cmnd *scp, in resp_write_scat() argument
3538 u8 *cmd = scp->cmnd; in resp_write_scat()
3568 mk_sense_invalid_opcode(scp); in resp_write_scat()
3574 sdev_printk(KERN_ERR, scp->device, in resp_write_scat()
3582 sdev_printk(KERN_INFO, scp->device, in resp_write_scat()
3585 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_write_scat()
3591 sdev_printk(KERN_INFO, scp->device, in resp_write_scat()
3594 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_write_scat()
3601 sdev_printk(KERN_INFO, scp->device, in resp_write_scat()
3604 res = fetch_to_dev_buffer(scp, lrdp, lbdof_blen); in resp_write_scat()
3618 sdev_printk(KERN_INFO, scp->device, in resp_write_scat()
3623 ret = check_device_access_params(scp, lba, num, true); in resp_write_scat()
3631 sdev_printk(KERN_INFO, scp->device, in resp_write_scat()
3634 mk_sense_buffer(scp, ILLEGAL_REQUEST, WRITE_ERROR_ASC, in resp_write_scat()
3641 if (unlikely(sdebug_dix && scsi_prot_sg_count(scp))) { in resp_write_scat()
3642 int prot_ret = prot_verify_write(scp, lba, num, in resp_write_scat()
3646 mk_sense_buffer(scp, ILLEGAL_REQUEST, 0x10, in resp_write_scat()
3653 ret = do_device_access(sip, scp, sg_off, lba, num, true); in resp_write_scat()
3663 sdev_printk(KERN_INFO, scp->device, in resp_write_scat()
3670 mk_sense_buffer(scp, RECOVERED_ERROR, THRESHOLD_EXCEEDED, 0); in resp_write_scat()
3676 mk_sense_buffer(scp, ABORTED_COMMAND, 0x10, 1); in resp_write_scat()
3681 mk_sense_buffer(scp, ILLEGAL_REQUEST, 0x10, 1); in resp_write_scat()
3698 static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, in resp_write_same() argument
3701 struct scsi_device *sdp = scp->device; in resp_write_same()
3708 scp->device->hostdata, true); in resp_write_same()
3715 ret = check_device_access_params(scp, lba, num, true); in resp_write_same()
3734 ret = fetch_to_dev_buffer(scp, fs1p, lb_size); in resp_write_same()
3740 sdev_printk(KERN_INFO, scp->device, in resp_write_same()
3761 static int resp_write_same_10(struct scsi_cmnd *scp, in resp_write_same_10() argument
3764 u8 *cmd = scp->cmnd; in resp_write_same_10()
3772 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 3); in resp_write_same_10()
3780 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 7, -1); in resp_write_same_10()
3783 return resp_write_same(scp, lba, num, ei_lba, unmap, false); in resp_write_same_10()
3786 static int resp_write_same_16(struct scsi_cmnd *scp, in resp_write_same_16() argument
3789 u8 *cmd = scp->cmnd; in resp_write_same_16()
3798 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 3); in resp_write_same_16()
3808 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 10, -1); in resp_write_same_16()
3811 return resp_write_same(scp, lba, num, ei_lba, unmap, ndob); in resp_write_same_16()
3817 static int resp_write_buffer(struct scsi_cmnd *scp, in resp_write_buffer() argument
3820 u8 *cmd = scp->cmnd; in resp_write_buffer()
3821 struct scsi_device *sdp = scp->device; in resp_write_buffer()
3863 static int resp_comp_write(struct scsi_cmnd *scp, in resp_comp_write() argument
3866 u8 *cmd = scp->cmnd; in resp_comp_write()
3883 mk_sense_invalid_opcode(scp); in resp_comp_write()
3889 sdev_printk(KERN_ERR, scp->device, "Unprotected WR " in resp_comp_write()
3891 ret = check_device_access_params(scp, lba, num, false); in resp_comp_write()
3897 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, in resp_comp_write()
3904 ret = do_dout_fetch(scp, dnum, arr); in resp_comp_write()
3909 sdev_printk(KERN_INFO, scp->device, "%s: compare_write: cdb " in resp_comp_write()
3913 mk_sense_buffer(scp, MISCOMPARE, MISCOMPARE_VERIFY_ASC, 0); in resp_comp_write()
3931 static int resp_unmap(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_unmap() argument
3942 payload_len = get_unaligned_be16(scp->cmnd + 7); in resp_unmap()
3943 BUG_ON(scsi_bufflen(scp) != payload_len); in resp_unmap()
3947 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 7, -1); in resp_unmap()
3951 buf = kzalloc(scsi_bufflen(scp), GFP_ATOMIC); in resp_unmap()
3953 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, in resp_unmap()
3958 scsi_sg_copy_to_buffer(scp, buf, scsi_bufflen(scp)); in resp_unmap()
3971 ret = check_device_access_params(scp, lba, num, true); in resp_unmap()
3989 static int resp_get_lba_status(struct scsi_cmnd *scp, in resp_get_lba_status() argument
3992 u8 *cmd = scp->cmnd; in resp_get_lba_status()
4004 ret = check_device_access_params(scp, lba, 1, false); in resp_get_lba_status()
4028 return fill_from_dev_buffer(scp, arr, SDEBUG_GET_LBA_STATUS_LEN); in resp_get_lba_status()
4031 static int resp_sync_cache(struct scsi_cmnd *scp, in resp_sync_cache() argument
4037 u8 *cmd = scp->cmnd; in resp_sync_cache()
4047 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_sync_cache()
4064 static int resp_pre_fetch(struct scsi_cmnd *scp, in resp_pre_fetch() argument
4071 u8 *cmd = scp->cmnd; in resp_pre_fetch()
4084 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_pre_fetch()
4117 static int resp_report_luns(struct scsi_cmnd *scp, in resp_report_luns() argument
4120 unsigned char *cmd = scp->cmnd; in resp_report_luns()
4141 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 6, -1); in resp_report_luns()
4163 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, -1); in resp_report_luns()
4172 scsi_set_resid(scp, scsi_bufflen(scp)); in resp_report_luns()
4196 res = p_fill_from_dev_buffer(scp, arr, n, off_rsp); in resp_report_luns()
4206 res = p_fill_from_dev_buffer(scp, arr, j * sz_lun, off_rsp); in resp_report_luns()
4210 static int resp_verify(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_verify() argument
4219 u8 *cmd = scp->cmnd; in resp_verify()
4227 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 2); in resp_verify()
4242 mk_sense_invalid_opcode(scp); in resp_verify()
4249 ret = check_device_access_params(scp, lba, a_num, false); in resp_verify()
4255 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, in resp_verify()
4262 ret = do_dout_fetch(scp, a_num, arr); in resp_verify()
4267 sdev_printk(KERN_INFO, scp->device, in resp_verify()
4277 mk_sense_buffer(scp, MISCOMPARE, MISCOMPARE_VERIFY_ASC, 0); in resp_verify()
4290 static int resp_report_zones(struct scsi_cmnd *scp, in resp_report_zones() argument
4299 u8 *cmd = scp->cmnd; in resp_report_zones()
4305 mk_sense_invalid_opcode(scp); in resp_report_zones()
4316 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_report_zones()
4326 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, in resp_report_zones()
4387 mk_sense_buffer(scp, ILLEGAL_REQUEST, in resp_report_zones()
4416 ret = fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, rep_len)); in resp_report_zones()
4436 static int resp_open_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_open_zone() argument
4441 u8 *cmd = scp->cmnd; in resp_open_zone()
4448 mk_sense_invalid_opcode(scp); in resp_open_zone()
4458 mk_sense_buffer(scp, DATA_PROTECT, INSUFF_RES_ASC, in resp_open_zone()
4471 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_open_zone()
4478 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_open_zone()
4483 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_open_zone()
4493 mk_sense_buffer(scp, DATA_PROTECT, INSUFF_RES_ASC, in resp_open_zone()
4513 static int resp_close_zone(struct scsi_cmnd *scp, in resp_close_zone() argument
4518 u8 *cmd = scp->cmnd; in resp_close_zone()
4525 mk_sense_invalid_opcode(scp); in resp_close_zone()
4539 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_close_zone()
4546 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_close_zone()
4551 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_close_zone()
4586 static int resp_finish_zone(struct scsi_cmnd *scp, in resp_finish_zone() argument
4592 u8 *cmd = scp->cmnd; in resp_finish_zone()
4598 mk_sense_invalid_opcode(scp); in resp_finish_zone()
4612 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_finish_zone()
4619 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_finish_zone()
4624 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_finish_zone()
4668 static int resp_rwp_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_rwp_zone() argument
4673 u8 *cmd = scp->cmnd; in resp_rwp_zone()
4679 mk_sense_invalid_opcode(scp); in resp_rwp_zone()
4692 mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); in resp_rwp_zone()
4699 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_rwp_zone()
4704 mk_sense_buffer(scp, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, 0); in resp_rwp_zone()
4743 struct scsi_cmnd *scp; in sdebug_q_cmd_complete() local
4762 scp = sqcp->a_cmnd; in sdebug_q_cmd_complete()
4763 if (unlikely(scp == NULL)) { in sdebug_q_cmd_complete()
4765 pr_err("scp is NULL, sqa_idx=%d, qc_idx=%d, hc_idx=%d\n", in sdebug_q_cmd_complete()
4769 devip = (struct sdebug_dev_info *)scp->device->hostdata; in sdebug_q_cmd_complete()
4805 scp->scsi_done(scp); /* callback to mid level */ in sdebug_q_cmd_complete()
7162 static bool fake_timeout(struct scsi_cmnd *scp) in fake_timeout() argument
7170 scsi_medium_access_command(scp)) in fake_timeout()
7177 static int resp_not_ready(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) in resp_not_ready() argument
7182 struct scsi_device *sdp = scp->device; in resp_not_ready()
7194 mk_sense_buffer(scp, NOT_READY, LOGICAL_UNIT_NOT_READY, 0x1); in resp_not_ready()
7198 if (scp->cmnd[0] == TEST_UNIT_READY) { in resp_not_ready()
7207 scsi_set_sense_information(scp->sense_buffer, SCSI_SENSE_BUFFERSIZE, in resp_not_ready()
7212 mk_sense_buffer(scp, NOT_READY, LOGICAL_UNIT_NOT_READY, 0x2); in resp_not_ready()
7220 struct scsi_cmnd *scp) in scsi_debug_queuecommand() argument
7223 struct scsi_device *sdp = scp->device; in scsi_debug_queuecommand()
7227 u8 *cmd = scp->cmnd; in scsi_debug_queuecommand()
7239 scsi_set_resid(scp, 0); in scsi_debug_queuecommand()
7251 len = scp->cmd_len; in scsi_debug_queuecommand()
7261 blk_mq_unique_tag(scp->request), b); in scsi_debug_queuecommand()
7301 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, 4); in scsi_debug_queuecommand()
7303 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 8, 7); in scsi_debug_queuecommand()
7305 mk_sense_invalid_opcode(scp); in scsi_debug_queuecommand()
7311 mk_sense_invalid_opcode(scp); in scsi_debug_queuecommand()
7318 mk_sense_invalid_opcode(scp); in scsi_debug_queuecommand()
7332 mk_sense_invalid_fld(scp, SDEB_IN_CDB, k, j); in scsi_debug_queuecommand()
7340 errsts = make_ua(scp, devip); in scsi_debug_queuecommand()
7344 if (unlikely(((F_M_ACCESS & flags) || scp->cmnd[0] == TEST_UNIT_READY) && in scsi_debug_queuecommand()
7346 errsts = resp_not_ready(scp, devip); in scsi_debug_queuecommand()
7353 if (fake_timeout(scp)) in scsi_debug_queuecommand()
7363 return schedule_resp(scp, devip, errsts, pfp, 0, 0); in scsi_debug_queuecommand()
7376 return schedule_resp(scp, devip, errsts, pfp, jdelay, 0); in scsi_debug_queuecommand()
7378 return schedule_resp(scp, devip, errsts, pfp, sdebug_jdelay, in scsi_debug_queuecommand()
7381 return schedule_resp(scp, devip, check_condition_result, NULL, 0, 0); in scsi_debug_queuecommand()
7383 return schedule_resp(scp, NULL, DID_NO_CONNECT << 16, NULL, 0, 0); in scsi_debug_queuecommand()