18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2015
48c2ecf20Sopenharmony_ci * Authors: Yannick Fertre <yannick.fertre@st.com>
58c2ecf20Sopenharmony_ci *          Hugues Fruchet <hugues.fruchet@st.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef HVA_MEM_H
98c2ecf20Sopenharmony_ci#define HVA_MEM_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/**
128c2ecf20Sopenharmony_ci * struct hva_buffer - hva buffer
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * @name:  name of requester
158c2ecf20Sopenharmony_ci * @paddr: physical address (for hardware)
168c2ecf20Sopenharmony_ci * @vaddr: virtual address (kernel can read/write)
178c2ecf20Sopenharmony_ci * @size:  size of buffer
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_cistruct hva_buffer {
208c2ecf20Sopenharmony_ci	const char		*name;
218c2ecf20Sopenharmony_ci	dma_addr_t		paddr;
228c2ecf20Sopenharmony_ci	void			*vaddr;
238c2ecf20Sopenharmony_ci	u32			size;
248c2ecf20Sopenharmony_ci};
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciint hva_mem_alloc(struct hva_ctx *ctx,
278c2ecf20Sopenharmony_ci		  __u32 size,
288c2ecf20Sopenharmony_ci		  const char *name,
298c2ecf20Sopenharmony_ci		  struct hva_buffer **buf);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_civoid hva_mem_free(struct hva_ctx *ctx,
328c2ecf20Sopenharmony_ci		  struct hva_buffer *buf);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif /* HVA_MEM_H */
35