2 * Copyright (C) 2011-2012 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 MALI_CHECK_NON_NULL(uargs, -EINVAL);
24 MALI_CHECK_NON_NULL(session_data, -EINVAL);
26 err = _mali_ukk_gp_start_job(session_data, uargs);
27 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
32 int gp_get_core_version_wrapper(struct mali_session_data *session_data, _mali_uk_get_gp_core_version_s __user *uargs)
34 _mali_uk_get_gp_core_version_s kargs;
35 _mali_osk_errcode_t err;
37 MALI_CHECK_NON_NULL(uargs, -EINVAL);
38 MALI_CHECK_NON_NULL(session_data, -EINVAL);
40 kargs.ctx = session_data;
41 err = _mali_ukk_get_gp_core_version(&kargs);
42 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
44 /* no known transactions to roll-back */
46 if (0 != put_user(kargs.version, &uargs->version)) return -EFAULT;
51 int gp_suspend_response_wrapper(struct mali_session_data *session_data, _mali_uk_gp_suspend_response_s __user *uargs)
53 _mali_uk_gp_suspend_response_s kargs;
54 _mali_osk_errcode_t err;
56 MALI_CHECK_NON_NULL(uargs, -EINVAL);
57 MALI_CHECK_NON_NULL(session_data, -EINVAL);
59 if (0 != copy_from_user(&kargs, uargs, sizeof(_mali_uk_gp_suspend_response_s))) return -EFAULT;
61 kargs.ctx = session_data;
62 err = _mali_ukk_gp_suspend_response(&kargs);
63 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
65 if (0 != put_user(kargs.cookie, &uargs->cookie)) return -EFAULT;
67 /* no known transactions to roll-back */
71 int gp_get_number_of_cores_wrapper(struct mali_session_data *session_data, _mali_uk_get_gp_number_of_cores_s __user *uargs)
73 _mali_uk_get_gp_number_of_cores_s kargs;
74 _mali_osk_errcode_t err;
76 MALI_CHECK_NON_NULL(uargs, -EINVAL);
77 MALI_CHECK_NON_NULL(session_data, -EINVAL);
79 kargs.ctx = session_data;
80 err = _mali_ukk_get_gp_number_of_cores(&kargs);
81 if (_MALI_OSK_ERR_OK != err) return map_errcode(err);
83 /* no known transactions to roll-back */
85 if (0 != put_user(kargs.number_of_cores, &uargs->number_of_cores)) return -EFAULT;