xref: /linux/include/linux/intel_tpmi.h (revision 4c2cd91bff6371b58e672e8791c3bfa70c1b821f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * intel_tpmi.h: Intel TPMI core external interface
4  */
5 
6 #ifndef _INTEL_TPMI_H_
7 #define _INTEL_TPMI_H_
8 
9 #include <linux/bitfield.h>
10 
11 struct oobmsm_plat_info;
12 
13 #define TPMI_VERSION_INVALID	0xff
14 #define TPMI_MINOR_VERSION(val)	FIELD_GET(GENMASK(4, 0), val)
15 #define TPMI_MAJOR_VERSION(val)	FIELD_GET(GENMASK(7, 5), val)
16 
17 /*
18  * List of supported TMPI IDs.
19  * Some TMPI IDs are not used by Linux, so the numbers are not consecutive.
20  */
21 enum intel_tpmi_id {
22 	TPMI_ID_RAPL = 0,	/* Running Average Power Limit */
23 	TPMI_ID_PEM = 1,	/* Power and Perf excursion Monitor */
24 	TPMI_ID_UNCORE = 2,	/* Uncore Frequency Scaling */
25 	TPMI_ID_SST = 5,	/* Speed Select Technology */
26 	TPMI_ID_PLR = 0xc,	/* Performance Limit Reasons */
27 	TPMI_CONTROL_ID = 0x80,	/* Special ID for getting feature status */
28 	TPMI_INFO_ID = 0x81,	/* Special ID for PCI BDF and Package ID information */
29 };
30 
31 #define TPMI_CORE_INIT	0
32 #define TPMI_CORE_EXIT	1
33 
34 int tpmi_register_notifier(struct notifier_block *nb);
35 int tpmi_unregister_notifier(struct notifier_block *nb);
36 
37 struct oobmsm_plat_info *tpmi_get_platform_data(struct auxiliary_device *auxdev);
38 struct resource *tpmi_get_resource_at_index(struct auxiliary_device *auxdev, int index);
39 int tpmi_get_resource_count(struct auxiliary_device *auxdev);
40 int tpmi_get_feature_status(struct auxiliary_device *auxdev, int feature_id, bool *read_blocked,
41 			    bool *write_blocked);
42 struct dentry *tpmi_get_debugfs_dir(struct auxiliary_device *auxdev);
43 #endif
44