]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h
media: staging: atomisp: Remove FSF snail address
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / include / hmm / hmm.h
CommitLineData
a49d2536
AC
1/*
2 * Support for Medifield PNW Camera Imaging ISP subsystem.
3 *
4 * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
5 *
6 * Copyright (c) 2010 Silicon Hive www.siliconhive.com.
7 *
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.
11 *
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.
16 *
a49d2536
AC
17 *
18 */
19
20#ifndef __HMM_H__
21#define __HMM_H__
22
23#include <linux/kernel.h>
24#include <linux/types.h>
25#include <linux/slab.h>
26#include <linux/mm.h>
27
28#include "hmm/hmm_pool.h"
29#include "ia_css_types.h"
30
31#define HMM_CACHED true
32#define HMM_UNCACHED false
33
34int hmm_pool_register(unsigned int pool_size, enum hmm_pool_type pool_type);
35void hmm_pool_unregister(enum hmm_pool_type pool_type);
36
37int hmm_init(void);
38void hmm_cleanup(void);
39
40ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
41 int from_highmem, void *userptr, bool cached);
42void hmm_free(ia_css_ptr ptr);
43int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes);
44int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes);
45int hmm_set(ia_css_ptr virt, int c, unsigned int bytes);
46int hmm_flush(ia_css_ptr virt, unsigned int bytes);
47
48/*
49 * get kernel memory physical address from ISP virtual address.
50 */
51phys_addr_t hmm_virt_to_phys(ia_css_ptr virt);
52
53/*
54 * map ISP memory starts with virt to kernel virtual address
55 * by using vmap. return NULL if failed.
56 *
57 * virt must be the start address of ISP memory (return by hmm_alloc),
58 * do not pass any other address.
59 */
60void *hmm_vmap(ia_css_ptr virt, bool cached);
61void hmm_vunmap(ia_css_ptr virt);
62
63/*
64 * flush the cache for the vmapped buffer.
65 * if the buffer has not been vmapped, return directly.
66 */
67void hmm_flush_vmap(ia_css_ptr virt);
68
69/*
70 * Address translation from ISP shared memory address to kernel virtual address
71 * if the memory is not vmmaped, then do it.
72 */
73void *hmm_isp_vaddr_to_host_vaddr(ia_css_ptr ptr, bool cached);
74
75/*
76 * Address translation from kernel virtual address to ISP shared memory address
77 */
78ia_css_ptr hmm_host_vaddr_to_hrt_vaddr(const void *ptr);
79
80/*
81 * map ISP memory starts with virt to specific vma.
82 *
83 * used for mmap operation.
84 *
85 * virt must be the start address of ISP memory (return by hmm_alloc),
86 * do not pass any other address.
87 */
88int hmm_mmap(struct vm_area_struct *vma, ia_css_ptr virt);
89
90/* show memory statistic
91 */
92void hmm_show_mem_stat(const char *func, const int line);
93
94/* init memory statistic
95 */
96void hmm_init_mem_stat(int res_pgnr, int dyc_en, int dyc_pgnr);
97
98extern bool dypool_enable;
99extern unsigned int dypool_pgnr;
100extern struct hmm_bo_device bo_device;
101
102#endif