1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2022, Foundries.io Ltd
4  */
5 #ifndef __DRIVERS_VERSAL_MBOX_H
6 #define __DRIVERS_VERSAL_MBOX_H
7 
8 #include <platform_config.h>
9 #include <tee_api_types.h>
10 #include <util.h>
11 
12 #define VERSAL_MAX_IPI_BUF 7
13 
14 struct versal_mbox_mem {
15 	size_t alloc_len;
16 	size_t len;
17 	void *buf;
18 };
19 
20 struct versal_ipi_buf {
21 	struct versal_mbox_mem mem;
22 	bool only_cache;
23 };
24 
25 struct versal_ipi_cmd {
26 	uint32_t data[8];
27 	struct versal_ipi_buf ibuf[VERSAL_MAX_IPI_BUF];
28 };
29 
30 TEE_Result versal_mbox_notify(struct versal_ipi_cmd *cmd,
31 			      struct versal_ipi_cmd *rsp, uint32_t *err);
32 TEE_Result versal_mbox_alloc(size_t len, const void *init,
33 			     struct versal_mbox_mem *mem);
34 #endif /* __DRIVERS_VERSAL_MBOX_H */
35