1 /*
2  * Copyright 2020, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <lk/compiler.h>
20 #include <trusty_ipc.h>
21 
22 __BEGIN_CDECLS
23 
24 struct secure_dpu_buf_info {
25     handle_t handle;
26     size_t len;
27 };
28 
29 /**
30  * add_secure_dpu_service() - Add secure_dpu service.
31  * @hset: pointer to the tipc hset.
32  * @chan: the pointer to the handle provided by the caller
33  *        for calling secure_dpu_* APIs. The handle will be updated
34  *        when the port is connected / disconnected.
35  *
36  * After the service is added successfully, the service will be started to
37  * handle requests.
38  *
39  * Return: 0 on success, or an error code < 0 on failure.
40  */
41 int add_secure_dpu_service(struct tipc_hset* hset, handle_t* chan);
42 
43 /**
44  * secure_dpu_allocate_buffer() - Allocate framebuffer.
45  * @chan: channel handle
46  * @buffer_len: requested length of the buffer
47  * @buf_info: information of the allocated buffer.
48  *
49  * Return: 0 on success, or an error code < 0 on failure.
50  */
51 int secure_dpu_allocate_buffer(handle_t chan,
52                                size_t buffer_len,
53                                struct secure_dpu_buf_info* buf_info);
54 
55 /**
56  * secure_dpu_release_buffer() - release framebuffer.
57  * @buf_info: information of the buffer to be freed
58  *
59  * Return: 0 on success, or an error code < 0 on failure.
60  */
61 int secure_dpu_release_buffer(struct secure_dpu_buf_info* buf_info);
62 
63 /**
64  * secure_dpu_start_secure_display() - notify DPU driver to start secure display
65  * @chan: channel handle
66  *
67  * Return: 0 on success, or an error code < 0 on failure.
68  */
69 int secure_dpu_start_secure_display(handle_t chan);
70 
71 /**
72  * secure_dpu_start_secure_display() - notify DPU driver to stop secure display
73  * @chan: channel handle
74  *
75  * Return: 0 on success, or an error code < 0 on failure.
76  */
77 int secure_dpu_stop_secure_display(handle_t chan);
78 
79 __END_CDECLS
80