1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 #include <mali_kbase.h> 23 24 typedef int kbase_device_init_method(struct kbase_device *kbdev); 25 typedef void kbase_device_term_method(struct kbase_device *kbdev); 26 27 /** 28 * struct kbase_device_init - Device init/term methods. 29 * @init: Function pointer to a initialise method. 30 * @term: Function pointer to a terminate method. 31 * @err_mes: Error message to be printed when init method fails. 32 */ 33 struct kbase_device_init { 34 kbase_device_init_method *init; 35 kbase_device_term_method *term; 36 char *err_mes; 37 }; 38 39 int kbase_device_vinstr_init(struct kbase_device *kbdev); 40 void kbase_device_vinstr_term(struct kbase_device *kbdev); 41 42 int kbase_device_kinstr_prfcnt_init(struct kbase_device *kbdev); 43 void kbase_device_kinstr_prfcnt_term(struct kbase_device *kbdev); 44 45 int kbase_device_timeline_init(struct kbase_device *kbdev); 46 void kbase_device_timeline_term(struct kbase_device *kbdev); 47 48 int kbase_device_hwcnt_context_init(struct kbase_device *kbdev); 49 void kbase_device_hwcnt_context_term(struct kbase_device *kbdev); 50 51 int kbase_device_hwcnt_virtualizer_init(struct kbase_device *kbdev); 52 void kbase_device_hwcnt_virtualizer_term(struct kbase_device *kbdev); 53 54 int kbase_device_list_init(struct kbase_device *kbdev); 55 void kbase_device_list_term(struct kbase_device *kbdev); 56 57 int kbase_device_io_history_init(struct kbase_device *kbdev); 58 void kbase_device_io_history_term(struct kbase_device *kbdev); 59 60 int kbase_device_misc_register(struct kbase_device *kbdev); 61 void kbase_device_misc_deregister(struct kbase_device *kbdev); 62 63 void kbase_device_id_init(struct kbase_device *kbdev); 64 65 /** 66 * kbase_device_early_init - Perform any device-specific initialization. 67 * @kbdev: Device pointer 68 * 69 * Return: 0 on success, or an error code on failure. 70 */ 71 int kbase_device_early_init(struct kbase_device *kbdev); 72 73 /** 74 * kbase_device_early_term - Perform any device-specific termination. 75 * @kbdev: Device pointer 76 */ 77 void kbase_device_early_term(struct kbase_device *kbdev); 78 79 /** 80 * kbase_device_late_init - Complete any device-specific initialization. 81 * @kbdev: Device pointer 82 * 83 * Return: 0 on success, or an error code on failure. 84 */ 85 int kbase_device_late_init(struct kbase_device *kbdev); 86 87 /** 88 * kbase_device_late_term - Complete any device-specific termination. 89 * @kbdev: Device pointer 90 */ 91 void kbase_device_late_term(struct kbase_device *kbdev); 92 93 #if MALI_USE_CSF && !IS_ENABLED(CONFIG_MALI_BIFROST_NO_MALI) 94 /** 95 * kbase_is_register_accessible - Checks if register is accessible 96 * @offset: Register offset 97 * 98 * Return: true if the register is accessible, false otherwise. 99 */ 100 bool kbase_is_register_accessible(u32 offset); 101 #endif /* MALI_USE_CSF && !IS_ENABLED(CONFIG_MALI_BIFROST_NO_MALI) */ 102