Merge tag 'kbuild-fixes-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masah...
[linux-block.git] / include / linux / intel_tpmi.h
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 #define TPMI_VERSION_INVALID    0xff
12 #define TPMI_MINOR_VERSION(val) FIELD_GET(GENMASK(4, 0), val)
13 #define TPMI_MAJOR_VERSION(val) FIELD_GET(GENMASK(7, 5), val)
14
15 /*
16  * List of supported TMPI IDs.
17  * Some TMPI IDs are not used by Linux, so the numbers are not consecutive.
18  */
19 enum intel_tpmi_id {
20         TPMI_ID_RAPL = 0,       /* Running Average Power Limit */
21         TPMI_ID_PEM = 1,        /* Power and Perf excursion Monitor */
22         TPMI_ID_UNCORE = 2,     /* Uncore Frequency Scaling */
23         TPMI_ID_SST = 5,        /* Speed Select Technology */
24         TPMI_CONTROL_ID = 0x80, /* Special ID for getting feature status */
25         TPMI_INFO_ID = 0x81,    /* Special ID for PCI BDF and Package ID information */
26 };
27
28 /**
29  * struct intel_tpmi_plat_info - Platform information for a TPMI device instance
30  * @cdie_mask:       Mask of all compute dies in the partition
31  * @package_id:      CPU Package id
32  * @partition:       Package partition id when multiple VSEC PCI devices per package
33  * @segment:         PCI segment ID
34  * @bus_number:      PCI bus number
35  * @device_number:   PCI device number
36  * @function_number: PCI function number
37  *
38  * Structure to store platform data for a TPMI device instance. This
39  * struct is used to return data via tpmi_get_platform_data().
40  */
41 struct intel_tpmi_plat_info {
42         u16 cdie_mask;
43         u8 package_id;
44         u8 partition;
45         u8 segment;
46         u8 bus_number;
47         u8 device_number;
48         u8 function_number;
49 };
50
51 struct intel_tpmi_plat_info *tpmi_get_platform_data(struct auxiliary_device *auxdev);
52 struct resource *tpmi_get_resource_at_index(struct auxiliary_device *auxdev, int index);
53 int tpmi_get_resource_count(struct auxiliary_device *auxdev);
54 int tpmi_get_feature_status(struct auxiliary_device *auxdev, int feature_id, bool *read_blocked,
55                             bool *write_blocked);
56 #endif