temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / video / tegra / nvmap / nvmap_heap.h
1 /*
2  * drivers/video/tegra/nvmap_heap.h
3  *
4  * GPU heap allocator.
5  *
6  * Copyright (c) 2010, NVIDIA Corporation.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  */
22
23 #ifndef __NVMAP_HEAP_H
24 #define __NVMAP_HEAP_H
25
26 struct device;
27 struct nvmap_heap;
28 struct attribute_group;
29
30 struct nvmap_heap_block {
31         unsigned long   base;
32         unsigned int    type;
33 };
34
35 #define NVMAP_HEAP_MIN_BUDDY_SIZE       8192
36
37 struct nvmap_heap *nvmap_heap_create(struct device *parent, const char *name,
38                                      unsigned long base, size_t len,
39                                      unsigned int buddy_size, void *arg);
40
41 void nvmap_heap_destroy(struct nvmap_heap *heap);
42
43 void *nvmap_heap_device_to_arg(struct device *dev);
44
45 void *nvmap_heap_to_arg(struct nvmap_heap *heap);
46
47 struct nvmap_heap_block *nvmap_heap_alloc(struct nvmap_heap *heap, size_t len,
48                                           size_t align, unsigned int prot);
49
50 struct nvmap_heap *nvmap_block_to_heap(struct nvmap_heap_block *b);
51
52 void nvmap_heap_free(struct nvmap_heap_block *block);
53
54 int nvmap_heap_create_group(struct nvmap_heap *heap,
55                             const struct attribute_group *grp);
56
57 void nvmap_heap_remove_group(struct nvmap_heap *heap,
58                              const struct attribute_group *grp);
59
60 int __init nvmap_heap_init(void);
61
62 void nvmap_heap_deinit(void);
63
64 #endif