Lines Matching refs:dma_buff
188 struct mpi3mr_ioctl_mpt_dma_buffer *dma_buff = dma_buffers; in mpi3mr_app_construct_nvme_sgl() local
203 for (count = 0; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_construct_nvme_sgl()
204 if ((dma_buff->data_dir == MPI3MR_APP_DDI) || in mpi3mr_app_construct_nvme_sgl()
205 (dma_buff->data_dir == MPI3MR_APP_DDO)) { in mpi3mr_app_construct_nvme_sgl()
206 length = dma_buff->kern_buf_len; in mpi3mr_app_construct_nvme_sgl()
210 if (!length || !dma_buff->num_dma_desc) in mpi3mr_app_construct_nvme_sgl()
213 if (dma_buff->num_dma_desc == 1) { in mpi3mr_app_construct_nvme_sgl()
229 if (available_sges < dma_buff->num_dma_desc) in mpi3mr_app_construct_nvme_sgl()
233 size = dma_buff->num_dma_desc * sizeof(struct mpi3mr_nvme_pt_sge); in mpi3mr_app_construct_nvme_sgl()
240 for (i = 0; i < dma_buff->num_dma_desc; i++) { in mpi3mr_app_construct_nvme_sgl()
241 sgl_dma = htole64(dma_buff->dma_desc[i].dma_addr); in mpi3mr_app_construct_nvme_sgl()
252 nvme_sgl->length = htole32(dma_buff->dma_desc[i].size); in mpi3mr_app_construct_nvme_sgl()
274 struct mpi3mr_ioctl_mpt_dma_buffer *dma_buff = dma_buffers; in mpi3mr_app_build_nvme_prp() local
314 for (count = 0; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_build_nvme_prp()
315 if ((dma_buff->data_dir == MPI3MR_APP_DDI) || in mpi3mr_app_build_nvme_prp()
316 (dma_buff->data_dir == MPI3MR_APP_DDO)) { in mpi3mr_app_build_nvme_prp()
317 length = dma_buff->kern_buf_len; in mpi3mr_app_build_nvme_prp()
321 if (!length || !dma_buff->num_dma_desc) in mpi3mr_app_build_nvme_prp()
324 for (count = 0; count < dma_buff->num_dma_desc; count++) { in mpi3mr_app_build_nvme_prp()
325 dma_addr = dma_buff->dma_desc[count].dma_addr; in mpi3mr_app_build_nvme_prp()
333 dma_addr = dma_buff->dma_desc[0].dma_addr; in mpi3mr_app_build_nvme_prp()
334 desc_len = dma_buff->dma_desc[0].size; in mpi3mr_app_build_nvme_prp()
501 dma_buff->num_dma_desc) { in mpi3mr_app_build_nvme_prp()
507 dma_buff->dma_desc[desc_count].dma_addr; in mpi3mr_app_build_nvme_prp()
509 dma_buff->dma_desc[desc_count].size; in mpi3mr_app_build_nvme_prp()
630 struct mpi3mr_ioctl_mpt_dma_buffer *dma_buff = dma_buffers; in mpi3mr_app_construct_sgl() local
647 sgl_flags_last, dma_buff->kern_buf_len, in mpi3mr_app_construct_sgl()
648 dma_buff->kern_buf_dma); in mpi3mr_app_construct_sgl()
649 sgl = (U8 *) dma_buff->kern_buf + dma_buff->user_buf_len; in mpi3mr_app_construct_sgl()
650 available_sges = (dma_buff->kern_buf_len - in mpi3mr_app_construct_sgl()
651 dma_buff->user_buf_len) / sge_element_size; in mpi3mr_app_construct_sgl()
655 dma_buff++; in mpi3mr_app_construct_sgl()
659 sgl_flags_last, dma_buff->kern_buf_len, in mpi3mr_app_construct_sgl()
660 dma_buff->kern_buf_dma); in mpi3mr_app_construct_sgl()
661 dma_buff++; in mpi3mr_app_construct_sgl()
687 for (; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_construct_sgl()
688 if ((dma_buff->data_dir == MPI3MR_APP_DDN) || in mpi3mr_app_construct_sgl()
689 !dma_buff->num_dma_desc) in mpi3mr_app_construct_sgl()
692 dma_buff->dma_desc[0].size, in mpi3mr_app_construct_sgl()
693 dma_buff->dma_desc[0].dma_addr); in mpi3mr_app_construct_sgl()
701 for (; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_construct_sgl()
702 if (dma_buff->data_dir == MPI3MR_APP_DDN) in mpi3mr_app_construct_sgl()
704 if (!dma_buff->num_dma_desc) { in mpi3mr_app_construct_sgl()
720 for (; i < dma_buff->num_dma_desc; i++) { in mpi3mr_app_construct_sgl()
727 if (i == (dma_buff->num_dma_desc - 1)) { in mpi3mr_app_construct_sgl()
735 dma_buff->dma_desc[i].size, in mpi3mr_app_construct_sgl()
736 dma_buff->dma_desc[i].dma_addr); in mpi3mr_app_construct_sgl()
798 struct mpi3mr_ioctl_mpt_dma_buffer *dma_buffers = NULL, *dma_buff = NULL; in mpi3mr_app_mptcmds() local
870 dma_buff = dma_buffers; in mpi3mr_app_mptcmds()
871 for (count = 0; count < bufcnt; count++, buf_entries++, dma_buff++) { in mpi3mr_app_mptcmds()
872 memset(dma_buff, 0, sizeof(*dma_buff)); in mpi3mr_app_mptcmds()
873 dma_buff->user_buf = buf_entries->buffer; in mpi3mr_app_mptcmds()
874 dma_buff->user_buf_len = buf_entries->buf_len; in mpi3mr_app_mptcmds()
881 dma_buff->data_dir = MPI3MR_APP_DDO; in mpi3mr_app_mptcmds()
887 dma_buff->data_dir = MPI3MR_APP_DDI; in mpi3mr_app_mptcmds()
890 din_sz = dma_buff->user_buf_len; in mpi3mr_app_mptcmds()
894 dma_buff->data_dir = MPI3MR_APP_DDI; in mpi3mr_app_mptcmds()
897 dout_sz = dma_buff->user_buf_len; in mpi3mr_app_mptcmds()
901 dma_buff->data_dir = MPI3MR_APP_DDO; in mpi3mr_app_mptcmds()
905 dma_buff->data_dir = MPI3MR_APP_DDN; in mpi3mr_app_mptcmds()
911 dma_buff->data_dir = MPI3MR_APP_DDN; in mpi3mr_app_mptcmds()
956 dma_buff = dma_buffers; in mpi3mr_app_mptcmds()
957 for (count = 0; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_mptcmds()
959 dma_buff->kern_buf_len = dma_buff->user_buf_len; in mpi3mr_app_mptcmds()
962 dma_buff->kern_buf = sc->ioctl_chain_sge.addr; in mpi3mr_app_mptcmds()
963 dma_buff->kern_buf_len = sc->ioctl_chain_sge.size; in mpi3mr_app_mptcmds()
964 dma_buff->kern_buf_dma = sc->ioctl_chain_sge.dma_addr; in mpi3mr_app_mptcmds()
965 dma_buff->dma_desc = NULL; in mpi3mr_app_mptcmds()
966 dma_buff->num_dma_desc = 0; in mpi3mr_app_mptcmds()
967 memset(dma_buff->kern_buf, 0, dma_buff->kern_buf_len); in mpi3mr_app_mptcmds()
968 tmplen = min(dma_buff->kern_buf_len, dma_buff->user_buf_len); in mpi3mr_app_mptcmds()
969 if (copyin(dma_buff->user_buf, dma_buff->kern_buf, tmplen)) { in mpi3mr_app_mptcmds()
976 dma_buff->kern_buf = sc->ioctl_resp_sge.addr; in mpi3mr_app_mptcmds()
977 dma_buff->kern_buf_len = sc->ioctl_resp_sge.size; in mpi3mr_app_mptcmds()
978 dma_buff->kern_buf_dma = sc->ioctl_resp_sge.dma_addr; in mpi3mr_app_mptcmds()
979 dma_buff->dma_desc = NULL; in mpi3mr_app_mptcmds()
980 dma_buff->num_dma_desc = 0; in mpi3mr_app_mptcmds()
981 memset(dma_buff->kern_buf, 0, dma_buff->kern_buf_len); in mpi3mr_app_mptcmds()
982 tmplen = min(dma_buff->kern_buf_len, dma_buff->user_buf_len); in mpi3mr_app_mptcmds()
983 dma_buff->kern_buf_len = tmplen; in mpi3mr_app_mptcmds()
985 if (!dma_buff->kern_buf_len) in mpi3mr_app_mptcmds()
987 if (mpi3mr_map_data_buffer_dma(sc, dma_buff, desc_count)) { in mpi3mr_app_mptcmds()
993 desc_count += dma_buff->num_dma_desc; in mpi3mr_app_mptcmds()
1108 dma_buff = &dma_buffers[mpirep_offset]; in mpi3mr_app_mptcmds()
1109 dma_buff->kern_buf_len = (sizeof(*mpirepbuf) - 1 + in mpi3mr_app_mptcmds()
1111 mpirepbuf = malloc(dma_buff->kern_buf_len, M_MPI3MR, M_NOWAIT | M_ZERO); in mpi3mr_app_mptcmds()
1131 tmplen = min(dma_buff->kern_buf_len, dma_buff->user_buf_len); in mpi3mr_app_mptcmds()
1132 if (copyout(mpirepbuf, dma_buff->user_buf, tmplen)) { in mpi3mr_app_mptcmds()
1142 dma_buff = &dma_buffers[erb_offset]; in mpi3mr_app_mptcmds()
1143 tmplen = min(erbsz, dma_buff->user_buf_len); in mpi3mr_app_mptcmds()
1144 if (copyout(kern_erb, dma_buff->user_buf, tmplen)) { in mpi3mr_app_mptcmds()
1152 dma_buff = dma_buffers; in mpi3mr_app_mptcmds()
1153 for (count = 0; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_mptcmds()
1155 if (copyout(dma_buff->kern_buf, dma_buff->user_buf,dma_buff->kern_buf_len)) { in mpi3mr_app_mptcmds()
1161 } else if (dma_buff->data_dir == MPI3MR_APP_DDI) { in mpi3mr_app_mptcmds()
1163 for (desc_count = 0; desc_count < dma_buff->num_dma_desc; desc_count++) { in mpi3mr_app_mptcmds()
1164 if (copyout(dma_buff->dma_desc[desc_count].addr, in mpi3mr_app_mptcmds()
1165 (U8 *)dma_buff->user_buf+tmplen, in mpi3mr_app_mptcmds()
1166 dma_buff->dma_desc[desc_count].size)) { in mpi3mr_app_mptcmds()
1172 tmplen += dma_buff->dma_desc[desc_count].size; in mpi3mr_app_mptcmds()
1193 dma_buff = dma_buffers; in mpi3mr_app_mptcmds()
1194 for (count = 0; count < bufcnt; count++, dma_buff++) { in mpi3mr_app_mptcmds()
1195 free(dma_buff->dma_desc, M_MPI3MR); in mpi3mr_app_mptcmds()