1/*- 2 * Copyright (c) 2003-2009 Silicon Graphics International Corp. 3 * Copyright (c) 2012 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Edward Tomasz Napierala 7 * under sponsorship from the FreeBSD Foundation. 8 * --- 28 unchanged lines hidden (view full) --- 37 * CAM Target Layer, a SCSI device emulation subsystem. 38 * 39 * Author: Ken Merry <ken@FreeBSD.org> 40 */ 41 42#define _CTL_C 43 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl.c 275058 2014-11-25 17:53:35Z mav $"); |
46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/ctype.h> 50#include <sys/kernel.h> 51#include <sys/types.h> 52#include <sys/kthread.h> 53#include <sys/bio.h> --- 4937 unchanged lines hidden (view full) --- 4991 * Backend "memory move is complete" callback for requests that never 4992 * make it down to say RAIDCore's configuration code. 4993 */ 4994int 4995ctl_config_move_done(union ctl_io *io) 4996{ 4997 int retval; 4998 |
4999 CTL_DEBUG_PRINT(("ctl_config_move_done\n")); |
5000 KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, 5001 ("Config I/O type isn't CTL_IO_SCSI (%d)!", io->io_hdr.io_type)); |
5002 |
5003 if ((io->io_hdr.port_status != 0) && 5004 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || 5005 (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { |
5006 /* 5007 * For hardware error sense keys, the sense key 5008 * specific value is defined to be a retry count, 5009 * but we use it to pass back an internal FETD 5010 * error code. XXX KDM Hopefully the FETD is only 5011 * using 16 bits for an error code, since that's 5012 * all the space we have in the sks field. 5013 */ 5014 ctl_set_internal_failure(&io->scsiio, 5015 /*sks_valid*/ 1, 5016 /*retry_count*/ 5017 io->io_hdr.port_status); |
5018 } 5019 |
5020 if (((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) || 5021 ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE && 5022 (io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) || 5023 ((io->io_hdr.flags & CTL_FLAG_ABORT) != 0)) { |
5024 /* 5025 * XXX KDM just assuming a single pointer here, and not a 5026 * S/G list. If we start using S/G lists for config data, 5027 * we'll need to know how to clean them up here as well. 5028 */ 5029 if (io->io_hdr.flags & CTL_FLAG_ALLOCATED) 5030 free(io->scsiio.kern_data_ptr, M_CTL); |
5031 ctl_done(io); |
5032 retval = CTL_RETVAL_COMPLETE; |
5033 } else { 5034 /* 5035 * XXX KDM now we need to continue data movement. Some 5036 * options: 5037 * - call ctl_scsiio() again? We don't do this for data 5038 * writes, because for those at least we know ahead of 5039 * time where the write will go and how long it is. For 5040 * config writes, though, that information is largely --- 6 unchanged lines hidden (view full) --- 5047 ctl_data_print(io); 5048 5049 /* 5050 * XXX KDM call ctl_scsiio() again for now, and check flag 5051 * bits to see whether we're allocated or not. 5052 */ 5053 retval = ctl_scsiio(&io->scsiio); 5054 } |
5055 return (retval); 5056} 5057 5058/* 5059 * This gets called by a backend driver when it is done with a 5060 * data_submit method. 5061 */ 5062void --- 129 unchanged lines hidden (view full) --- 5192 * released, though, by the initiator who made it or by one of 5193 * several reset type events. 5194 */ 5195 if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == residx)) 5196 lun->flags &= ~CTL_LUN_RESERVED; 5197 5198 mtx_unlock(&lun->lun_lock); 5199 |
5200 if (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) { 5201 free(ctsio->kern_data_ptr, M_CTL); 5202 ctsio->io_hdr.flags &= ~CTL_FLAG_ALLOCATED; 5203 } 5204 |
5205 ctl_set_success(ctsio); |
5206 ctl_done((union ctl_io *)ctsio); 5207 return (CTL_RETVAL_COMPLETE); 5208} 5209 5210int 5211ctl_scsi_reserve(struct ctl_scsiio *ctsio) 5212{ 5213 int extent, thirdparty, longid; --- 447 unchanged lines hidden (view full) --- 5661 } 5662 ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; 5663 } 5664 ctsio->kern_data_len = len; 5665 ctsio->kern_total_len = len; 5666 ctsio->kern_data_resid = 0; 5667 ctsio->kern_rel_offset = 0; 5668 ctsio->kern_sg_entries = 0; |
5669 ctl_set_success(ctsio); |
5670 ctsio->be_move_done = ctl_config_move_done; 5671 ctl_datamove((union ctl_io *)ctsio); |
5672 return (CTL_RETVAL_COMPLETE); 5673} 5674 5675int 5676ctl_write_buffer(struct ctl_scsiio *ctsio) 5677{ 5678 struct scsi_write_buffer *cdb; 5679 struct ctl_lun *lun; --- 46 unchanged lines hidden (view full) --- 5726 ctsio->kern_sg_entries = 0; 5727 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 5728 ctsio->be_move_done = ctl_config_move_done; 5729 ctl_datamove((union ctl_io *)ctsio); 5730 5731 return (CTL_RETVAL_COMPLETE); 5732 } 5733 |
5734 ctl_set_success(ctsio); |
5735 ctl_done((union ctl_io *)ctsio); |
5736 return (CTL_RETVAL_COMPLETE); 5737} 5738 5739int 5740ctl_write_same(struct ctl_scsiio *ctsio) 5741{ 5742 struct ctl_lun *lun; 5743 struct ctl_lba_len_flags *lbalen; --- 1106 unchanged lines hidden (view full) --- 6850 (page_index->page_len * pc), 6851 page_index->page_len); 6852 data_used += page_index->page_len; 6853 } 6854 break; 6855 } 6856 } 6857 |
6858 ctl_set_success(ctsio); |
6859 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 6860 ctsio->be_move_done = ctl_config_move_done; 6861 ctl_datamove((union ctl_io *)ctsio); |
6862 return (CTL_RETVAL_COMPLETE); 6863} 6864 6865int 6866ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio, 6867 struct ctl_page_index *page_index, 6868 int pc) 6869{ --- 133 unchanged lines hidden (view full) --- 7003 * Call the handler, if it exists, to update the 7004 * page to the latest values. 7005 */ 7006 if (page_index->sense_handler != NULL) 7007 page_index->sense_handler(ctsio, page_index, pc); 7008 7009 memcpy(header + 1, page_index->page_data, page_index->page_len); 7010 |
7011 ctl_set_success(ctsio); |
7012 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7013 ctsio->be_move_done = ctl_config_move_done; 7014 ctl_datamove((union ctl_io *)ctsio); |
7015 return (CTL_RETVAL_COMPLETE); 7016} 7017 7018int 7019ctl_read_capacity(struct ctl_scsiio *ctsio) 7020{ 7021 struct scsi_read_capacity *cdb; 7022 struct scsi_read_capacity_data *data; --- 38 unchanged lines hidden (view full) --- 7061 else 7062 scsi_ulto4b(lun->be_lun->maxlba, data->addr); 7063 7064 /* 7065 * XXX KDM this may not be 512 bytes... 7066 */ 7067 scsi_ulto4b(lun->be_lun->blocksize, data->length); 7068 |
7069 ctl_set_success(ctsio); |
7070 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7071 ctsio->be_move_done = ctl_config_move_done; 7072 ctl_datamove((union ctl_io *)ctsio); |
7073 return (CTL_RETVAL_COMPLETE); 7074} 7075 7076int 7077ctl_read_capacity_16(struct ctl_scsiio *ctsio) 7078{ 7079 struct scsi_read_capacity_16 *cdb; 7080 struct scsi_read_capacity_data_long *data; --- 41 unchanged lines hidden (view full) --- 7122 scsi_u64to8b(lun->be_lun->maxlba, data->addr); 7123 /* XXX KDM this may not be 512 bytes... */ 7124 scsi_ulto4b(lun->be_lun->blocksize, data->length); 7125 data->prot_lbppbe = lun->be_lun->pblockexp & SRC16_LBPPBE; 7126 scsi_ulto2b(lun->be_lun->pblockoff & SRC16_LALBA_A, data->lalba_lbp); 7127 if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) 7128 data->lalba_lbp[0] |= SRC16_LBPME | SRC16_LBPRZ; 7129 |
7130 ctl_set_success(ctsio); |
7131 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7132 ctsio->be_move_done = ctl_config_move_done; 7133 ctl_datamove((union ctl_io *)ctsio); |
7134 return (CTL_RETVAL_COMPLETE); 7135} 7136 7137int 7138ctl_read_defect(struct ctl_scsiio *ctsio) 7139{ 7140 struct scsi_read_defect_data_10 *ccb10; 7141 struct scsi_read_defect_data_12 *ccb12; --- 43 unchanged lines hidden (view full) --- 7185 } else { 7186 data12 = (struct scsi_read_defect_data_hdr_12 *) 7187 ctsio->kern_data_ptr; 7188 data12->format = format; 7189 scsi_ulto2b(0, data12->generation); 7190 scsi_ulto4b(0, data12->length); 7191 } 7192 |
7193 ctl_set_success(ctsio); |
7194 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7195 ctsio->be_move_done = ctl_config_move_done; 7196 ctl_datamove((union ctl_io *)ctsio); 7197 return (CTL_RETVAL_COMPLETE); 7198} 7199 7200int 7201ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) --- 126 unchanged lines hidden (view full) --- 7328 pc++; 7329 } 7330 tpg_desc->target_port_count = pc; 7331 tpg_desc = (struct scsi_target_port_group_descriptor *) 7332 &tpg_desc->descriptors[pc]; 7333 } 7334 mtx_unlock(&softc->ctl_lock); 7335 |
7336 ctl_set_success(ctsio); |
7337 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7338 ctsio->be_move_done = ctl_config_move_done; |
7339 ctl_datamove((union ctl_io *)ctsio); 7340 return(retval); 7341} 7342 7343int 7344ctl_report_supported_opcodes(struct ctl_scsiio *ctsio) 7345{ 7346 struct ctl_lun *lun; --- 147 unchanged lines hidden (view full) --- 7494 one->cdb_usage[0] = opcode; 7495 memcpy(&one->cdb_usage[1], entry->usage, 7496 entry->length - 1); 7497 } else 7498 one->support = 1; 7499 break; 7500 } 7501 |
7502 ctl_set_success(ctsio); |
7503 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7504 ctsio->be_move_done = ctl_config_move_done; |
7505 ctl_datamove((union ctl_io *)ctsio); 7506 return(retval); 7507} 7508 7509int 7510ctl_report_supported_tmf(struct ctl_scsiio *ctsio) 7511{ 7512 struct scsi_report_supported_tmf *cdb; --- 25 unchanged lines hidden (view full) --- 7538 } 7539 ctsio->kern_data_resid = 0; 7540 ctsio->kern_rel_offset = 0; 7541 7542 data = (struct scsi_report_supported_tmf_data *)ctsio->kern_data_ptr; 7543 data->byte1 |= RST_ATS | RST_ATSS | RST_CTSS | RST_LURS | RST_TRS; 7544 data->byte2 |= RST_ITNRS; 7545 |
7546 ctl_set_success(ctsio); |
7547 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7548 ctsio->be_move_done = ctl_config_move_done; |
7549 ctl_datamove((union ctl_io *)ctsio); 7550 return (retval); 7551} 7552 7553int 7554ctl_report_timestamp(struct ctl_scsiio *ctsio) 7555{ 7556 struct scsi_report_timestamp *cdb; --- 31 unchanged lines hidden (view full) --- 7588 data = (struct scsi_report_timestamp_data *)ctsio->kern_data_ptr; 7589 scsi_ulto2b(sizeof(*data) - 2, data->length); 7590 data->origin = RTS_ORIG_OUTSIDE; 7591 getmicrotime(&tv); 7592 timestamp = (int64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000; 7593 scsi_ulto4b(timestamp >> 16, data->timestamp); 7594 scsi_ulto2b(timestamp & 0xffff, &data->timestamp[4]); 7595 |
7596 ctl_set_success(ctsio); |
7597 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7598 ctsio->be_move_done = ctl_config_move_done; |
7599 ctl_datamove((union ctl_io *)ctsio); 7600 return (retval); 7601} 7602 7603int 7604ctl_persistent_reserve_in(struct ctl_scsiio *ctsio) 7605{ 7606 struct scsi_per_res_in *cdb; --- 248 unchanged lines hidden (view full) --- 7855 * This is a bug, because we just checked for this above, 7856 * and should have returned an error. 7857 */ 7858 panic("Invalid PR type %x", cdb->action); 7859 break; /* NOTREACHED */ 7860 } 7861 mtx_unlock(&lun->lun_lock); 7862 |
7863 ctl_set_success(ctsio); |
7864 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 7865 ctsio->be_move_done = ctl_config_move_done; |
7866 ctl_datamove((union ctl_io *)ctsio); |
7867 return (CTL_RETVAL_COMPLETE); 7868} 7869 7870/* 7871 * Returns 0 if ctl_persistent_reserve_out() should continue, non-zero if 7872 * it should return. 7873 */ 7874static int --- 1512 unchanged lines hidden (view full) --- 9387 * known logical units, so if the user asks for that, return none. 9388 */ 9389 scsi_ulto4b(lun_datalen - 8, lun_data->length); 9390 9391 /* 9392 * We can only return SCSI_STATUS_CHECK_COND when we can't satisfy 9393 * this request. 9394 */ |
9395 ctl_set_success(ctsio); |
9396 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9397 ctsio->be_move_done = ctl_config_move_done; 9398 ctl_datamove((union ctl_io *)ctsio); |
9399 return (retval); 9400} 9401 9402int 9403ctl_request_sense(struct ctl_scsiio *ctsio) 9404{ 9405 struct scsi_request_sense *cdb; 9406 struct scsi_sense_data *sense_ptr; --- 97 unchanged lines hidden (view full) --- 9504 9505 /* 9506 * We already have a pending error, return it. 9507 */ 9508 if (have_error != 0) { 9509 /* 9510 * We report the SCSI status as OK, since the status of the 9511 * request sense command itself is OK. |
9512 * We report 0 for the sense length, because we aren't doing 9513 * autosense in this case. We're reporting sense as 9514 * parameter data. 9515 */ |
9516 ctl_set_success(ctsio); |
9517 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9518 ctsio->be_move_done = ctl_config_move_done; 9519 ctl_datamove((union ctl_io *)ctsio); |
9520 return (CTL_RETVAL_COMPLETE); 9521 } 9522 9523no_sense: 9524 9525 /* 9526 * No sense information to report, so we report that everything is 9527 * okay. 9528 */ 9529 ctl_set_sense_data(sense_ptr, 9530 lun, 9531 sense_format, 9532 /*current_error*/ 1, 9533 /*sense_key*/ SSD_KEY_NO_SENSE, 9534 /*asc*/ 0x00, 9535 /*ascq*/ 0x00, 9536 SSD_ELEM_NONE); 9537 |
9538 /* 9539 * We report 0 for the sense length, because we aren't doing 9540 * autosense in this case. We're reporting sense as parameter data. 9541 */ |
9542 ctl_set_success(ctsio); |
9543 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9544 ctsio->be_move_done = ctl_config_move_done; 9545 ctl_datamove((union ctl_io *)ctsio); |
9546 return (CTL_RETVAL_COMPLETE); 9547} 9548 9549int 9550ctl_tur(struct ctl_scsiio *ctsio) 9551{ 9552 9553 CTL_DEBUG_PRINT(("ctl_tur\n")); --- 68 unchanged lines hidden (view full) --- 9622 pages->page_list[6] = SVPD_SCSI_TPC; 9623 /* Block limits */ 9624 pages->page_list[7] = SVPD_BLOCK_LIMITS; 9625 /* Block Device Characteristics */ 9626 pages->page_list[8] = SVPD_BDC; 9627 /* Logical Block Provisioning */ 9628 pages->page_list[9] = SVPD_LBP; 9629 |
9630 ctl_set_success(ctsio); |
9631 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9632 ctsio->be_move_done = ctl_config_move_done; 9633 ctl_datamove((union ctl_io *)ctsio); |
9634 return (CTL_RETVAL_COMPLETE); 9635} 9636 9637static int 9638ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len) 9639{ 9640 struct scsi_vpd_unit_serial_number *sn_ptr; 9641 struct ctl_lun *lun; --- 34 unchanged lines hidden (view full) --- 9676 * If we don't have a LUN, we just leave the serial number as 9677 * all spaces. 9678 */ 9679 if (lun != NULL) { 9680 strncpy((char *)sn_ptr->serial_num, 9681 (char *)lun->be_lun->serial_num, CTL_SN_LEN); 9682 } else 9683 memset(sn_ptr->serial_num, 0x20, CTL_SN_LEN); |
9684 |
9685 ctl_set_success(ctsio); |
9686 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9687 ctsio->be_move_done = ctl_config_move_done; 9688 ctl_datamove((union ctl_io *)ctsio); |
9689 return (CTL_RETVAL_COMPLETE); 9690} 9691 9692 9693static int 9694ctl_inquiry_evpd_eid(struct ctl_scsiio *ctsio, int alloc_len) 9695{ 9696 struct scsi_vpd_extended_inquiry_data *eid_ptr; --- 29 unchanged lines hidden (view full) --- 9726 lun->be_lun->lun_type; 9727 else 9728 eid_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; 9729 eid_ptr->page_code = SVPD_EXTENDED_INQUIRY_DATA; 9730 eid_ptr->page_length = data_len - 4; 9731 eid_ptr->flags2 = SVPD_EID_HEADSUP | SVPD_EID_ORDSUP | SVPD_EID_SIMPSUP; 9732 eid_ptr->flags3 = SVPD_EID_V_SUP; 9733 |
9734 ctl_set_success(ctsio); |
9735 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9736 ctsio->be_move_done = ctl_config_move_done; 9737 ctl_datamove((union ctl_io *)ctsio); |
9738 return (CTL_RETVAL_COMPLETE); 9739} 9740 9741static int 9742ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len) 9743{ 9744 struct scsi_vpd_mode_page_policy *mpp_ptr; 9745 struct ctl_lun *lun; --- 31 unchanged lines hidden (view full) --- 9777 else 9778 mpp_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; 9779 mpp_ptr->page_code = SVPD_MODE_PAGE_POLICY; 9780 scsi_ulto2b(data_len - 4, mpp_ptr->page_length); 9781 mpp_ptr->descr[0].page_code = 0x3f; 9782 mpp_ptr->descr[0].subpage_code = 0xff; 9783 mpp_ptr->descr[0].policy = SVPD_MPP_SHARED; 9784 |
9785 ctl_set_success(ctsio); |
9786 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9787 ctsio->be_move_done = ctl_config_move_done; 9788 ctl_datamove((union ctl_io *)ctsio); |
9789 return (CTL_RETVAL_COMPLETE); 9790} 9791 9792static int 9793ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len) 9794{ 9795 struct scsi_vpd_device_id *devid_ptr; 9796 struct scsi_vpd_id_descriptor *desc; --- 101 unchanged lines hidden (view full) --- 9898 9899 /* 9900 * This is for the Target identifier 9901 */ 9902 if (port->target_devid) { 9903 memcpy(desc, port->target_devid->data, port->target_devid->len); 9904 } 9905 |
9906 ctl_set_success(ctsio); |
9907 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 9908 ctsio->be_move_done = ctl_config_move_done; 9909 ctl_datamove((union ctl_io *)ctsio); |
9910 return (CTL_RETVAL_COMPLETE); 9911} 9912 9913static int 9914ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, int alloc_len) 9915{ 9916 struct ctl_softc *softc = control_softc; 9917 struct scsi_vpd_scsi_ports *sp; --- 94 unchanged lines hidden (view full) --- 10012 id_len = 0; 10013 scsi_ulto2b(id_len, pdc->target_port_descriptors_length); 10014 pd = (struct scsi_vpd_port_designation *) 10015 ((uint8_t *)pdc->target_port_descriptors + id_len); 10016 } 10017 } 10018 mtx_unlock(&softc->ctl_lock); 10019 |
10020 ctl_set_success(ctsio); |
10021 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 10022 ctsio->be_move_done = ctl_config_move_done; 10023 ctl_datamove((union ctl_io *)ctsio); |
10024 return (CTL_RETVAL_COMPLETE); 10025} 10026 10027static int 10028ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len) 10029{ 10030 struct scsi_vpd_block_limits *bl_ptr; 10031 struct ctl_lun *lun; --- 48 unchanged lines hidden (view full) --- 10080 } 10081 scsi_ulto4b(lun->be_lun->atomicblock, 10082 bl_ptr->max_atomic_transfer_length); 10083 scsi_ulto4b(0, bl_ptr->atomic_alignment); 10084 scsi_ulto4b(0, bl_ptr->atomic_transfer_length_granularity); 10085 } 10086 scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); 10087 |
10088 ctl_set_success(ctsio); |
10089 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 10090 ctsio->be_move_done = ctl_config_move_done; 10091 ctl_datamove((union ctl_io *)ctsio); |
10092 return (CTL_RETVAL_COMPLETE); 10093} 10094 10095static int 10096ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len) 10097{ 10098 struct scsi_vpd_block_device_characteristics *bdc_ptr; 10099 struct ctl_lun *lun; --- 40 unchanged lines hidden (view full) --- 10140 if (lun != NULL && 10141 (value = ctl_get_opt(&lun->be_lun->options, "formfactor")) != NULL) 10142 i = strtol(value, NULL, 0); 10143 else 10144 i = 0; 10145 bdc_ptr->wab_wac_ff = (i & 0x0f); 10146 bdc_ptr->flags = SVPD_FUAB | SVPD_VBULS; 10147 |
10148 ctl_set_success(ctsio); |
10149 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 10150 ctsio->be_move_done = ctl_config_move_done; 10151 ctl_datamove((union ctl_io *)ctsio); |
10152 return (CTL_RETVAL_COMPLETE); 10153} 10154 10155static int 10156ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len) 10157{ 10158 struct scsi_vpd_logical_block_prov *lbp_ptr; 10159 struct ctl_lun *lun; --- 32 unchanged lines hidden (view full) --- 10192 scsi_ulto2b(sizeof(*lbp_ptr) - 4, lbp_ptr->page_length); 10193 if (lun != NULL && lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { 10194 lbp_ptr->threshold_exponent = CTL_LBP_EXPONENT; 10195 lbp_ptr->flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 | 10196 SVPD_LBP_WS10 | SVPD_LBP_RZ | SVPD_LBP_ANC_SUP; 10197 lbp_ptr->prov_type = SVPD_LBP_THIN; 10198 } 10199 |
10200 ctl_set_success(ctsio); |
10201 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 10202 ctsio->be_move_done = ctl_config_move_done; 10203 ctl_datamove((union ctl_io *)ctsio); |
10204 return (CTL_RETVAL_COMPLETE); 10205} 10206 10207static int 10208ctl_inquiry_evpd(struct ctl_scsiio *ctsio) 10209{ 10210 struct scsi_inquiry *cdb; 10211 int alloc_len, retval; --- 283 unchanged lines hidden (view full) --- 10495 scsi_ulto2b(0x0600, inq_ptr->version4); 10496 break; 10497 case T_PROCESSOR: 10498 default: 10499 break; 10500 } 10501 } 10502 |
10503 ctl_set_success(ctsio); |
10504 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 10505 ctsio->be_move_done = ctl_config_move_done; 10506 ctl_datamove((union ctl_io *)ctsio); 10507 return (CTL_RETVAL_COMPLETE); 10508} 10509 10510int 10511ctl_inquiry(struct ctl_scsiio *ctsio) --- 2954 unchanged lines hidden (view full) --- 13466 } 13467 13468 mtx_lock(&lun->lun_lock); 13469 13470 /* 13471 * Check to see if we have any errors to inject here. We only 13472 * inject errors for commands that don't already have errors set. 13473 */ |
13474 if ((STAILQ_FIRST(&lun->error_list) != NULL) && 13475 ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) && 13476 ((io->io_hdr.flags & CTL_FLAG_STATUS_SENT) == 0)) |
13477 ctl_inject_error(lun, io); 13478 13479 /* 13480 * XXX KDM how do we treat commands that aren't completed 13481 * successfully? 13482 * 13483 * XXX KDM should we also track I/O latency? 13484 */ --- 693 unchanged lines hidden --- |