xref: /openbmc/linux/drivers/media/platform/st/sti/hva/hva-mem.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1*e7b8153eSMauro Carvalho Chehab /* SPDX-License-Identifier: GPL-2.0 */
2*e7b8153eSMauro Carvalho Chehab /*
3*e7b8153eSMauro Carvalho Chehab  * Copyright (C) STMicroelectronics SA 2015
4*e7b8153eSMauro Carvalho Chehab  * Authors: Yannick Fertre <yannick.fertre@st.com>
5*e7b8153eSMauro Carvalho Chehab  *          Hugues Fruchet <hugues.fruchet@st.com>
6*e7b8153eSMauro Carvalho Chehab  */
7*e7b8153eSMauro Carvalho Chehab 
8*e7b8153eSMauro Carvalho Chehab #ifndef HVA_MEM_H
9*e7b8153eSMauro Carvalho Chehab #define HVA_MEM_H
10*e7b8153eSMauro Carvalho Chehab 
11*e7b8153eSMauro Carvalho Chehab /**
12*e7b8153eSMauro Carvalho Chehab  * struct hva_buffer - hva buffer
13*e7b8153eSMauro Carvalho Chehab  *
14*e7b8153eSMauro Carvalho Chehab  * @name:  name of requester
15*e7b8153eSMauro Carvalho Chehab  * @paddr: physical address (for hardware)
16*e7b8153eSMauro Carvalho Chehab  * @vaddr: virtual address (kernel can read/write)
17*e7b8153eSMauro Carvalho Chehab  * @size:  size of buffer
18*e7b8153eSMauro Carvalho Chehab  */
19*e7b8153eSMauro Carvalho Chehab struct hva_buffer {
20*e7b8153eSMauro Carvalho Chehab 	const char		*name;
21*e7b8153eSMauro Carvalho Chehab 	dma_addr_t		paddr;
22*e7b8153eSMauro Carvalho Chehab 	void			*vaddr;
23*e7b8153eSMauro Carvalho Chehab 	u32			size;
24*e7b8153eSMauro Carvalho Chehab };
25*e7b8153eSMauro Carvalho Chehab 
26*e7b8153eSMauro Carvalho Chehab int hva_mem_alloc(struct hva_ctx *ctx,
27*e7b8153eSMauro Carvalho Chehab 		  __u32 size,
28*e7b8153eSMauro Carvalho Chehab 		  const char *name,
29*e7b8153eSMauro Carvalho Chehab 		  struct hva_buffer **buf);
30*e7b8153eSMauro Carvalho Chehab 
31*e7b8153eSMauro Carvalho Chehab void hva_mem_free(struct hva_ctx *ctx,
32*e7b8153eSMauro Carvalho Chehab 		  struct hva_buffer *buf);
33*e7b8153eSMauro Carvalho Chehab 
34*e7b8153eSMauro Carvalho Chehab #endif /* HVA_MEM_H */
35