xref: /linux/drivers/crypto/intel/qat/qat_common/adf_anti_rb.h (revision 0fc8f6200d2313278fbf4539bbab74677c685531)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright(c) 2026 Intel Corporation */
3 #ifndef ADF_ANTI_RB_H_
4 #define ADF_ANTI_RB_H_
5 
6 #include <linux/types.h>
7 
8 #define GET_ANTI_RB_DATA(accel_dev) (&(accel_dev)->hw_device->anti_rb_data)
9 
10 #define ADF_SVN_NO_STS		0x00
11 #define ADF_SVN_PASS_STS	0x01
12 #define ADF_SVN_RETRY_STS	0x02
13 #define ADF_SVN_FAIL_STS	0x03
14 #define ADF_SVN_RETRY_MS	250
15 #define ADF_SVN_STS_MASK	GENMASK(7, 0)
16 
17 enum anti_rb {
18 	ARB_ENFORCED_MIN_SVN,
19 	ARB_PERMANENT_MIN_SVN,
20 	ARB_ACTIVE_SVN,
21 };
22 
23 struct adf_accel_dev;
24 struct pci_dev;
25 
26 struct adf_anti_rb_hw_data {
27 	bool (*anti_rb_enabled)(struct adf_accel_dev *accel_dev);
28 	u32 svncheck_offset;
29 	u32 svncheck_retry;
30 	bool sysfs_added;
31 };
32 
33 int adf_anti_rb_commit(struct adf_accel_dev *accel_dev);
34 int adf_anti_rb_query(struct adf_accel_dev *accel_dev, enum anti_rb cmd, u8 *svn);
35 int adf_anti_rb_check(struct pci_dev *pdev);
36 
37 #endif /* ADF_ANTI_RB_H_ */
38