1 /*
2  * Copyright (c) 2022-2023, Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_SIP_SVC_ID_MGR_H_
8 #define ZEPHYR_SIP_SVC_ID_MGR_H_
9 
10 /**
11  * @file
12  * @brief Arm SiP services ID manager and ID mapping table.
13  *
14  */
15 
16 struct sip_svc_id_pool {
17 	uint32_t size;
18 	uint32_t head;
19 	uint32_t tail;
20 	uint32_t *id_list;
21 	uint32_t *id_mask;
22 };
23 
24 struct sip_svc_id_map_item {
25 	uint32_t id;
26 	void *arg1; /* callback function pointer */
27 	void *arg2; /* high resp data address */
28 	void *arg3; /* low resp data address */
29 	void *arg4; /* maximum resp data addr size */
30 	void *arg5; /* pointer to private data */
31 	void *arg6; /* client index */
32 };
33 
34 struct sip_svc_id_map {
35 	uint32_t size;
36 	struct sip_svc_id_map_item *items;
37 };
38 
39 struct sip_svc_id_pool *sip_svc_id_mgr_create(uint32_t size);
40 
41 void sip_svc_id_mgr_delete(struct sip_svc_id_pool *id_pool);
42 
43 uint32_t sip_svc_id_mgr_alloc(struct sip_svc_id_pool *id_pool);
44 
45 void sip_svc_id_mgr_free(struct sip_svc_id_pool *id_pool, uint32_t id);
46 
47 struct sip_svc_id_map *sip_svc_id_map_create(uint32_t size);
48 
49 void sip_svc_id_map_delete(struct sip_svc_id_map *id_map);
50 
51 int sip_svc_id_map_insert_item(struct sip_svc_id_map *id_map, uint32_t id, void *arg1, void *arg2,
52 			       void *arg3, void *arg4, void *arg5, void *arg6);
53 
54 int sip_svc_id_map_remove_item(struct sip_svc_id_map *id_map, uint32_t id);
55 
56 struct sip_svc_id_map_item *sip_svc_id_map_query_item(struct sip_svc_id_map *id_map, uint32_t id);
57 
58 #endif /* ZEPHYR_SIP_SVC_ID_MGR_H_ */
59