1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2012-2017, 2020-2021 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 /**
23  * DOC: Run-time work-arounds helpers
24  */
25 
26 #ifndef _KBASE_HW_H_
27 #define _KBASE_HW_H_
28 
29 #include "mali_kbase_defs.h"
30 
31 /**
32  * Tell whether a work-around should be enabled
33  * @kbdev: Device pointer
34  * @issue: issue to be checked
35  */
36 #define kbase_hw_has_issue(kbdev, issue)\
37 	test_bit(issue, &(kbdev)->hw_issues_mask[0])
38 
39 /**
40  * Tell whether a feature is supported
41  * @kbdev: Device pointer
42  * @feature: feature to be checked
43  */
44 #define kbase_hw_has_feature(kbdev, feature)\
45 	test_bit(feature, &(kbdev)->hw_features_mask[0])
46 
47 /**
48  * kbase_hw_set_issues_mask - Set the hardware issues mask based on the GPU ID
49  * @kbdev: Device pointer
50  *
51  * Return: 0 if the GPU ID was recognized, otherwise -EINVAL.
52  *
53  * The GPU ID is read from the @kbdev.
54  *
55  * In debugging versions of the driver, unknown versions of a known GPU with a
56  * new-format ID will be treated as the most recent known version not later
57  * than the actual version. In such circumstances, the GPU ID in @kbdev will
58  * also be replaced with the most recent known version.
59  *
60  * Note: The GPU configuration must have been read by
61  * kbase_gpuprops_get_props() before calling this function.
62  */
63 int kbase_hw_set_issues_mask(struct kbase_device *kbdev);
64 
65 /**
66  * Set the features mask depending on the GPU ID
67  * @kbdev: Device pointer
68  */
69 void kbase_hw_set_features_mask(struct kbase_device *kbdev);
70 
71 #endif				/* _KBASE_HW_H_ */
72