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()
350 mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc) in mimd_to_kioc() argument
377 kioc->adapno = adapno; in mimd_to_kioc()
378 kioc->mb_type = MBOX_LEGACY; in mimd_to_kioc()
379 kioc->app_type = APPTYPE_MIMD; in mimd_to_kioc()
387 kioc->opcode = GET_ADAP_INFO; in mimd_to_kioc()
388 kioc->data_dir = UIOC_RD; in mimd_to_kioc()
389 kioc->xferlen = sizeof(mraid_hba_info_t); in mimd_to_kioc()
391 if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) in mimd_to_kioc()
404 kioc->opcode = MBOX_CMD; in mimd_to_kioc()
405 kioc->xferlen = mimd.ui.fcs.length; in mimd_to_kioc()
406 kioc->user_data_len = kioc->xferlen; in mimd_to_kioc()
407 kioc->user_data = mimd.ui.fcs.buffer; in mimd_to_kioc()
409 if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) in mimd_to_kioc()
412 if (mimd.outlen) kioc->data_dir = UIOC_RD; in mimd_to_kioc()
413 if (mimd.inlen) kioc->data_dir |= UIOC_WR; in mimd_to_kioc()
419 kioc->opcode = MBOX_CMD; in mimd_to_kioc()
420 kioc->xferlen = (mimd.outlen > mimd.inlen) ? in mimd_to_kioc()
422 kioc->user_data_len = kioc->xferlen; in mimd_to_kioc()
423 kioc->user_data = mimd.data; in mimd_to_kioc()
425 if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) in mimd_to_kioc()
428 if (mimd.outlen) kioc->data_dir = UIOC_RD; in mimd_to_kioc()
429 if (mimd.inlen) kioc->data_dir |= UIOC_WR; in mimd_to_kioc()
446 mbox64 = (mbox64_t *)((unsigned long)kioc->cmdbuf); in mimd_to_kioc()
452 mbox->xferaddr = (uint32_t)kioc->buf_paddr; in mimd_to_kioc()
454 if (kioc->data_dir & UIOC_WR) { in mimd_to_kioc()
455 if (copy_from_user(kioc->buf_vaddr, kioc->user_data, in mimd_to_kioc()
456 kioc->xferlen)) { in mimd_to_kioc()
470 pthru32 = kioc->pthru32; in mimd_to_kioc()
471 kioc->user_pthru = &umimd->pthru; in mimd_to_kioc()
472 mbox->xferaddr = (uint32_t)kioc->pthru32_h; in mimd_to_kioc()
474 if (copy_from_user(pthru32, kioc->user_pthru, in mimd_to_kioc()
479 pthru32->dataxferaddr = kioc->buf_paddr; in mimd_to_kioc()
480 if (kioc->data_dir & UIOC_WR) { in mimd_to_kioc()
481 if (pthru32->dataxferlen > kioc->xferlen) in mimd_to_kioc()
483 if (copy_from_user(kioc->buf_vaddr, kioc->user_data, in mimd_to_kioc()
504 mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen) in mraid_mm_attach_buf() argument
511 kioc->pool_index = -1; in mraid_mm_attach_buf()
512 kioc->buf_vaddr = NULL; in mraid_mm_attach_buf()
513 kioc->buf_paddr = 0; in mraid_mm_attach_buf()
514 kioc->free_buf = 0; in mraid_mm_attach_buf()
536 kioc->pool_index = i; in mraid_mm_attach_buf()
537 kioc->buf_vaddr = pool->vaddr; in mraid_mm_attach_buf()
538 kioc->buf_paddr = pool->paddr; in mraid_mm_attach_buf()
563 kioc->pool_index = right_pool; in mraid_mm_attach_buf()
564 kioc->free_buf = 1; in mraid_mm_attach_buf()
565 kioc->buf_vaddr = dma_pool_alloc(pool->handle, GFP_ATOMIC, in mraid_mm_attach_buf()
566 &kioc->buf_paddr); in mraid_mm_attach_buf()
569 if (!kioc->buf_vaddr) in mraid_mm_attach_buf()
586 uioc_t *kioc; in mraid_mm_alloc_kioc() local
604 kioc = list_entry(head->next, uioc_t, list); in mraid_mm_alloc_kioc()
605 list_del_init(&kioc->list); in mraid_mm_alloc_kioc()
609 memset((caddr_t)(unsigned long)kioc->cmdbuf, 0, sizeof(mbox64_t)); in mraid_mm_alloc_kioc()
610 memset((caddr_t) kioc->pthru32, 0, sizeof(mraid_passthru_t)); in mraid_mm_alloc_kioc()
612 kioc->buf_vaddr = NULL; in mraid_mm_alloc_kioc()
613 kioc->buf_paddr = 0; in mraid_mm_alloc_kioc()
614 kioc->pool_index =-1; in mraid_mm_alloc_kioc()
615 kioc->free_buf = 0; in mraid_mm_alloc_kioc()
616 kioc->user_data = NULL; in mraid_mm_alloc_kioc()
617 kioc->user_data_len = 0; in mraid_mm_alloc_kioc()
618 kioc->user_pthru = NULL; in mraid_mm_alloc_kioc()
619 kioc->timedout = 0; in mraid_mm_alloc_kioc()
621 return kioc; in mraid_mm_alloc_kioc()
630 mraid_mm_dealloc_kioc(mraid_mmadp_t *adp, uioc_t *kioc) in mraid_mm_dealloc_kioc() argument
635 if (kioc->pool_index != -1) { in mraid_mm_dealloc_kioc()
636 pool = &adp->dma_pool_list[kioc->pool_index]; in mraid_mm_dealloc_kioc()
648 if (kioc->free_buf == 1) in mraid_mm_dealloc_kioc()
649 dma_pool_free(pool->handle, kioc->buf_vaddr, in mraid_mm_dealloc_kioc()
650 kioc->buf_paddr); in mraid_mm_dealloc_kioc()
659 list_add(&kioc->list, &adp->kioc_pool); in mraid_mm_dealloc_kioc()
674 lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc) in lld_ioctl() argument
679 kioc->status = -ENODATA; in lld_ioctl()
680 rval = adp->issue_uioc(adp->drvr_data, kioc, IOCTL_ISSUE); in lld_ioctl()
688 timeout.uioc = kioc; in lld_ioctl()
700 wait_event(wait_q, (kioc->status != -ENODATA)); in lld_ioctl()
710 if (kioc->timedout) { in lld_ioctl()
714 return kioc->status; in lld_ioctl()
723 ioctl_done(uioc_t *kioc) in ioctl_done() argument
734 if (kioc->status == -ENODATA) { in ioctl_done()
738 kioc->status = -EINVAL; in ioctl_done()
746 if (kioc->timedout) { in ioctl_done()
749 adapno = kioc->adapno; in ioctl_done()
758 kioc->timedout = 0; in ioctl_done()
761 mraid_mm_dealloc_kioc( adapter, kioc ); in ioctl_done()
778 uioc_t *kioc = timeout->uioc; in lld_timedout() local
780 kioc->status = -ETIME; in lld_timedout()
781 kioc->timedout = 1; in lld_timedout()
795 kioc_to_mimd(uioc_t *kioc, mimd_t __user *mimd) in kioc_to_mimd() argument
820 kioc->buf_vaddr; in kioc_to_mimd()
836 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; in kioc_to_mimd()
838 if (kioc->user_pthru) { in kioc_to_mimd()
840 upthru32 = kioc->user_pthru; in kioc_to_mimd()
841 kpthru32 = kioc->pthru32; in kioc_to_mimd()
850 if (kioc->user_data) { in kioc_to_mimd()
851 if (copy_to_user(kioc->user_data, kioc->buf_vaddr, in kioc_to_mimd()
852 kioc->user_data_len)) { in kioc_to_mimd()
899 uioc_t *kioc; in mraid_mm_register_adp() local
960 kioc = adapter->kioc_list + i; in mraid_mm_register_adp()
961 kioc->cmdbuf = (uint64_t)(unsigned long)(mbox_list + i); in mraid_mm_register_adp()
962 kioc->pthru32 = dma_pool_alloc(adapter->pthru_dma_pool, in mraid_mm_register_adp()
963 GFP_KERNEL, &kioc->pthru32_h); in mraid_mm_register_adp()
965 if (!kioc->pthru32) { in mraid_mm_register_adp()
976 list_add_tail(&kioc->list, &adapter->kioc_pool); in mraid_mm_register_adp()
996 kioc = adapter->kioc_list + i; in mraid_mm_register_adp()
997 if (kioc->pthru32) { in mraid_mm_register_adp()
998 dma_pool_free(adapter->pthru_dma_pool, kioc->pthru32, in mraid_mm_register_adp()
999 kioc->pthru32_h); in mraid_mm_register_adp()
1146 uioc_t *kioc; in mraid_mm_free_adp_resources() local
1153 kioc = adp->kioc_list + i; in mraid_mm_free_adp_resources()
1155 dma_pool_free(adp->pthru_dma_pool, kioc->pthru32, in mraid_mm_free_adp_resources()
1156 kioc->pthru32_h); in mraid_mm_free_adp_resources()