Merge tag 'v5.15.57' into rpi-5.15.y
[platform/kernel/linux-rpi.git] / drivers / staging / vc04_services / vc-sm-cma / vc_sm_cma_vchi.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 /*
4  * VideoCore Shared Memory CMA allocator
5  *
6  * Copyright: 2018, Raspberry Pi (Trading) Ltd
7  * Copyright 2011-2012 Broadcom Corporation.  All rights reserved.
8  *
9  * Based on vmcs_sm driver from Broadcom Corporation.
10  *
11  */
12
13 #ifndef __VC_SM_CMA_VCHI_H__INCLUDED__
14 #define __VC_SM_CMA_VCHI_H__INCLUDED__
15
16 #include <linux/raspberrypi/vchiq.h>
17
18 #include "vc_sm_defs.h"
19
20 /*
21  * Forward declare.
22  */
23 struct sm_instance;
24
25 typedef void (*vpu_event_cb)(struct sm_instance *instance,
26                              struct vc_sm_result_t *reply, int reply_len);
27
28 /*
29  * Initialize the shared memory service, opens up vchi connection to talk to it.
30  */
31 struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchi_instance,
32                                         unsigned int num_connections,
33                                         vpu_event_cb vpu_event);
34
35 /*
36  * Terminates the shared memory service.
37  */
38 int vc_sm_cma_vchi_stop(struct sm_instance **handle);
39
40 /*
41  * Ask the shared memory service to free up some memory that was previously
42  * allocated by the vc_sm_cma_vchi_alloc function call.
43  */
44 int vc_sm_cma_vchi_free(struct sm_instance *handle, struct vc_sm_free_t *msg,
45                         u32 *cur_trans_id);
46
47 /*
48  * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T.
49  */
50 int vc_sm_cma_vchi_import(struct sm_instance *handle, struct vc_sm_import *msg,
51                           struct vc_sm_import_result *result,
52                           u32 *cur_trans_id);
53
54 int vc_sm_cma_vchi_client_version(struct sm_instance *handle,
55                                   struct vc_sm_version *msg,
56                                   struct vc_sm_result_t *result,
57                                   u32 *cur_trans_id);
58
59 int vc_sm_vchi_client_vc_mem_req_reply(struct sm_instance *handle,
60                                        struct vc_sm_vc_mem_request_result *msg,
61                                        uint32_t *cur_trans_id);
62
63 #endif /* __VC_SM_CMA_VCHI_H__INCLUDED__ */