1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * (C) COPYRIGHT 2012-2017, 2020-2022 ARM Limited. All rights reserved. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * This program is free software and is provided to you under the terms of the 7*4882a593Smuzhiyun * GNU General Public License version 2 as published by the Free Software 8*4882a593Smuzhiyun * Foundation, and any use by you of this program is subject to the terms 9*4882a593Smuzhiyun * of such GNU license. 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, 12*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*4882a593Smuzhiyun * GNU General Public License for more details. 15*4882a593Smuzhiyun * 16*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 17*4882a593Smuzhiyun * along with this program; if not, you can access it online at 18*4882a593Smuzhiyun * http://www.gnu.org/licenses/gpl-2.0.html. 19*4882a593Smuzhiyun * 20*4882a593Smuzhiyun */ 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun /** 23*4882a593Smuzhiyun * DOC: Run-time work-arounds helpers 24*4882a593Smuzhiyun */ 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #ifndef _KBASE_HW_H_ 27*4882a593Smuzhiyun #define _KBASE_HW_H_ 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #include "mali_kbase_defs.h" 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun /** 32*4882a593Smuzhiyun * kbase_hw_has_issue - Tell whether a work-around should be enabled 33*4882a593Smuzhiyun * @kbdev: Device pointer 34*4882a593Smuzhiyun * @issue: issue to be checked 35*4882a593Smuzhiyun */ 36*4882a593Smuzhiyun #define kbase_hw_has_issue(kbdev, issue)\ 37*4882a593Smuzhiyun test_bit(issue, &(kbdev)->hw_issues_mask[0]) 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun /** 40*4882a593Smuzhiyun * kbase_hw_has_feature - Tell whether a feature is supported 41*4882a593Smuzhiyun * @kbdev: Device pointer 42*4882a593Smuzhiyun * @feature: feature to be checked 43*4882a593Smuzhiyun */ 44*4882a593Smuzhiyun #define kbase_hw_has_feature(kbdev, feature)\ 45*4882a593Smuzhiyun test_bit(feature, &(kbdev)->hw_features_mask[0]) 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun /** 48*4882a593Smuzhiyun * kbase_hw_set_issues_mask - Set the hardware issues mask based on the GPU ID 49*4882a593Smuzhiyun * @kbdev: Device pointer 50*4882a593Smuzhiyun * 51*4882a593Smuzhiyun * Return: 0 if the GPU ID was recognized, otherwise -EINVAL. 52*4882a593Smuzhiyun * 53*4882a593Smuzhiyun * The GPU ID is read from the @kbdev. 54*4882a593Smuzhiyun * 55*4882a593Smuzhiyun * In debugging versions of the driver, unknown versions of a known GPU with a 56*4882a593Smuzhiyun * new-format ID will be treated as the most recent known version not later 57*4882a593Smuzhiyun * than the actual version. In such circumstances, the GPU ID in @kbdev will 58*4882a593Smuzhiyun * also be replaced with the most recent known version. 59*4882a593Smuzhiyun * 60*4882a593Smuzhiyun * Note: The GPU configuration must have been read by 61*4882a593Smuzhiyun * kbase_gpuprops_get_props() before calling this function. 62*4882a593Smuzhiyun */ 63*4882a593Smuzhiyun int kbase_hw_set_issues_mask(struct kbase_device *kbdev); 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun /** 66*4882a593Smuzhiyun * kbase_hw_set_features_mask - Set the features mask depending on the GPU ID 67*4882a593Smuzhiyun * @kbdev: Device pointer 68*4882a593Smuzhiyun */ 69*4882a593Smuzhiyun void kbase_hw_set_features_mask(struct kbase_device *kbdev); 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun #endif /* _KBASE_HW_H_ */ 72