Lines Matching refs:cm

404 mpi_init_sge(struct mps_command *cm, void *req, void *sge)  in mpi_init_sge()  argument
408 space = (int)cm->cm_sc->reqframesz; in mpi_init_sge()
414 cm->cm_sge = sge; in mpi_init_sge()
415 cm->cm_sglsize = space - off; in mpi_init_sge()
422 mpi_pre_ioc_facts(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_ioc_facts() argument
424 MPI2_IOC_FACTS_REQUEST *req = (void *)cm->cm_req; in mpi_pre_ioc_facts()
432 cm->cm_sge = NULL; in mpi_pre_ioc_facts()
433 cm->cm_sglsize = 0; in mpi_pre_ioc_facts()
441 mpi_pre_port_facts(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_port_facts() argument
443 MPI2_PORT_FACTS_REQUEST *req = (void *)cm->cm_req; in mpi_pre_port_facts()
451 cm->cm_sge = NULL; in mpi_pre_port_facts()
452 cm->cm_sglsize = 0; in mpi_pre_port_facts()
460 mpi_pre_fw_download(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_fw_download() argument
462 MPI2_FW_DOWNLOAD_REQUEST *req = (void *)cm->cm_req; in mpi_pre_fw_download()
475 error = copyin(cmd->buf, cm->cm_data, cmd->len); in mpi_pre_fw_download()
479 mpi_init_sge(cm, req, &req->SGL); in mpi_pre_fw_download()
499 cm->cm_flags |= MPS_CM_FLAGS_DATAOUT; in mpi_pre_fw_download()
501 return (mps_push_sge(cm, &tc, sizeof tc, 0)); in mpi_pre_fw_download()
508 mpi_pre_fw_upload(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_fw_upload() argument
510 MPI2_FW_UPLOAD_REQUEST *req = (void *)cm->cm_req; in mpi_pre_fw_upload()
519 mpi_init_sge(cm, req, &req->SGL); in mpi_pre_fw_upload()
535 cm->cm_flags |= MPS_CM_FLAGS_DATAIN; in mpi_pre_fw_upload()
537 return (mps_push_sge(cm, &tc, sizeof tc, 0)); in mpi_pre_fw_upload()
544 mpi_pre_sata_passthrough(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_sata_passthrough() argument
546 MPI2_SATA_PASSTHROUGH_REQUEST *req = (void *)cm->cm_req; in mpi_pre_sata_passthrough()
554 mpi_init_sge(cm, req, &req->SGL); in mpi_pre_sata_passthrough()
562 mpi_pre_smp_passthrough(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_smp_passthrough() argument
564 MPI2_SMP_PASSTHROUGH_REQUEST *req = (void *)cm->cm_req; in mpi_pre_smp_passthrough()
572 mpi_init_sge(cm, req, &req->SGL); in mpi_pre_smp_passthrough()
580 mpi_pre_config(struct mps_command *cm, struct mps_usr_command *cmd) in mpi_pre_config() argument
582 MPI2_CONFIG_REQUEST *req = (void *)cm->cm_req; in mpi_pre_config()
590 mpi_init_sge(cm, req, &req->PageBufferSGE); in mpi_pre_config()
598 mpi_pre_sas_io_unit_control(struct mps_command *cm, in mpi_pre_sas_io_unit_control() argument
602 cm->cm_sge = NULL; in mpi_pre_sas_io_unit_control()
603 cm->cm_sglsize = 0; in mpi_pre_sas_io_unit_control()
627 mps_user_setup_request(struct mps_command *cm, struct mps_usr_command *cmd) in mps_user_setup_request() argument
629 MPI2_REQUEST_HEADER *hdr = (MPI2_REQUEST_HEADER *)cm->cm_req; in mps_user_setup_request()
634 return (f->f_pre(cm, cmd)); in mps_user_setup_request()
645 struct mps_command *cm = NULL; in mps_user_command() local
650 cm = mps_alloc_command(sc); in mps_user_command()
652 if (cm == NULL) { in mps_user_command()
659 hdr = (MPI2_REQUEST_HEADER *)cm->cm_req; in mps_user_command()
677 cm->cm_data = buf; in mps_user_command()
678 cm->cm_length = cmd->len; in mps_user_command()
680 cm->cm_data = NULL; in mps_user_command()
681 cm->cm_length = 0; in mps_user_command()
684 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE; in mps_user_command()
685 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_user_command()
687 err = mps_user_setup_request(cm, cmd); in mps_user_command()
697 err = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_user_command()
699 if (err || (cm == NULL)) { in mps_user_command()
705 rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; in mps_user_command()
726 if (cm != NULL) in mps_user_command()
727 mps_free_command(sc, cm); in mps_user_command()
739 struct mps_command *cm = NULL; in mps_user_pass_thru() local
815 cm = mpssas_alloc_tm(sc); in mps_user_pass_thru()
816 if (cm == NULL) { in mps_user_pass_thru()
822 task = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; in mps_user_pass_thru()
824 task->TaskMID = cm->cm_desc.Default.SMID; in mps_user_pass_thru()
826 cm->cm_data = NULL; in mps_user_pass_thru()
827 cm->cm_complete = NULL; in mps_user_pass_thru()
828 cm->cm_complete_data = NULL; in mps_user_pass_thru()
838 mpssas_prepare_for_tm(sc, cm, targ, CAM_LUN_WILDCARD); in mps_user_pass_thru()
839 err = mps_wait_command(sc, &cm, 30, CAN_SLEEP); in mps_user_pass_thru()
850 if (err == 0 && cm != NULL && cm->cm_reply != NULL) { in mps_user_pass_thru()
851 rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; in mps_user_pass_thru()
860 err = copyout(cm->cm_reply, PTRIN(data->PtrReply), in mps_user_pass_thru()
867 mpssas_free_tm(sc, cm); in mps_user_pass_thru()
872 cm = mps_alloc_command(sc); in mps_user_pass_thru()
873 if (cm == NULL) { in mps_user_pass_thru()
880 hdr = (MPI2_REQUEST_HEADER *)cm->cm_req; in mps_user_pass_thru()
887 mpi_init_sge(cm, hdr, (void *)((uint8_t *)hdr + data->RequestSize)); in mps_user_pass_thru()
898 cm->cm_data = NULL; in mps_user_pass_thru()
899 cm->cm_length = MAX(data->DataSize, data->DataOutSize); in mps_user_pass_thru()
900 cm->cm_out_len = data->DataOutSize; in mps_user_pass_thru()
901 cm->cm_flags = 0; in mps_user_pass_thru()
902 if (cm->cm_length != 0) { in mps_user_pass_thru()
903 cm->cm_data = malloc(cm->cm_length, M_MPSUSER, M_WAITOK | in mps_user_pass_thru()
905 cm->cm_flags = MPS_CM_FLAGS_DATAIN; in mps_user_pass_thru()
907 cm->cm_flags |= MPS_CM_FLAGS_DATAOUT; in mps_user_pass_thru()
909 cm->cm_data, data->DataOutSize); in mps_user_pass_thru()
912 cm->cm_flags = MPS_CM_FLAGS_DATAOUT; in mps_user_pass_thru()
914 cm->cm_data, data->DataSize); in mps_user_pass_thru()
920 cm->cm_flags |= MPS_CM_FLAGS_SGE_SIMPLE; in mps_user_pass_thru()
921 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_user_pass_thru()
940 scsi_io_req->SenseBufferLowAddress = htole32(cm->cm_sense_busaddr); in mps_user_pass_thru()
956 cm->cm_desc.SCSIIO.RequestFlags = in mps_user_pass_thru()
958 cm->cm_desc.SCSIIO.DevHandle = scsi_io_req->DevHandle; in mps_user_pass_thru()
973 err = mps_wait_command(sc, &cm, 30, CAN_SLEEP); in mps_user_pass_thru()
975 if (err || (cm == NULL)) { in mps_user_pass_thru()
985 if (cm->cm_data != NULL) { in mps_user_pass_thru()
986 if (cm->cm_flags & MPS_CM_FLAGS_DATAIN) in mps_user_pass_thru()
988 else if (cm->cm_flags & MPS_CM_FLAGS_DATAOUT) in mps_user_pass_thru()
990 bus_dmamap_sync(sc->buffer_dmat, cm->cm_dmamap, dir); in mps_user_pass_thru()
991 bus_dmamap_unload(sc->buffer_dmat, cm->cm_dmamap); in mps_user_pass_thru()
993 if (cm->cm_flags & MPS_CM_FLAGS_DATAIN) { in mps_user_pass_thru()
995 err = copyout(cm->cm_data, in mps_user_pass_thru()
1007 if (err == 0 && cm->cm_reply != NULL) { in mps_user_pass_thru()
1008 rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; in mps_user_pass_thru()
1017 err = copyout(cm->cm_reply, PTRIN(data->PtrReply), in mps_user_pass_thru()
1034 err = copyout(cm->cm_sense, (PTRIN(data->PtrReply + in mps_user_pass_thru()
1049 if (cm != NULL) { in mps_user_pass_thru()
1050 if (cm->cm_data) in mps_user_pass_thru()
1051 free(cm->cm_data, M_MPSUSER); in mps_user_pass_thru()
1052 mps_free_command(sc, cm); in mps_user_pass_thru()
1154 struct mps_command *cm = NULL; in mps_post_fw_diag_buffer() local
1175 cm = mps_alloc_command(sc); in mps_post_fw_diag_buffer()
1176 if (cm == NULL) { in mps_post_fw_diag_buffer()
1184 req = (MPI2_DIAG_BUFFER_POST_REQUEST *)cm->cm_req; in mps_post_fw_diag_buffer()
1192 cm->cm_data = NULL; in mps_post_fw_diag_buffer()
1193 cm->cm_length = 0; in mps_post_fw_diag_buffer()
1194 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_post_fw_diag_buffer()
1195 cm->cm_complete_data = NULL; in mps_post_fw_diag_buffer()
1200 status = mps_wait_command(sc, &cm, 30, CAN_SLEEP); in mps_post_fw_diag_buffer()
1201 if (status || (cm == NULL)) { in mps_post_fw_diag_buffer()
1211 reply = (MPI2_DIAG_BUFFER_POST_REPLY *)cm->cm_reply; in mps_post_fw_diag_buffer()
1238 if (cm != NULL) in mps_post_fw_diag_buffer()
1239 mps_free_command(sc, cm); in mps_post_fw_diag_buffer()
1250 struct mps_command *cm = NULL; in mps_release_fw_diag_buffer() local
1273 cm = mps_alloc_command(sc); in mps_release_fw_diag_buffer()
1274 if (cm == NULL) { in mps_release_fw_diag_buffer()
1282 req = (MPI2_DIAG_RELEASE_REQUEST *)cm->cm_req; in mps_release_fw_diag_buffer()
1285 cm->cm_data = NULL; in mps_release_fw_diag_buffer()
1286 cm->cm_length = 0; in mps_release_fw_diag_buffer()
1287 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_release_fw_diag_buffer()
1288 cm->cm_complete_data = NULL; in mps_release_fw_diag_buffer()
1293 status = mps_wait_command(sc, &cm, 30, CAN_SLEEP); in mps_release_fw_diag_buffer()
1294 if (status || (cm == NULL)) { in mps_release_fw_diag_buffer()
1304 reply = (MPI2_DIAG_RELEASE_REPLY *)cm->cm_reply; in mps_release_fw_diag_buffer()
1335 if (cm != NULL) in mps_release_fw_diag_buffer()
1336 mps_free_command(sc, cm); in mps_release_fw_diag_buffer()