1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ACPI_ACPI_THERMAL_H
3 #define __ACPI_ACPI_THERMAL_H
4 
5 #include <asm/ioctl.h>
6 
7 #define ACPI_THERMAL_MAGIC 's'
8 
9 #define ACPI_THERMAL_GET_TRT_LEN _IOR(ACPI_THERMAL_MAGIC, 1, unsigned long)
10 #define ACPI_THERMAL_GET_ART_LEN _IOR(ACPI_THERMAL_MAGIC, 2, unsigned long)
11 #define ACPI_THERMAL_GET_TRT_COUNT _IOR(ACPI_THERMAL_MAGIC, 3, unsigned long)
12 #define ACPI_THERMAL_GET_ART_COUNT _IOR(ACPI_THERMAL_MAGIC, 4, unsigned long)
13 
14 #define ACPI_THERMAL_GET_TRT	_IOR(ACPI_THERMAL_MAGIC, 5, unsigned long)
15 #define ACPI_THERMAL_GET_ART	_IOR(ACPI_THERMAL_MAGIC, 6, unsigned long)
16 
17 struct art {
18 	acpi_handle source;
19 	acpi_handle target;
20 	u64 weight;
21 	u64 ac0_max;
22 	u64 ac1_max;
23 	u64 ac2_max;
24 	u64 ac3_max;
25 	u64 ac4_max;
26 	u64 ac5_max;
27 	u64 ac6_max;
28 	u64 ac7_max;
29 	u64 ac8_max;
30 	u64 ac9_max;
31 } __packed;
32 
33 struct trt {
34 	acpi_handle source;
35 	acpi_handle target;
36 	u64 influence;
37 	u64 sample_period;
38 	u64 reserved1;
39 	u64 reserved2;
40 	u64 reserved3;
41 	u64 reserved4;
42 } __packed;
43 
44 #define ACPI_NR_ART_ELEMENTS 13
45 /* for usrspace */
46 union art_object {
47 	struct {
48 		char source_device[8]; /* ACPI single name */
49 		char target_device[8]; /* ACPI single name */
50 		u64 weight;
51 		u64 ac0_max_level;
52 		u64 ac1_max_level;
53 		u64 ac2_max_level;
54 		u64 ac3_max_level;
55 		u64 ac4_max_level;
56 		u64 ac5_max_level;
57 		u64 ac6_max_level;
58 		u64 ac7_max_level;
59 		u64 ac8_max_level;
60 		u64 ac9_max_level;
61 	};
62 	u64 __data[ACPI_NR_ART_ELEMENTS];
63 };
64 
65 union trt_object {
66 	struct {
67 		char source_device[8]; /* ACPI single name */
68 		char target_device[8]; /* ACPI single name */
69 		u64 influence;
70 		u64 sample_period;
71 		u64 reserved[4];
72 	};
73 	u64 __data[8];
74 };
75 
76 #ifdef __KERNEL__
77 int acpi_thermal_rel_misc_device_add(acpi_handle handle);
78 int acpi_thermal_rel_misc_device_remove(acpi_handle handle);
79 int acpi_parse_art(acpi_handle handle, int *art_count, struct art **arts,
80 		bool create_dev);
81 int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trts,
82 		bool create_dev);
83 #endif
84 
85 #endif /* __ACPI_ACPI_THERMAL_H */
86