2 * Copyright (C) 2010, 2012-2013 ARM Limited. All rights reserved.
4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7 * A copy of the licence is included with the program, and can also be obtained from Free Software
8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
10 #include <linux/fs.h> /* file system operations */
11 #include <asm/uaccess.h> /* user space access */
15 #include "mali_kernel_common.h"
16 #include "mali_session.h"
17 #include "mali_ukk_wrappers.h"
19 int gp_start_job_wrapper(struct mali_session_data *session_data, _mali_uk_gp_start_job_s __user *uargs)
21 _mali_osk_errcode_t err;
23 /* If the job was started successfully, 0 is returned. If there was an error, but the job
24 * was started, we return -ENOENT. For anything else returned, the job was not started. */
26 MALI_CHECK_NON_NULL(uargs, -EINVAL);
27 MALI_CHECK_NON_NULL(session_data, -EINVAL);
29 err = _mali_ukk_gp_start_job(session_data, uargs);
30 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
35 int gp_get_core_version_wrapper(struct mali_session_data *session_data, _mali_uk_get_gp_core_version_s __user *uargs)
37 _mali_uk_get_gp_core_version_s kargs;
38 _mali_osk_errcode_t err;
40 MALI_CHECK_NON_NULL(uargs, -EINVAL);
41 MALI_CHECK_NON_NULL(session_data, -EINVAL);
43 kargs.ctx = session_data;
44 err = _mali_ukk_get_gp_core_version(&kargs);
45 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
47 /* no known transactions to roll-back */
49 if (0 != put_user(kargs.version, &uargs->version)) return -EFAULT;
54 int gp_suspend_response_wrapper(struct mali_session_data *session_data, _mali_uk_gp_suspend_response_s __user *uargs)
56 _mali_uk_gp_suspend_response_s kargs;
57 _mali_osk_errcode_t err;
59 MALI_CHECK_NON_NULL(uargs, -EINVAL);
60 MALI_CHECK_NON_NULL(session_data, -EINVAL);
62 if (0 != copy_from_user(&kargs, uargs, sizeof(_mali_uk_gp_suspend_response_s))) return -EFAULT;
64 kargs.ctx = session_data;
65 err = _mali_ukk_gp_suspend_response(&kargs);
66 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
68 if (0 != put_user(kargs.cookie, &uargs->cookie)) return -EFAULT;
70 /* no known transactions to roll-back */
74 int gp_get_number_of_cores_wrapper(struct mali_session_data *session_data, _mali_uk_get_gp_number_of_cores_s __user *uargs)
76 _mali_uk_get_gp_number_of_cores_s kargs;
77 _mali_osk_errcode_t err;
79 MALI_CHECK_NON_NULL(uargs, -EINVAL);
80 MALI_CHECK_NON_NULL(session_data, -EINVAL);
82 kargs.ctx = session_data;
83 err = _mali_ukk_get_gp_number_of_cores(&kargs);
84 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
86 /* no known transactions to roll-back */
88 if (0 != put_user(kargs.number_of_cores, &uargs->number_of_cores)) return -EFAULT;