Lines Matching refs:cfile

43 static void genwqe_add_file(struct genwqe_dev *cd, struct genwqe_file *cfile)  in genwqe_add_file()  argument
47 cfile->opener = get_pid(task_tgid(current)); in genwqe_add_file()
49 list_add(&cfile->list, &cd->file_list); in genwqe_add_file()
53 static int genwqe_del_file(struct genwqe_dev *cd, struct genwqe_file *cfile) in genwqe_del_file() argument
58 list_del(&cfile->list); in genwqe_del_file()
60 put_pid(cfile->opener); in genwqe_del_file()
65 static void genwqe_add_pin(struct genwqe_file *cfile, struct dma_mapping *m) in genwqe_add_pin() argument
69 spin_lock_irqsave(&cfile->pin_lock, flags); in genwqe_add_pin()
70 list_add(&m->pin_list, &cfile->pin_list); in genwqe_add_pin()
71 spin_unlock_irqrestore(&cfile->pin_lock, flags); in genwqe_add_pin()
74 static int genwqe_del_pin(struct genwqe_file *cfile, struct dma_mapping *m) in genwqe_del_pin() argument
78 spin_lock_irqsave(&cfile->pin_lock, flags); in genwqe_del_pin()
80 spin_unlock_irqrestore(&cfile->pin_lock, flags); in genwqe_del_pin()
94 static struct dma_mapping *genwqe_search_pin(struct genwqe_file *cfile, in genwqe_search_pin() argument
102 spin_lock_irqsave(&cfile->pin_lock, flags); in genwqe_search_pin()
104 list_for_each_entry(m, &cfile->pin_list, pin_list) { in genwqe_search_pin()
112 spin_unlock_irqrestore(&cfile->pin_lock, flags); in genwqe_search_pin()
116 spin_unlock_irqrestore(&cfile->pin_lock, flags); in genwqe_search_pin()
120 static void __genwqe_add_mapping(struct genwqe_file *cfile, in __genwqe_add_mapping() argument
125 spin_lock_irqsave(&cfile->map_lock, flags); in __genwqe_add_mapping()
126 list_add(&dma_map->card_list, &cfile->map_list); in __genwqe_add_mapping()
127 spin_unlock_irqrestore(&cfile->map_lock, flags); in __genwqe_add_mapping()
130 static void __genwqe_del_mapping(struct genwqe_file *cfile, in __genwqe_del_mapping() argument
135 spin_lock_irqsave(&cfile->map_lock, flags); in __genwqe_del_mapping()
137 spin_unlock_irqrestore(&cfile->map_lock, flags); in __genwqe_del_mapping()
150 static struct dma_mapping *__genwqe_search_mapping(struct genwqe_file *cfile, in __genwqe_search_mapping() argument
158 struct pci_dev *pci_dev = cfile->cd->pci_dev; in __genwqe_search_mapping()
160 spin_lock_irqsave(&cfile->map_lock, flags); in __genwqe_search_mapping()
161 list_for_each_entry(m, &cfile->map_list, card_list) { in __genwqe_search_mapping()
176 spin_unlock_irqrestore(&cfile->map_lock, flags); in __genwqe_search_mapping()
180 spin_unlock_irqrestore(&cfile->map_lock, flags); in __genwqe_search_mapping()
189 static void genwqe_remove_mappings(struct genwqe_file *cfile) in genwqe_remove_mappings() argument
194 struct genwqe_dev *cd = cfile->cd; in genwqe_remove_mappings()
195 struct pci_dev *pci_dev = cfile->cd->pci_dev; in genwqe_remove_mappings()
197 list_for_each_safe(node, next, &cfile->map_list) { in genwqe_remove_mappings()
228 static void genwqe_remove_pinnings(struct genwqe_file *cfile) in genwqe_remove_pinnings() argument
232 struct genwqe_dev *cd = cfile->cd; in genwqe_remove_pinnings()
234 list_for_each_safe(node, next, &cfile->pin_list) { in genwqe_remove_pinnings()
262 struct genwqe_file *cfile; in genwqe_kill_fasync() local
265 list_for_each_entry(cfile, &cd->file_list, list) { in genwqe_kill_fasync()
266 if (cfile->async_queue) in genwqe_kill_fasync()
267 kill_fasync(&cfile->async_queue, sig, POLL_HUP); in genwqe_kill_fasync()
278 struct genwqe_file *cfile; in genwqe_terminate() local
281 list_for_each_entry(cfile, &cd->file_list, list) { in genwqe_terminate()
282 kill_pid(cfile->opener, SIGKILL, 1); in genwqe_terminate()
302 struct genwqe_file *cfile; in genwqe_open() local
304 cfile = kzalloc(sizeof(*cfile), GFP_KERNEL); in genwqe_open()
305 if (cfile == NULL) in genwqe_open()
309 cfile->cd = cd; in genwqe_open()
310 cfile->filp = filp; in genwqe_open()
311 cfile->client = NULL; in genwqe_open()
313 spin_lock_init(&cfile->map_lock); /* list of raw memory allocations */ in genwqe_open()
314 INIT_LIST_HEAD(&cfile->map_list); in genwqe_open()
316 spin_lock_init(&cfile->pin_lock); /* list of user pinned memory */ in genwqe_open()
317 INIT_LIST_HEAD(&cfile->pin_list); in genwqe_open()
319 filp->private_data = cfile; in genwqe_open()
321 genwqe_add_file(cd, cfile); in genwqe_open()
359 struct genwqe_file *cfile = (struct genwqe_file *)filp->private_data; in genwqe_release() local
360 struct genwqe_dev *cd = cfile->cd; in genwqe_release()
363 genwqe_remove_mappings(cfile); in genwqe_release()
364 genwqe_remove_pinnings(cfile); in genwqe_release()
374 genwqe_del_file(cd, cfile); in genwqe_release()
375 kfree(cfile); in genwqe_release()
399 struct genwqe_file *cfile = vma->vm_private_data; in genwqe_vma_close() local
401 dma_map = __genwqe_search_mapping(cfile, vma->vm_start, vsize, in genwqe_vma_close()
410 __genwqe_del_mapping(cfile, dma_map); in genwqe_vma_close()
439 struct genwqe_file *cfile = (struct genwqe_file *)filp->private_data; in genwqe_mmap() local
440 struct genwqe_dev *cd = cfile->cd; in genwqe_mmap()
478 vma->vm_private_data = cfile; in genwqe_mmap()
480 __genwqe_add_mapping(cfile, dma_map); in genwqe_mmap()
502 static int do_flash_update(struct genwqe_file *cfile, in do_flash_update() argument
514 struct genwqe_dev *cd = cfile->cd; in do_flash_update()
515 struct file *filp = cfile->filp; in do_flash_update()
639 static int do_flash_read(struct genwqe_file *cfile, in do_flash_read() argument
649 struct genwqe_dev *cd = cfile->cd; in do_flash_read()
650 struct file *filp = cfile->filp; in do_flash_read()
769 static int genwqe_pin_mem(struct genwqe_file *cfile, struct genwqe_mem *m) in genwqe_pin_mem() argument
772 struct genwqe_dev *cd = cfile->cd; in genwqe_pin_mem()
773 struct pci_dev *pci_dev = cfile->cd->pci_dev; in genwqe_pin_mem()
799 genwqe_add_pin(cfile, dma_map); in genwqe_pin_mem()
803 static int genwqe_unpin_mem(struct genwqe_file *cfile, struct genwqe_mem *m) in genwqe_unpin_mem() argument
805 struct genwqe_dev *cd = cfile->cd; in genwqe_unpin_mem()
816 dma_map = genwqe_search_pin(cfile, map_addr, map_size, NULL); in genwqe_unpin_mem()
820 genwqe_del_pin(cfile, dma_map); in genwqe_unpin_mem()
833 static int ddcb_cmd_cleanup(struct genwqe_file *cfile, struct ddcb_requ *req) in ddcb_cmd_cleanup() argument
837 struct genwqe_dev *cd = cfile->cd; in ddcb_cmd_cleanup()
843 __genwqe_del_mapping(cfile, dma_map); in ddcb_cmd_cleanup()
862 static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req) in ddcb_cmd_fixups() argument
866 struct genwqe_dev *cd = cfile->cd; in ddcb_cmd_fixups()
903 m = __genwqe_search_mapping(cfile, u_addr, u_size, in ddcb_cmd_fixups()
935 m = genwqe_search_pin(cfile, u_addr, u_size, NULL); in ddcb_cmd_fixups()
953 __genwqe_add_mapping(cfile, m); in ddcb_cmd_fixups()
980 ddcb_cmd_cleanup(cfile, req); in ddcb_cmd_fixups()
993 static int genwqe_execute_ddcb(struct genwqe_file *cfile, in genwqe_execute_ddcb() argument
997 struct genwqe_dev *cd = cfile->cd; in genwqe_execute_ddcb()
998 struct file *filp = cfile->filp; in genwqe_execute_ddcb()
1001 rc = ddcb_cmd_fixups(cfile, req); in genwqe_execute_ddcb()
1006 ddcb_cmd_cleanup(cfile, req); in genwqe_execute_ddcb()
1010 static int do_execute_ddcb(struct genwqe_file *cfile, in do_execute_ddcb() argument
1015 struct genwqe_dev *cd = cfile->cd; in do_execute_ddcb()
1016 struct file *filp = cfile->filp; in do_execute_ddcb()
1028 rc = genwqe_execute_ddcb(cfile, cmd); in do_execute_ddcb()
1056 struct genwqe_file *cfile = (struct genwqe_file *)filp->private_data; in genwqe_ioctl() local
1057 struct genwqe_dev *cd = cfile->cd; in genwqe_ioctl()
1163 rc = do_flash_update(cfile, &load); in genwqe_ioctl()
1183 rc = do_flash_read(cfile, &load); in genwqe_ioctl()
1198 return genwqe_pin_mem(cfile, &m); in genwqe_ioctl()
1207 return genwqe_unpin_mem(cfile, &m); in genwqe_ioctl()
1212 return do_execute_ddcb(cfile, arg, 0); in genwqe_ioctl()
1219 return do_execute_ddcb(cfile, arg, 1); in genwqe_ioctl()