Lines Matching +full:smp +full:- +full:offset

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
6 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
96 ccb = isci_request->ccb; in isci_io_request_complete()
97 csio = &ccb->csio; in isci_io_request_complete()
98 ccb->ccb_h.status &= ~CAM_STATUS_MASK; in isci_io_request_complete()
103 if (ccb->ccb_h.func_code == XPT_SMP_IO) { in isci_io_request_complete()
106 isci_request->sci_object); in isci_io_request_complete()
108 memcpy(ccb->smpio.smp_response, smp_response, in isci_io_request_complete()
109 ccb->smpio.smp_response_len); in isci_io_request_complete()
111 ccb->ccb_h.status |= CAM_REQ_CMP; in isci_io_request_complete()
115 ccb->ccb_h.status |= CAM_REQ_CMP; in isci_io_request_complete()
116 ccb->csio.resid = ccb->csio.dxfer_len - in isci_io_request_complete()
118 isci_request->sci_object); in isci_io_request_complete()
129 isci_request->sci_object); in isci_io_request_complete()
132 response_buffer->sense_data_length); in isci_io_request_complete()
134 sense_length = MIN(csio->sense_len, sense_length); in isci_io_request_complete()
136 memcpy(&csio->sense_data, response_buffer->data, sense_length); in isci_io_request_complete()
138 csio->sense_resid = csio->sense_len - sense_length; in isci_io_request_complete()
139 csio->scsi_status = response_buffer->status; in isci_io_request_complete()
140 ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; in isci_io_request_complete()
141 ccb->ccb_h.status |= CAM_AUTOSNS_VALID; in isci_io_request_complete()
142 scsi_extract_sense( &csio->sense_data, &error_code, &sense_key, in isci_io_request_complete()
146 ccb->ccb_h.path_id, ccb->ccb_h.target_id, in isci_io_request_complete()
147 ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio), in isci_io_request_complete()
148 csio->scsi_status, sense_key, asc, ascq); in isci_io_request_complete()
154 ccb->ccb_h.status |= CAM_REQ_TERMIO; in isci_io_request_complete()
157 ccb->ccb_h.path_id, ccb->ccb_h.target_id, in isci_io_request_complete()
158 ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio)); in isci_io_request_complete()
162 ccb->ccb_h.status |= CAM_REQ_TERMIO; in isci_io_request_complete()
165 ccb->ccb_h.path_id, ccb->ccb_h.target_id, in isci_io_request_complete()
166 ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio)); in isci_io_request_complete()
175 ccb->ccb_h.status |= CAM_DEV_NOT_THERE; in isci_io_request_complete()
184 cam_sim_path(isci_controller->sim), in isci_io_request_complete()
185 isci_remote_device->index, 0); in isci_io_request_complete()
209 ccb->ccb_h.path_id, ccb->ccb_h.target_id, in isci_io_request_complete()
210 ccb->ccb_h.target_lun, scsiio_cdb_ptr(csio), in isci_io_request_complete()
212 ccb->ccb_h.status |= CAM_REQ_CMP_ERR; in isci_io_request_complete()
216 callout_stop(&isci_request->parent.timer); in isci_io_request_complete()
217 bus_dmamap_sync(isci_request->parent.dma_tag, in isci_io_request_complete()
218 isci_request->parent.dma_map, in isci_io_request_complete()
221 bus_dmamap_unload(isci_request->parent.dma_tag, in isci_io_request_complete()
222 isci_request->parent.dma_map); in isci_io_request_complete()
224 isci_request->ccb = NULL; in isci_io_request_complete()
226 sci_pool_put(isci_controller->request_pool, in isci_io_request_complete()
230 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { in isci_io_request_complete()
231 /* ccb will be completed with some type of non-success in isci_io_request_complete()
237 ccb->ccb_h.status |= CAM_DEV_QFRZN; in isci_io_request_complete()
238 xpt_freeze_devq(ccb->ccb_h.path, 1); in isci_io_request_complete()
241 if (ccb->ccb_h.status & CAM_SIM_QUEUED) { in isci_io_request_complete()
243 KASSERT(ccb == isci_remote_device->queued_ccb_in_progress, in isci_io_request_complete()
246 TAILQ_REMOVE(&isci_remote_device->queued_ccbs, in isci_io_request_complete()
247 &ccb->ccb_h, sim_links.tqe); in isci_io_request_complete()
248 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in isci_io_request_complete()
258 isci_remote_device->queued_ccb_in_progress = NULL; in isci_io_request_complete()
261 if (isci_remote_device->frozen_lun_mask != 0) { in isci_io_request_complete()
267 if (isci_controller->is_frozen == TRUE) { in isci_io_request_complete()
268 isci_controller->is_frozen = FALSE; in isci_io_request_complete()
269 xpt_release_simq(isci_controller->sim, TRUE); in isci_io_request_complete()
273 ccb->ccb_h.target_lun); in isci_io_request_complete()
275 if (ccb->ccb_h.status & CAM_SIM_QUEUED) { in isci_io_request_complete()
277 KASSERT(ccb == isci_remote_device->queued_ccb_in_progress, in isci_io_request_complete()
289 isci_remote_device->queued_ccb_in_progress = NULL; in isci_io_request_complete()
294 ccb->ccb_h.status |= CAM_SIM_QUEUED; in isci_io_request_complete()
296 TAILQ_INSERT_TAIL(&isci_remote_device->queued_ccbs, in isci_io_request_complete()
297 &ccb->ccb_h, sim_links.tqe); in isci_io_request_complete()
335 *physical_address = isci_request->physical_address + in scic_cb_io_request_get_physical_address()
336 (uintptr_t)virtual_address - in scic_cb_io_request_get_physical_address()
340 * internally by SCIL (i.e. for SMP requests or NCQ error in scic_cb_io_request_get_physical_address()
350 U64 virt_addr_offset = (uintptr_t)virtual_address - in scic_cb_io_request_get_physical_address()
351 (U64)isci_controller->uncached_controller_memory.virtual_address; in scic_cb_io_request_get_physical_address()
354 isci_controller->uncached_controller_memory.physical_address in scic_cb_io_request_get_physical_address()
375 return (scsiio_cdb_ptr(&isci_request->ccb->csio)); in scif_cb_io_request_get_cdb_address()
394 return (isci_request->ccb->csio.cdb_len); in scif_cb_io_request_get_cdb_length()
418 return (isci_request->ccb->ccb_h.target_lun); in scif_cb_io_request_get_lun()
444 if((isci_request->ccb->ccb_h.flags & CAM_TAG_ACTION_VALID) != 0) in scif_cb_io_request_get_task_attribute()
445 switch(isci_request->ccb->csio.tag_action) { in scif_cb_io_request_get_task_attribute()
501 * @param[in] byte_offset This parameter specifies the offset into the data
502 * buffers pointed to by the SGL. The byte offset starts at 0
518 ccb = isci_request->ccb; in scif_cb_io_request_get_virtual_address_from_sgl()
534 if ((ccb->ccb_h.flags & CAM_DATA_MASK) != CAM_DATA_VADDR) in scif_cb_io_request_get_virtual_address_from_sgl()
537 return (ccb->csio.data_ptr + byte_offset); in scif_cb_io_request_get_virtual_address_from_sgl()
557 return (isci_request->ccb->csio.dxfer_len); in scif_cb_io_request_get_transfer_length()
578 switch (isci_request->ccb->ccb_h.flags & CAM_DIR_MASK) { in scif_cb_io_request_get_data_direction()
590 * to where the next Scatter-Gather Element is located.
593 * - Regarding the first SGE: the user should initialize an index,
595 * reference the very first scatter-gather element. This is
596 * important since this method is called for every scatter-gather
598 * - Regarding the last SGE: the user should return NULL from this
619 if (isci_request->current_sge_index == isci_request->num_segments) in scif_cb_io_request_get_next_sge()
623 &isci_request->sge[isci_request->current_sge_index]; in scif_cb_io_request_get_next_sge()
625 isci_request->current_sge_index++; in scif_cb_io_request_get_next_sge()
632 * "address" field in the Scatter-Gather Element.
648 return ((SCI_PHYSICAL_ADDRESS)sge->ds_addr); in scif_cb_sge_get_address_field()
653 * "length" field in the Scatter-Gather Element.
669 return ((uint32_t)sge->ds_len); in scif_cb_sge_get_length_field()
678 request->controller_handle = scif_controller_handle; in isci_request_construct()
679 request->dma_tag = io_buffer_dma_tag; in isci_request_construct()
680 request->physical_address = physical_address; in isci_request_construct()
681 bus_dmamap_create(request->dma_tag, 0, &request->dma_map); in isci_request_construct()
682 callout_init(&request->timer, 1); in isci_request_construct()
691 SCI_REMOTE_DEVICE_HANDLE_T *device = io_request->parent.remote_device_handle; in isci_io_request_construct()
694 io_request->num_segments = nseg; in isci_io_request_construct()
695 io_request->sge = seg; in isci_io_request_construct()
696 ccb = io_request->ccb; in isci_io_request_construct()
699 ccb->ccb_h.status = CAM_REQ_INVALID; in isci_io_request_construct()
705 io_request->parent.controller_handle, in isci_io_request_construct()
706 io_request->parent.remote_device_handle, in isci_io_request_construct()
709 &io_request->sci_object); in isci_io_request_construct()
712 isci_io_request_complete(io_request->parent.controller_handle, in isci_io_request_construct()
717 sci_object_set_association(io_request->sci_object, io_request); in isci_io_request_construct()
719 bus_dmamap_sync(io_request->parent.dma_tag, io_request->parent.dma_map, in isci_io_request_construct()
723 io_request->parent.controller_handle, device, in isci_io_request_construct()
724 io_request->sci_object, SCI_CONTROLLER_INVALID_IO_TAG); in isci_io_request_construct()
727 isci_io_request_complete(io_request->parent.controller_handle, in isci_io_request_construct()
732 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) in isci_io_request_construct()
733 callout_reset_sbt(&io_request->parent.timer, in isci_io_request_construct()
734 SBT_1MS * ccb->ccb_h.timeout, 0, isci_io_request_timeout, in isci_io_request_construct()
742 target_id_t target_id = ccb->ccb_h.target_id; in isci_io_request_execute_scsi_io()
746 controller->remote_device[target_id]; in isci_io_request_execute_scsi_io()
750 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in isci_io_request_execute_scsi_io()
751 ccb->ccb_h.status &= ~CAM_STATUS_MASK; in isci_io_request_execute_scsi_io()
752 ccb->ccb_h.status |= CAM_DEV_NOT_THERE; in isci_io_request_execute_scsi_io()
757 if (sci_pool_empty(controller->request_pool)) { in isci_io_request_execute_scsi_io()
758 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in isci_io_request_execute_scsi_io()
759 ccb->ccb_h.status &= ~CAM_STATUS_MASK; in isci_io_request_execute_scsi_io()
760 ccb->ccb_h.status |= CAM_REQUEUE_REQ; in isci_io_request_execute_scsi_io()
761 xpt_freeze_simq(controller->sim, 1); in isci_io_request_execute_scsi_io()
762 controller->is_frozen = TRUE; in isci_io_request_execute_scsi_io()
767 ASSERT(device->is_resetting == FALSE); in isci_io_request_execute_scsi_io()
769 sci_pool_get(controller->request_pool, request); in isci_io_request_execute_scsi_io()
772 io_request->ccb = ccb; in isci_io_request_execute_scsi_io()
773 io_request->current_sge_index = 0; in isci_io_request_execute_scsi_io()
774 io_request->parent.remote_device_handle = device->sci_object; in isci_io_request_execute_scsi_io()
776 error = bus_dmamap_load_ccb(io_request->parent.dma_tag, in isci_io_request_execute_scsi_io()
777 io_request->parent.dma_map, ccb, in isci_io_request_execute_scsi_io()
784 xpt_freeze_simq(controller->sim, 1); in isci_io_request_execute_scsi_io()
785 ccb->ccb_h.flags |= CAM_RELEASE_SIMQ; in isci_io_request_execute_scsi_io()
794 sci_object_get_association(request->parent.remote_device_handle); in isci_io_request_timeout()
795 struct ISCI_CONTROLLER *controller = remote_device->domain->controller; in isci_io_request_timeout()
797 mtx_lock(&controller->lock); in isci_io_request_timeout()
799 mtx_unlock(&controller->lock); in isci_io_request_timeout()
804 * (if any) containing the request buffer for an SMP request.
807 * object associated with the SMP request.
809 * payload portion of the SMP request - i.e. everything after
810 * the SMP request header.
813 * the size of the SMP request header.
822 *smp_request_buffer = isci_request->ccb->smpio.smp_request + in smp_io_request_cb_get_request_buffer()
825 return (isci_request->ccb->smpio.smp_request_len - in smp_io_request_cb_get_request_buffer()
830 * @brief This callback method gets the SMP function for an SMP request.
833 * object associated with the SMP request.
835 * @return SMP function for the SMP request.
843 (SMP_REQUEST_HEADER_T *)isci_request->ccb->smpio.smp_request; in smp_io_request_cb_get_function()
845 return (header->function); in smp_io_request_cb_get_function()
849 * @brief This callback method gets the SMP frame type for an SMP request.
852 * object associated with the SMP request.
854 * @return SMP frame type for the SMP request.
862 (SMP_REQUEST_HEADER_T *)isci_request->ccb->smpio.smp_request; in smp_io_request_cb_get_frame_type()
864 return (header->smp_frame_type); in smp_io_request_cb_get_frame_type()
868 * @brief This callback method gets the allocated response length for an SMP request.
871 * object associated with the SMP request.
873 * @return Allocated response length for the SMP request.
882 (SMP_REQUEST_HEADER_T *)isci_request->ccb->smpio.smp_request; in smp_io_request_cb_get_allocated_response_length()
884 return (header->allocated_response_length); in smp_io_request_cb_get_allocated_response_length()
893 status = scif_request_construct(request->parent.controller_handle, in isci_smp_request_construct()
894 request->parent.remote_device_handle, SCI_CONTROLLER_INVALID_IO_TAG, in isci_smp_request_construct()
897 &request->sci_object); in isci_smp_request_construct()
909 /* create the smp passthrough part of the io request */ in isci_smp_request_construct()
911 scif_io_request_get_scic_handle(request->sci_object), in isci_smp_request_construct()
923 target_id_t target_id = ccb->ccb_h.target_id; in isci_io_request_execute_smp_io()
927 struct ISCI_REMOTE_DEVICE *end_device = controller->remote_device[target_id]; in isci_io_request_execute_smp_io()
929 /* SMP commands are sent to an end device, because SMP devices are not in isci_io_request_execute_smp_io()
931 * to get the SMP device that contains the specified end device. If in isci_io_request_execute_smp_io()
932 * the device is direct-attached, the handle will come back NULL, and in isci_io_request_execute_smp_io()
935 scif_remote_device_get_containing_device(end_device->sci_object, in isci_io_request_execute_smp_io()
939 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in isci_io_request_execute_smp_io()
940 ccb->ccb_h.status &= ~CAM_STATUS_MASK; in isci_io_request_execute_smp_io()
941 ccb->ccb_h.status |= CAM_DEV_NOT_THERE; in isci_io_request_execute_smp_io()
946 if (sci_pool_empty(controller->request_pool)) { in isci_io_request_execute_smp_io()
947 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; in isci_io_request_execute_smp_io()
948 ccb->ccb_h.status &= ~CAM_STATUS_MASK; in isci_io_request_execute_smp_io()
949 ccb->ccb_h.status |= CAM_REQUEUE_REQ; in isci_io_request_execute_smp_io()
950 xpt_freeze_simq(controller->sim, 1); in isci_io_request_execute_smp_io()
951 controller->is_frozen = TRUE; in isci_io_request_execute_smp_io()
956 ASSERT(device->is_resetting == FALSE); in isci_io_request_execute_smp_io()
958 sci_pool_get(controller->request_pool, request); in isci_io_request_execute_smp_io()
961 io_request->ccb = ccb; in isci_io_request_execute_smp_io()
962 io_request->parent.remote_device_handle = smp_device_handle; in isci_io_request_execute_smp_io()
967 isci_io_request_complete(controller->scif_controller_handle, in isci_io_request_execute_smp_io()
972 sci_object_set_association(io_request->sci_object, io_request); in isci_io_request_execute_smp_io()
975 controller->scif_controller_handle, smp_device_handle, in isci_io_request_execute_smp_io()
976 io_request->sci_object, SCI_CONTROLLER_INVALID_IO_TAG); in isci_io_request_execute_smp_io()
979 isci_io_request_complete(controller->scif_controller_handle, in isci_io_request_execute_smp_io()
984 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) in isci_io_request_execute_smp_io()
985 callout_reset_sbt(&io_request->parent.timer, in isci_io_request_execute_smp_io()
986 SBT_1MS * ccb->ccb_h.timeout, 0, isci_io_request_timeout, in isci_io_request_execute_smp_io()