Lines Matching refs:kioc

105 	uioc_t		*kioc;  in mraid_mm_ioctl()  local
174 kioc = mraid_mm_alloc_kioc(adp); in mraid_mm_ioctl()
175 if (!kioc) in mraid_mm_ioctl()
181 if ((rval = mimd_to_kioc(argp, adp, kioc))) { in mraid_mm_ioctl()
182 mraid_mm_dealloc_kioc(adp, kioc); in mraid_mm_ioctl()
186 kioc->done = ioctl_done; in mraid_mm_ioctl()
193 if ((rval = lld_ioctl(adp, kioc))) { in mraid_mm_ioctl()
195 if (!kioc->timedout) in mraid_mm_ioctl()
196 mraid_mm_dealloc_kioc(adp, kioc); in mraid_mm_ioctl()
204 rval = kioc_to_mimd(kioc, argp); in mraid_mm_ioctl()
209 mraid_mm_dealloc_kioc(adp, kioc); in mraid_mm_ioctl()
354 mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc) in mimd_to_kioc() argument
381 kioc->adapno = adapno; in mimd_to_kioc()
382 kioc->mb_type = MBOX_LEGACY; in mimd_to_kioc()
383 kioc->app_type = APPTYPE_MIMD; in mimd_to_kioc()
391 kioc->opcode = GET_ADAP_INFO; in mimd_to_kioc()
392 kioc->data_dir = UIOC_RD; in mimd_to_kioc()
393 kioc->xferlen = sizeof(mraid_hba_info_t); in mimd_to_kioc()
395 if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) in mimd_to_kioc()
408 kioc->opcode = MBOX_CMD; in mimd_to_kioc()
409 kioc->xferlen = mimd.ui.fcs.length; in mimd_to_kioc()
410 kioc->user_data_len = kioc->xferlen; in mimd_to_kioc()
411 kioc->user_data = mimd.ui.fcs.buffer; in mimd_to_kioc()
413 if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) in mimd_to_kioc()
416 if (mimd.outlen) kioc->data_dir = UIOC_RD; in mimd_to_kioc()
417 if (mimd.inlen) kioc->data_dir |= UIOC_WR; in mimd_to_kioc()
423 kioc->opcode = MBOX_CMD; in mimd_to_kioc()
424 kioc->xferlen = (mimd.outlen > mimd.inlen) ? in mimd_to_kioc()
426 kioc->user_data_len = kioc->xferlen; in mimd_to_kioc()
427 kioc->user_data = mimd.data; in mimd_to_kioc()
429 if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) in mimd_to_kioc()
432 if (mimd.outlen) kioc->data_dir = UIOC_RD; in mimd_to_kioc()
433 if (mimd.inlen) kioc->data_dir |= UIOC_WR; in mimd_to_kioc()
450 mbox64 = (mbox64_t *)((unsigned long)kioc->cmdbuf); in mimd_to_kioc()
456 mbox->xferaddr = (uint32_t)kioc->buf_paddr; in mimd_to_kioc()
458 if (kioc->data_dir & UIOC_WR) { in mimd_to_kioc()
459 if (copy_from_user(kioc->buf_vaddr, kioc->user_data, in mimd_to_kioc()
460 kioc->xferlen)) { in mimd_to_kioc()
474 pthru32 = kioc->pthru32; in mimd_to_kioc()
475 kioc->user_pthru = &umimd->pthru; in mimd_to_kioc()
476 mbox->xferaddr = (uint32_t)kioc->pthru32_h; in mimd_to_kioc()
478 if (copy_from_user(pthru32, kioc->user_pthru, in mimd_to_kioc()
483 pthru32->dataxferaddr = kioc->buf_paddr; in mimd_to_kioc()
484 if (kioc->data_dir & UIOC_WR) { in mimd_to_kioc()
485 if (pthru32->dataxferlen > kioc->xferlen) in mimd_to_kioc()
487 if (copy_from_user(kioc->buf_vaddr, kioc->user_data, in mimd_to_kioc()
508 mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen) in mraid_mm_attach_buf() argument
515 kioc->pool_index = -1; in mraid_mm_attach_buf()
516 kioc->buf_vaddr = NULL; in mraid_mm_attach_buf()
517 kioc->buf_paddr = 0; in mraid_mm_attach_buf()
518 kioc->free_buf = 0; in mraid_mm_attach_buf()
540 kioc->pool_index = i; in mraid_mm_attach_buf()
541 kioc->buf_vaddr = pool->vaddr; in mraid_mm_attach_buf()
542 kioc->buf_paddr = pool->paddr; in mraid_mm_attach_buf()
567 kioc->pool_index = right_pool; in mraid_mm_attach_buf()
568 kioc->free_buf = 1; in mraid_mm_attach_buf()
569 kioc->buf_vaddr = dma_pool_alloc(pool->handle, GFP_ATOMIC, in mraid_mm_attach_buf()
570 &kioc->buf_paddr); in mraid_mm_attach_buf()
573 if (!kioc->buf_vaddr) in mraid_mm_attach_buf()
590 uioc_t *kioc; in mraid_mm_alloc_kioc() local
608 kioc = list_entry(head->next, uioc_t, list); in mraid_mm_alloc_kioc()
609 list_del_init(&kioc->list); in mraid_mm_alloc_kioc()
613 memset((caddr_t)(unsigned long)kioc->cmdbuf, 0, sizeof(mbox64_t)); in mraid_mm_alloc_kioc()
614 memset((caddr_t) kioc->pthru32, 0, sizeof(mraid_passthru_t)); in mraid_mm_alloc_kioc()
616 kioc->buf_vaddr = NULL; in mraid_mm_alloc_kioc()
617 kioc->buf_paddr = 0; in mraid_mm_alloc_kioc()
618 kioc->pool_index =-1; in mraid_mm_alloc_kioc()
619 kioc->free_buf = 0; in mraid_mm_alloc_kioc()
620 kioc->user_data = NULL; in mraid_mm_alloc_kioc()
621 kioc->user_data_len = 0; in mraid_mm_alloc_kioc()
622 kioc->user_pthru = NULL; in mraid_mm_alloc_kioc()
623 kioc->timedout = 0; in mraid_mm_alloc_kioc()
625 return kioc; in mraid_mm_alloc_kioc()
634 mraid_mm_dealloc_kioc(mraid_mmadp_t *adp, uioc_t *kioc) in mraid_mm_dealloc_kioc() argument
639 if (kioc->pool_index != -1) { in mraid_mm_dealloc_kioc()
640 pool = &adp->dma_pool_list[kioc->pool_index]; in mraid_mm_dealloc_kioc()
652 if (kioc->free_buf == 1) in mraid_mm_dealloc_kioc()
653 dma_pool_free(pool->handle, kioc->buf_vaddr, in mraid_mm_dealloc_kioc()
654 kioc->buf_paddr); in mraid_mm_dealloc_kioc()
663 list_add(&kioc->list, &adp->kioc_pool); in mraid_mm_dealloc_kioc()
678 lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc) in lld_ioctl() argument
683 kioc->status = -ENODATA; in lld_ioctl()
684 rval = adp->issue_uioc(adp->drvr_data, kioc, IOCTL_ISSUE); in lld_ioctl()
692 timeout.uioc = kioc; in lld_ioctl()
704 wait_event(wait_q, (kioc->status != -ENODATA)); in lld_ioctl()
714 if (kioc->timedout) { in lld_ioctl()
718 return kioc->status; in lld_ioctl()
727 ioctl_done(uioc_t *kioc) in ioctl_done() argument
739 if (kioc->status == -ENODATA) { in ioctl_done()
743 kioc->status = -EINVAL; in ioctl_done()
751 if (kioc->timedout) { in ioctl_done()
754 adapno = kioc->adapno; in ioctl_done()
767 kioc->timedout = 0; in ioctl_done()
770 mraid_mm_dealloc_kioc( adapter, kioc ); in ioctl_done()
787 uioc_t *kioc = timeout->uioc; in lld_timedout() local
789 kioc->status = -ETIME; in lld_timedout()
790 kioc->timedout = 1; in lld_timedout()
804 kioc_to_mimd(uioc_t *kioc, mimd_t __user *mimd) in kioc_to_mimd() argument
829 kioc->buf_vaddr; in kioc_to_mimd()
845 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; in kioc_to_mimd()
847 if (kioc->user_pthru) { in kioc_to_mimd()
849 upthru32 = kioc->user_pthru; in kioc_to_mimd()
850 kpthru32 = kioc->pthru32; in kioc_to_mimd()
859 if (kioc->user_data) { in kioc_to_mimd()
860 if (copy_to_user(kioc->user_data, kioc->buf_vaddr, in kioc_to_mimd()
861 kioc->user_data_len)) { in kioc_to_mimd()
908 uioc_t *kioc; in mraid_mm_register_adp() local
969 kioc = adapter->kioc_list + i; in mraid_mm_register_adp()
970 kioc->cmdbuf = (uint64_t)(unsigned long)(mbox_list + i); in mraid_mm_register_adp()
971 kioc->pthru32 = dma_pool_alloc(adapter->pthru_dma_pool, in mraid_mm_register_adp()
972 GFP_KERNEL, &kioc->pthru32_h); in mraid_mm_register_adp()
974 if (!kioc->pthru32) { in mraid_mm_register_adp()
985 list_add_tail(&kioc->list, &adapter->kioc_pool); in mraid_mm_register_adp()
1005 kioc = adapter->kioc_list + i; in mraid_mm_register_adp()
1006 if (kioc->pthru32) { in mraid_mm_register_adp()
1007 dma_pool_free(adapter->pthru_dma_pool, kioc->pthru32, in mraid_mm_register_adp()
1008 kioc->pthru32_h); in mraid_mm_register_adp()
1155 uioc_t *kioc; in mraid_mm_free_adp_resources() local
1162 kioc = adp->kioc_list + i; in mraid_mm_free_adp_resources()
1164 dma_pool_free(adp->pthru_dma_pool, kioc->pthru32, in mraid_mm_free_adp_resources()
1165 kioc->pthru32_h); in mraid_mm_free_adp_resources()