Lines Matching refs:sgc
762 static u32 get_physaddr_from_sgc(struct esas2r_sg_context *sgc, u64 *addr) in get_physaddr_from_sgc() argument
766 if (likely(sgc->cur_offset == sgc->exp_offset)) { in get_physaddr_from_sgc()
772 if (sgc->sgel_count < sgc->num_sgel) { in get_physaddr_from_sgc()
774 if (sgc->exp_offset > (u8 *)0) { in get_physaddr_from_sgc()
776 sgc->cur_sgel = sg_next(sgc->cur_sgel); in get_physaddr_from_sgc()
777 ++(sgc->sgel_count); in get_physaddr_from_sgc()
781 len = sg_dma_len(sgc->cur_sgel); in get_physaddr_from_sgc()
782 (*addr) = sg_dma_address(sgc->cur_sgel); in get_physaddr_from_sgc()
785 sgc->exp_offset += len; in get_physaddr_from_sgc()
790 } else if (sgc->cur_offset < sgc->exp_offset) { in get_physaddr_from_sgc()
796 len = sg_dma_len(sgc->cur_sgel); in get_physaddr_from_sgc()
797 (*addr) = sg_dma_address(sgc->cur_sgel); in get_physaddr_from_sgc()
799 sgc->exp_offset -= len; in get_physaddr_from_sgc()
803 (sgc->cur_offset - sgc->exp_offset); in get_physaddr_from_sgc()
805 sgc->exp_offset += len; in get_physaddr_from_sgc()
809 sgc->exp_offset - sgc->cur_offset); in get_physaddr_from_sgc()
826 struct esas2r_sg_context sgc; in esas2r_queuecommand() local
861 esas2r_sgc_init(&sgc, a, rq, NULL); in esas2r_queuecommand()
863 sgc.length = bufflen; in esas2r_queuecommand()
864 sgc.cur_offset = NULL; in esas2r_queuecommand()
866 sgc.cur_sgel = scsi_sglist(cmd); in esas2r_queuecommand()
867 sgc.exp_offset = NULL; in esas2r_queuecommand()
868 sgc.num_sgel = scsi_dma_map(cmd); in esas2r_queuecommand()
869 sgc.sgel_count = 0; in esas2r_queuecommand()
871 if (unlikely(sgc.num_sgel < 0)) { in esas2r_queuecommand()
876 sgc.get_phys_addr = (PGETPHYSADDR)get_physaddr_from_sgc; in esas2r_queuecommand()
878 if (unlikely(!esas2r_build_sg_list(a, rq, &sgc))) { in esas2r_queuecommand()