xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/midgard/mali_kbase_hw.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  *
3*4882a593Smuzhiyun  * (C) COPYRIGHT 2012-2017 ARM Limited. All rights reserved.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This program is free software and is provided to you under the terms of the
6*4882a593Smuzhiyun  * GNU General Public License version 2 as published by the Free Software
7*4882a593Smuzhiyun  * Foundation, and any use by you of this program is subject to the terms
8*4882a593Smuzhiyun  * of such GNU licence.
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * A copy of the licence is included with the program, and can also be obtained
11*4882a593Smuzhiyun  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12*4882a593Smuzhiyun  * Boston, MA  02110-1301, USA.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  */
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun /**
21*4882a593Smuzhiyun  * @file
22*4882a593Smuzhiyun  * Run-time work-arounds helpers
23*4882a593Smuzhiyun  */
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #ifndef _KBASE_HW_H_
26*4882a593Smuzhiyun #define _KBASE_HW_H_
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #include "mali_kbase_defs.h"
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun /**
31*4882a593Smuzhiyun  * @brief Tell whether a work-around should be enabled
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun #define kbase_hw_has_issue(kbdev, issue)\
34*4882a593Smuzhiyun 	test_bit(issue, &(kbdev)->hw_issues_mask[0])
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun /**
37*4882a593Smuzhiyun  * @brief Tell whether a feature is supported
38*4882a593Smuzhiyun  */
39*4882a593Smuzhiyun #define kbase_hw_has_feature(kbdev, feature)\
40*4882a593Smuzhiyun 	test_bit(feature, &(kbdev)->hw_features_mask[0])
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun /**
43*4882a593Smuzhiyun  * kbase_hw_set_issues_mask - Set the hardware issues mask based on the GPU ID
44*4882a593Smuzhiyun  * @kbdev: Device pointer
45*4882a593Smuzhiyun  *
46*4882a593Smuzhiyun  * Return: 0 if the GPU ID was recognized, otherwise -EINVAL.
47*4882a593Smuzhiyun  *
48*4882a593Smuzhiyun  * The GPU ID is read from the @kbdev.
49*4882a593Smuzhiyun  *
50*4882a593Smuzhiyun  * In debugging versions of the driver, unknown versions of a known GPU with a
51*4882a593Smuzhiyun  * new-format ID will be treated as the most recent known version not later
52*4882a593Smuzhiyun  * than the actual version. In such circumstances, the GPU ID in @kbdev will
53*4882a593Smuzhiyun  * also be replaced with the most recent known version.
54*4882a593Smuzhiyun  *
55*4882a593Smuzhiyun  * Note: The GPU configuration must have been read by
56*4882a593Smuzhiyun  * kbase_gpuprops_get_props() before calling this function.
57*4882a593Smuzhiyun  */
58*4882a593Smuzhiyun int kbase_hw_set_issues_mask(struct kbase_device *kbdev);
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun /**
61*4882a593Smuzhiyun  * @brief Set the features mask depending on the GPU ID
62*4882a593Smuzhiyun  */
63*4882a593Smuzhiyun void kbase_hw_set_features_mask(struct kbase_device *kbdev);
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun #endif				/* _KBASE_HW_H_ */
66