summaryrefslogtreecommitdiff
path: root/ion_physical_heap.h
blob: f48ccd8eaa6a85a50d3d6966ea801b97c75b9dfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2020 Google LLC
 */

#include <linux/samsung-dma-heap.h>
#include <linux/genalloc.h>

typedef void(ion_physical_heap_allocate_callback)(struct samsung_dma_buffer *buffer,
						  void *ctx);
typedef void(ion_physical_heap_free_callback)(struct samsung_dma_buffer *buffer,
					      void *ctx);

struct dma_heap *ion_physical_heap_create(phys_addr_t base, size_t size,
					  size_t align, const char *name,
					  ion_physical_heap_allocate_callback alloc_cb,
					  ion_physical_heap_free_callback free_cb,
					  void *ctx);

struct ion_physical_heap {
	struct gen_pool *pool;
	phys_addr_t base;
	size_t size;

	ion_physical_heap_allocate_callback *allocate_cb;
	void *allocate_ctx;

	ion_physical_heap_free_callback *free_cb;
	void *free_ctx;
};