2 * linux/drivers/media/video/samsung/mfc5x/mfc_buf.c
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
7 * Buffer manager for Samsung MFC (Multi Function Codec - FIMV) driver
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/slab.h>
15 #include <linux/spinlock.h>
17 #include <linux/err.h>
23 #include "mfc_errno.h"
25 #ifdef CONFIG_VIDEO_MFC_VCM_UMP
26 #include <plat/s5p-vcm.h>
28 #include "ump_kernel_interface.h"
29 #include "ump_kernel_interface_ref_drv.h"
30 #include "ump_kernel_interface_vcm.h"
34 #undef DEBUG_ALLOC_FREE
36 static struct list_head mfc_alloc_head[MFC_MAX_MEM_PORT_NUM];
37 /* The free node list sorted by real address */
38 static struct list_head mfc_free_head[MFC_MAX_MEM_PORT_NUM];
40 /* FIXME: test locking, add locking mechanisim */
42 static spinlock_t lock;
45 void mfc_print_buf(void)
48 struct list_head *pos;
49 struct mfc_alloc_buffer *alloc = NULL;
50 struct mfc_free_buffer *free = NULL;
53 for (port = 0; port < mfc_mem_count(); port++) {
54 mfc_dbg("---- port %d buffer list ----", port);
57 list_for_each(pos, &mfc_alloc_head[port]) {
58 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
59 mfc_dbg("[A #%04d] addr: 0x%08x, size: %d",
60 i, (unsigned int)alloc->addr, alloc->size);
61 mfc_dbg("\t real: 0x%08lx", alloc->real);
62 mfc_dbg("\t type: 0x%08x, owner: %d",
63 alloc->type, alloc->owner);
64 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
65 mfc_dbg("\t* vcm sysmmu");
67 mfc_dbg("\t start: 0x%08x, res_size : 0x%08x\n",
68 (unsigned int)alloc->vcm_s->res.start,
69 (unsigned int)alloc->vcm_s->res.res_size);
70 mfc_dbg("\t bound_size: 0x%08x\n",
71 (unsigned int)alloc->vcm_s->res.bound_size);
74 mfc_dbg("\t* vcm kernel");
76 mfc_dbg("\t start: 0x%08x, res_size : 0x%08x\n",
77 (unsigned int)alloc->vcm_k->start,
78 (unsigned int)alloc->vcm_k->res_size);
79 mfc_dbg("\t bound_size: 0x%08x\n",
80 (unsigned int)alloc->vcm_k->bound_size);
84 if (alloc->ump_handle) {
85 mfc_dbg("\t secure id: 0x%08x",
86 mfc_ump_get_id(alloc->ump_handle));
88 #elif defined(CONFIG_S5P_VMEM)
89 mfc_dbg("\t vmem cookie: 0x%08x addr: 0x%08lx, size: %d",
90 alloc->vmem_cookie, alloc->vmem_addr,
93 mfc_dbg("\t offset: 0x%08x", alloc->ofs);
99 list_for_each(pos, &mfc_free_head[port]) {
100 free = list_entry(pos, struct mfc_free_buffer, list);
101 mfc_dbg("[F #%04d] addr: 0x%08lx, size: %d",
102 i, free->real, free->size);
109 static int mfc_put_free_buf(unsigned int addr, int size, int port)
111 struct list_head *pos, *nxt;
112 struct mfc_free_buffer *free;
113 struct mfc_free_buffer *next = NULL;
114 struct mfc_free_buffer *prev;
115 /* 0x00: not merged, 0x01: prev merged, 0x02: next merged */
118 mfc_dbg("addr: 0x%08x, size: %d, port: %d\n", addr, size, port);
120 list_for_each_safe(pos, nxt, &mfc_free_head[port]) {
121 next = list_entry(pos, struct mfc_free_buffer, list);
124 * When the allocated address must be align without VMEM,
125 * the free buffer can be overlap
126 * previous free buffer temporaily
127 * Target buffer will be shrink after this operation
129 if (addr <= next->real) {
130 prev = list_entry(pos->prev, struct mfc_free_buffer, list);
132 mfc_dbg("prev->addr: 0x%08lx, size: %d", prev->real, prev->size);
133 /* merge previous free buffer */
134 if (prev && ((prev->real + prev->size) == addr)) {
141 mfc_dbg("auto merge free buffer[p]: addr: 0x%08lx, size: %d",
142 prev->real, prev->size);
145 mfc_dbg("next->addr: 0x%08lx, size: %d", next->real, next->size);
146 /* merge next free buffer */
147 if ((addr + size) == next->real) {
152 prev->size = next->size;
155 mfc_dbg("auto merge free buffer[n]: addr: 0x%08lx, size: %d",
156 next->real, next->size);
164 free = (struct mfc_free_buffer *)
165 kzalloc(sizeof(struct mfc_free_buffer), GFP_KERNEL);
167 if (unlikely(free == NULL))
173 list_add_tail(&free->list, pos);
176 /* bi-directional merged */
177 else if ((merged & 0x03) == 0x03) {
178 list_del(&next->list);
185 static unsigned int mfc_get_free_buf(int size, int align, int port)
187 struct list_head *pos, *nxt;
188 struct mfc_free_buffer *free;
189 struct mfc_free_buffer *match = NULL;
191 unsigned int addr = 0;
193 mfc_dbg("size: %d, align: %d, port: %d\n",
196 if (list_empty(&mfc_free_head[port])) {
197 mfc_err("no free node in mfc buffer\n");
202 /* find best fit area */
203 list_for_each_safe(pos, nxt, &mfc_free_head[port]) {
204 free = list_entry(pos, struct mfc_free_buffer, list);
206 #if (defined(CONFIG_VIDEO_MFC_VCM_UMP) || defined(CONFIG_S5P_VMEM))
208 * Align the start address.
209 * We assume the start address of free buffer aligned with 4KB
211 align_size = ALIGN(align_size + size, PAGE_SIZE) - size;
213 if (align > PAGE_SIZE) {
214 align_size = ALIGN(free->real, align) - free->real;
215 align_size += ALIGN(align_size + size, PAGE_SIZE) - size;
217 align_size = ALIGN(align_size + size, PAGE_SIZE) - size;
220 align_size = ALIGN(free->real, align) - free->real;
222 if (free->size >= (size + align_size)) {
224 if (free->size < match->size)
234 align_size = ALIGN(addr, align) - addr;
236 #if !(defined(CONFIG_VIDEO_MFC_VCM_UMP) || defined(CONFIG_S5P_VMEM))
237 if (align_size > 0) {
239 * When the allocated address must be align without VMEM,
240 * the free buffer can be overlap
241 * previous free buffer temporaily
243 if (mfc_put_free_buf(match->real, align_size, port) < 0)
247 /* change allocated buffer address & size */
248 match->real += (size + align_size);
249 match->size -= (size + align_size);
251 if (match->size == 0) {
252 list_del(&match->list);
256 mfc_err("no suitable free node in mfc buffer\n");
264 int mfc_init_buf(void)
269 for (port = 0; port < mfc_mem_count(); port++) {
270 INIT_LIST_HEAD(&mfc_alloc_head[port]);
271 INIT_LIST_HEAD(&mfc_free_head[port]);
273 ret = mfc_put_free_buf(mfc_mem_data_base(port),
274 mfc_mem_data_size(port), port);
278 spin_lock_init(&lock);
286 void mfc_final_buf(void)
288 struct list_head *pos, *nxt;
289 struct mfc_alloc_buffer *alloc;
290 struct mfc_free_buffer *free;
297 spin_lock_irqsave(&lock, flags);
300 for (port = 0; port < mfc_mem_count(); port++) {
301 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
302 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
303 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
304 if (alloc->ump_handle)
305 mfc_ump_unmap(alloc->ump_handle);
308 mfc_vcm_unmap(alloc->vcm_k);
311 mfc_vcm_unbind(alloc->vcm_s,
312 alloc->type & MBT_OTHER);
314 if (mfc_put_free_buf(alloc->vcm_addr,
315 alloc->vcm_size, port) < 0) {
317 mfc_err("failed to add free buffer\n");
319 list_del(&alloc->list);
322 #elif defined(CONFIG_S5P_VMEM)
323 if (alloc->vmem_cookie)
324 s5p_vfree(alloc->vmem_cookie);
326 if (mfc_put_free_buf(alloc->vmem_addr,
327 alloc->vmem_size, port) < 0) {
329 mfc_err("failed to add free buffer\n");
331 list_del(&alloc->list);
335 if (mfc_put_free_buf(alloc->real,
336 alloc->size, port) < 0) {
338 mfc_err("failed to add free buffer\n");
340 list_del(&alloc->list);
348 spin_unlock_irqrestore(&lock, flags);
354 spin_lock_irqsave(&lock, flags);
357 for (port = 0; port < mfc_mem_count(); port++) {
358 list_for_each_safe(pos, nxt, &mfc_free_head[port]) {
359 free = list_entry(pos, struct mfc_free_buffer, list);
360 list_del(&free->list);
366 spin_unlock_irqrestore(&lock, flags);
372 void mfc_merge_buf(void)
374 struct list_head *pos, *nxt;
375 struct mfc_free_buffer *n1;
376 struct mfc_free_buffer *n2;
379 for (port = 0; port < mfc_mem_count(); port++) {
380 list_for_each_safe(pos, nxt, &mfc_free_head[port]) {
381 n1 = list_entry(pos, struct mfc_free_buffer, list);
382 n2 = list_entry(nxt, struct mfc_free_buffer, list);
384 mfc_dbg("merge pre: n1: 0x%08lx, n2: 0x%08lx",
387 if (!list_is_last(pos, &mfc_free_head[port])) {
388 if ((n1->real + n1->size) == n2->real) {
390 n2->size += n1->size;
396 mfc_dbg("merge aft: n1: 0x%08lx, n2: 0x%08lx, last: %d",
398 list_is_last(pos, &mfc_free_head[port]));
402 #ifdef DEBUG_ALLOC_FREE
407 /* FIXME: port auto select, return values */
408 struct mfc_alloc_buffer *_mfc_alloc_buf(
409 struct mfc_inst_ctx *ctx, int size, int align, int flag)
412 struct mfc_alloc_buffer *alloc;
413 int port = flag & 0xFFFF;
414 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
416 struct ump_vcm ump_vcm;
417 #elif defined(CONFIG_S5P_VMEM)
427 alloc = (struct mfc_alloc_buffer *)
428 kzalloc(sizeof(struct mfc_alloc_buffer), GFP_KERNEL);
430 if (unlikely(alloc == NULL))
433 /* FIXME: right position? */
434 if (port > (mfc_mem_count() - 1))
435 port = mfc_mem_count() - 1;
438 spin_lock_irqsave(&lock, flags);
441 addr = mfc_get_free_buf(size, align, port);
443 mfc_dbg("mfc_get_free_buf: 0x%08x\n", addr);
446 mfc_dbg("cannot get suitable free buffer\n");
447 /* FIXME: is it need?
448 mfc_put_free_buf(addr, size, port);
452 spin_unlock_irqrestore(&lock, flags);
458 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
459 if (align > PAGE_SIZE) {
460 align_size = ALIGN(addr, align) - addr;
461 align_size += ALIGN(align_size + size, PAGE_SIZE) - size;
463 align_size = ALIGN(align_size + size, PAGE_SIZE) - size;
466 alloc->vcm_s = mfc_vcm_bind(addr, size + align_size);
467 if (IS_ERR(alloc->vcm_s)) {
468 mfc_put_free_buf(addr, size, port);
473 return PTR_ERR(alloc->vcm_s);
477 if (flag & MBT_KERNEL) {
478 alloc->vcm_k = mfc_vcm_map(alloc->vcm_s->res.phys);
479 if (IS_ERR(alloc->vcm_k)) {
480 mfc_vcm_unbind(alloc->vcm_s,
481 alloc->type & MBT_OTHER);
482 mfc_put_free_buf(addr, size, port);
487 return PTR_ERR(alloc->vcm_k);
492 if (flag & MBT_USER) {
493 ump_vcm.vcm = alloc->vcm_s->res.vcm;
494 ump_vcm.vcm_res = &(alloc->vcm_s->res);
495 ump_vcm.dev_id = VCM_DEV_MFC;
497 alloc->ump_handle = mfc_ump_map(alloc->vcm_s->res.phys, (unsigned long)&ump_vcm);
498 if (IS_ERR(alloc->ump_handle)) {
499 mfc_vcm_unmap(alloc->vcm_k);
500 mfc_vcm_unbind(alloc->vcm_s,
501 alloc->type & MBT_OTHER);
502 mfc_put_free_buf(addr, size, port);
507 return PTR_ERR(alloc->vcm_k);
512 alloc->vcm_addr = addr;
513 alloc->vcm_size = size + align_size;
514 #elif defined(CONFIG_S5P_VMEM)
515 if (align > PAGE_SIZE) {
516 align_size = ALIGN(addr, align) - addr;
517 align_size += ALIGN(align_size + size, PAGE_SIZE) - size;
519 align_size = ALIGN(align_size + size, PAGE_SIZE) - size;
522 alloc->vmem_cookie = s5p_vmem_vmemmap(size + align_size,
523 addr, addr + (size + align_size));
525 if (!alloc->vmem_cookie) {
526 mfc_dbg("cannot map free buffer to memory\n");
527 mfc_put_free_buf(addr, size, port);
533 alloc->vmem_addr = addr;
534 alloc->vmem_size = size + align_size;
536 alloc->real = ALIGN(addr, align);
539 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
541 alloc->addr = (unsigned char *)alloc->vcm_k->start;
544 #elif defined(CONFIG_S5P_VMEM)
545 alloc->addr = (unsigned char *)(mfc_mem_addr(port) +
546 mfc_mem_base_ofs(alloc->real));
548 alloc->addr = (unsigned char *)(mfc_mem_addr(port) +
549 mfc_mem_base_ofs(alloc->real));
551 alloc->user = (unsigned char *)(ctx->userbase +
552 mfc_mem_data_ofs(alloc->real, 1));
554 alloc->ofs = mfc_mem_data_ofs(alloc->real, 1);
556 alloc->type = flag & 0xFFFF0000;
557 alloc->owner = ctx->id;
559 list_add(&alloc->list, &mfc_alloc_head[port]);
562 spin_unlock_irqrestore(&lock, flags);
565 #ifdef DEBUG_ALLOC_FREE
572 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
573 unsigned int mfc_vcm_bind_from_others(struct mfc_inst_ctx *ctx,
574 struct mfc_buf_alloc_arg *args, int flag)
577 unsigned int addr, size;
578 unsigned int secure_id = args->secure_id;
579 int port = flag & 0xFFFF;
581 struct vcm_res *vcm_res;
582 struct vcm_mmu_res *s_res;
583 struct mfc_alloc_buffer *alloc;
585 ump_dd_handle ump_mem;
587 /* FIXME: right position? */
588 if (port > (mfc_mem_count() - 1))
589 port = mfc_mem_count() - 1;
591 ump_mem = ump_dd_handle_create_from_secure_id(secure_id);
592 ump_dd_reference_add(ump_mem);
594 vcm_res = (struct vcm_res *)
595 ump_dd_meminfo_get(secure_id, (void*)VCM_DEV_MFC);
597 mfc_dbg("%s: Failed to get vcm_res\n", __func__);
601 size = vcm_res->bound_size;
603 alloc = (struct mfc_alloc_buffer *)
604 kzalloc(sizeof(struct mfc_alloc_buffer), GFP_KERNEL);
606 mfc_dbg("%s: Failed to get mfc_alloc_buffer\n", __func__);
610 addr = mfc_get_free_buf(size, ALIGN_2KB, port);
612 mfc_dbg("cannot get suitable free buffer\n");
615 mfc_dbg("mfc_get_free_buf: 0x%08x\n", addr);
617 s_res = kzalloc(sizeof(struct vcm_mmu_res), GFP_KERNEL);
619 mfc_dbg("%s: Failed to get vcm_mmu_res\n", __func__);
623 s_res->res.start = addr;
624 s_res->res.res_size = size;
625 s_res->res.vcm = ctx->dev->vcm_info.sysmmu_vcm;
626 INIT_LIST_HEAD(&s_res->bound);
628 ret = vcm_bind(&s_res->res, vcm_res->phys);
630 mfc_dbg("%s: Failed to vcm_bind\n", __func__);
634 alloc->vcm_s = s_res;
635 alloc->vcm_addr = addr;
636 alloc->ump_handle = ump_mem;
637 alloc->vcm_size = size;
640 alloc->type = flag & 0xFFFF0000;
641 alloc->owner = ctx->id;
643 list_add(&alloc->list, &mfc_alloc_head[port]);
659 mfc_alloc_buf(struct mfc_inst_ctx *ctx, struct mfc_buf_alloc_arg *args, int flag)
661 struct mfc_alloc_buffer *alloc;
663 alloc = _mfc_alloc_buf(ctx, args->size, args->align, flag);
665 if (unlikely(alloc == NULL))
666 return MFC_MEM_ALLOC_FAIL;
668 args->phys = (unsigned int)alloc->real;
670 args->addr = (unsigned int)alloc->addr;
671 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
672 if (alloc->ump_handle)
673 args->secure_id = mfc_ump_get_id(alloc->ump_handle);
674 #elif defined(CONFIG_S5P_VMEM)
675 args->cookie = (unsigned int)alloc->vmem_cookie;
677 args->offset = alloc->ofs;
682 int _mfc_free_buf(unsigned long real)
684 struct list_head *pos, *nxt;
685 struct mfc_alloc_buffer *alloc;
692 mfc_dbg("addr: 0x%08lx\n", real);
695 spin_lock_irqsave(&lock, flags);
698 for (port = 0; port < mfc_mem_count(); port++) {
699 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
700 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
702 if (alloc->real == real) {
704 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
705 if (alloc->ump_handle)
706 mfc_ump_unmap(alloc->ump_handle);
709 mfc_vcm_unmap(alloc->vcm_k);
712 mfc_vcm_unbind(alloc->vcm_s,
713 alloc->type & MBT_OTHER);
715 if (mfc_put_free_buf(alloc->vcm_addr,
716 alloc->vcm_size, port) < 0) {
718 mfc_err("failed to add free buffer\n");
720 list_del(&alloc->list);
723 #elif defined(CONFIG_S5P_VMEM)
724 if (alloc->vmem_cookie)
725 s5p_vfree(alloc->vmem_cookie);
727 if (mfc_put_free_buf(alloc->vmem_addr,
728 alloc->vmem_size, port) < 0) {
730 mfc_err("failed to add free buffer\n");
732 list_del(&alloc->list);
736 if (mfc_put_free_buf(alloc->real,
737 alloc->size, port) < 0) {
739 mfc_err("failed to add free buffer\n");
741 list_del(&alloc->list);
754 spin_unlock_irqrestore(&lock, flags);
757 #ifdef DEBUG_ALLOC_FREE
767 int mfc_free_buf(struct mfc_inst_ctx *ctx, unsigned int key)
771 real = mfc_get_buf_real(ctx->id, key);
772 if (unlikely(real == 0))
773 return MFC_MEM_INVALID_ADDR_FAIL;
775 if (_mfc_free_buf(real) < 0)
776 return MFC_MEM_INVALID_ADDR_FAIL;
781 void mfc_free_buf_type(int owner, int type)
784 struct list_head *pos, *nxt;
785 struct mfc_alloc_buffer *alloc;
787 for (port = 0; port < mfc_mem_count(); port++) {
788 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
789 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
791 if ((alloc->owner == owner) && (alloc->type == type)) {
792 if (mfc_put_free_buf(alloc->real,
793 alloc->size, port) < 0) {
795 mfc_err("failed to add free buffer\n");
797 list_del(&alloc->list);
805 /* FIXME: add MFC Buffer Type */
806 void mfc_free_buf_inst(int owner)
808 struct list_head *pos, *nxt;
810 struct mfc_alloc_buffer *alloc;
815 mfc_dbg("owner: %d\n", owner);
818 spin_lock_irqsave(&lock, flags);
821 for (port = 0; port < mfc_mem_count(); port++) {
822 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
823 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
825 if (alloc->owner == owner) {
826 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
827 if (alloc->ump_handle)
828 mfc_ump_unmap(alloc->ump_handle);
831 mfc_vcm_unmap(alloc->vcm_k);
834 mfc_vcm_unbind(alloc->vcm_s,
835 alloc->type & MBT_OTHER);
837 if (mfc_put_free_buf(alloc->vcm_addr,
838 alloc->vcm_size, port) < 0) {
840 mfc_err("failed to add free buffer\n");
842 list_del(&alloc->list);
845 #elif defined(CONFIG_S5P_VMEM)
846 if (alloc->vmem_cookie)
847 s5p_vfree(alloc->vmem_cookie);
849 if (mfc_put_free_buf(alloc->vmem_addr,
850 alloc->vmem_size, port) < 0) {
852 mfc_err("failed to add free buffer\n");
854 list_del(&alloc->list);
858 if (mfc_put_free_buf(alloc->real,
859 alloc->size, port) < 0) {
861 mfc_err("failed to add free buffer\n");
863 list_del(&alloc->list);
872 spin_unlock_irqrestore(&lock, flags);
875 #ifdef DEBUG_ALLOC_FREE
880 unsigned long mfc_get_buf_real(int owner, unsigned int key)
882 struct list_head *pos, *nxt;
884 struct mfc_alloc_buffer *alloc;
886 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
887 mfc_dbg("owner: %d, secure id: 0x%08x\n", owner, key);
888 #elif defined(CONFIG_S5P_VMEM)
889 mfc_dbg("owner: %d, cookie: 0x%08x\n", owner, key);
891 mfc_dbg("owner: %d, offset: 0x%08x\n", owner, key);
894 for (port = 0; port < mfc_mem_count(); port++) {
895 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
896 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
898 if (alloc->owner == owner) {
899 #if defined(CONFIG_VIDEO_MFC_VCM_UMP)
900 if (alloc->ump_handle) {
901 if (mfc_ump_get_id(alloc->ump_handle) == key)
904 #elif defined(CONFIG_S5P_VMEM)
905 if (alloc->vmem_cookie == key)
908 if (alloc->ofs == key)
919 unsigned char *mfc_get_buf_addr(int owner, unsigned char *user)
921 struct list_head *pos, *nxt;
923 struct mfc_alloc_buffer *alloc;
925 mfc_dbg("owner: %d, user: 0x%08x\n", owner, (unsigned int)user);
927 for (port = 0; port < mfc_mem_count(); port++) {
928 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
929 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
931 if ((alloc->owner == owner)
932 && (alloc->user == user)){
942 unsigned char *_mfc_get_buf_addr(int owner, unsigned char *user)
944 struct list_head *pos, *nxt;
946 struct mfc_alloc_buffer *alloc;
948 mfc_dbg("owner: %d, user: 0x%08x\n", owner, (unsigned int)user);
950 for (port = 0; port < mfc_mem_count(); port++) {
951 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
952 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
954 if ((alloc->owner == owner)
955 && ((alloc->user <= user) || ((alloc->user + alloc->size) > user))){
966 #ifdef CONFIG_VIDEO_MFC_VCM_UMP
967 void *mfc_get_buf_ump_handle(unsigned long real)
969 struct list_head *pos, *nxt;
971 struct mfc_alloc_buffer *alloc;
973 mfc_dbg("real: 0x%08lx\n", real);
975 for (port = 0; port < mfc_mem_count(); port++) {
976 list_for_each_safe(pos, nxt, &mfc_alloc_head[port]) {
977 alloc = list_entry(pos, struct mfc_alloc_buffer, list);
979 if (alloc->real == real)
980 return alloc->ump_handle;