2 * Support for Medifield PNW Camera Imaging ISP subsystem.
4 * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
6 * Copyright (c) 2010 Silicon Hive www.siliconhive.com.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #include <linux/kernel.h>
28 #include <linux/types.h>
29 #include <linux/slab.h>
32 #include "hmm/hmm_pool.h"
33 #include "ia_css_types.h"
35 #define HMM_CACHED true
36 #define HMM_UNCACHED false
38 int hmm_pool_register(unsigned int pool_size, enum hmm_pool_type pool_type);
39 void hmm_pool_unregister(enum hmm_pool_type pool_type);
42 void hmm_cleanup(void);
44 ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
45 int from_highmem, void *userptr, bool cached);
46 void hmm_free(ia_css_ptr ptr);
47 int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes);
48 int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes);
49 int hmm_set(ia_css_ptr virt, int c, unsigned int bytes);
50 int hmm_flush(ia_css_ptr virt, unsigned int bytes);
53 * get kernel memory physical address from ISP virtual address.
55 phys_addr_t hmm_virt_to_phys(ia_css_ptr virt);
58 * map ISP memory starts with virt to kernel virtual address
59 * by using vmap. return NULL if failed.
61 * virt must be the start address of ISP memory (return by hmm_alloc),
62 * do not pass any other address.
64 void *hmm_vmap(ia_css_ptr virt, bool cached);
65 void hmm_vunmap(ia_css_ptr virt);
68 * flush the cache for the vmapped buffer.
69 * if the buffer has not been vmapped, return directly.
71 void hmm_flush_vmap(ia_css_ptr virt);
74 * Address translation from ISP shared memory address to kernel virtual address
75 * if the memory is not vmmaped, then do it.
77 void *hmm_isp_vaddr_to_host_vaddr(ia_css_ptr ptr, bool cached);
80 * Address translation from kernel virtual address to ISP shared memory address
82 ia_css_ptr hmm_host_vaddr_to_hrt_vaddr(const void *ptr);
85 * map ISP memory starts with virt to specific vma.
87 * used for mmap operation.
89 * virt must be the start address of ISP memory (return by hmm_alloc),
90 * do not pass any other address.
92 int hmm_mmap(struct vm_area_struct *vma, ia_css_ptr virt);
94 /* show memory statistic
96 void hmm_show_mem_stat(const char *func, const int line);
98 /* init memory statistic
100 void hmm_init_mem_stat(int res_pgnr, int dyc_en, int dyc_pgnr);
102 extern bool dypool_enable;
103 extern unsigned int dypool_pgnr;
104 extern struct hmm_bo_device bo_device;