1 /* SPDX-License-Identifier: GPL-2.0 */
4 * VideoCore Shared Memory CMA allocator
6 * Copyright: 2018, Raspberry Pi (Trading) Ltd
7 * Copyright 2011-2012 Broadcom Corporation. All rights reserved.
9 * Based on vmcs_sm driver from Broadcom Corporation.
13 #ifndef __VC_SM_CMA_VCHI_H__INCLUDED__
14 #define __VC_SM_CMA_VCHI_H__INCLUDED__
16 #include <linux/raspberrypi/vchiq.h>
18 #include "vc_sm_defs.h"
25 typedef void (*vpu_event_cb)(struct sm_instance *instance,
26 struct vc_sm_result_t *reply, int reply_len);
29 * Initialize the shared memory service, opens up vchi connection to talk to it.
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);
36 * Terminates the shared memory service.
38 int vc_sm_cma_vchi_stop(struct sm_instance **handle);
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.
44 int vc_sm_cma_vchi_free(struct sm_instance *handle, struct vc_sm_free_t *msg,
48 * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T.
50 int vc_sm_cma_vchi_import(struct sm_instance *handle, struct vc_sm_import *msg,
51 struct vc_sm_import_result *result,
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,
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);
63 #endif /* __VC_SM_CMA_VCHI_H__INCLUDED__ */