xref: /haiku/src/add-ons/kernel/drivers/power/pch_thermal/pch_thermal.h (revision 3bb1319682044ab765f34cdfdabdbdfb12f23c95)
1*3bb13196SJérôme Duval /*
2*3bb13196SJérôme Duval  * Copyright 2020, Jérôme Duval, jerome.duval@gmail.com.
3*3bb13196SJérôme Duval  *
4*3bb13196SJérôme Duval  * Distributed under the terms of the MIT License.
5*3bb13196SJérôme Duval  */
6*3bb13196SJérôme Duval #ifndef _PCH_THERMAL_H
7*3bb13196SJérôme Duval #define _PCH_THERMAL_H
8*3bb13196SJérôme Duval 
9*3bb13196SJérôme Duval 
10*3bb13196SJérôme Duval enum { /* ioctl op-codes */
11*3bb13196SJérôme Duval 	drvOpGetThermalType = B_DEVICE_OP_CODES_END + 10001,
12*3bb13196SJérôme Duval };
13*3bb13196SJérôme Duval 
14*3bb13196SJérôme Duval 
15*3bb13196SJérôme Duval struct pch_thermal_type {
16*3bb13196SJérôme Duval 	/* Required fields for thermal devices */
17*3bb13196SJérôme Duval 	uint32 critical_temp;
18*3bb13196SJérôme Duval 	uint32 current_temp;
19*3bb13196SJérôme Duval 
20*3bb13196SJérôme Duval 	/* Optional HOT temp, S4 sleep threshold */
21*3bb13196SJérôme Duval 	uint32 hot_temp;
22*3bb13196SJérôme Duval };
23*3bb13196SJérôme Duval 
24*3bb13196SJérôme Duval // Registers
25*3bb13196SJérôme Duval #define PCH_THERMAL_TEMP			0x00
26*3bb13196SJérôme Duval #define PCH_THERMAL_TEMP_TSR_SHIFT		0
27*3bb13196SJérôme Duval #define PCH_THERMAL_TEMP_TSR_MASK		0xff
28*3bb13196SJérôme Duval #define PCH_THERMAL_TSC				0x04
29*3bb13196SJérôme Duval #define PCH_THERMAL_TSC_CPDE			(1 << 0)
30*3bb13196SJérôme Duval #define PCH_THERMAL_TSC_PLDB			(1 << 7)
31*3bb13196SJérôme Duval #define PCH_THERMAL_TSS				0x06
32*3bb13196SJérôme Duval #define PCH_THERMAL_TSS_SMIS			(1 << 2)
33*3bb13196SJérôme Duval #define PCH_THERMAL_TSS_GPES			(1 << 3)
34*3bb13196SJérôme Duval #define PCH_THERMAL_TSS_TSDSS			(1 << 4)
35*3bb13196SJérôme Duval #define PCH_THERMAL_TSEL			0x08
36*3bb13196SJérôme Duval #define PCH_THERMAL_TSEL_ETS			(1 << 0)
37*3bb13196SJérôme Duval #define PCH_THERMAL_TSEL_PLDB			(1 << 7)
38*3bb13196SJérôme Duval #define PCH_THERMAL_TSREL			0x0a
39*3bb13196SJérôme Duval #define PCH_THERMAL_TSREL_ESTR			(1 << 0)
40*3bb13196SJérôme Duval #define PCH_THERMAL_TSREL_PLDB			(1 << 7)
41*3bb13196SJérôme Duval #define PCH_THERMAL_TSMIC			0x0c
42*3bb13196SJérôme Duval #define PCH_THERMAL_TSMIC_ATST			(1 << 0)
43*3bb13196SJérôme Duval #define PCH_THERMAL_TSMIC_PLDB			(1 << 7)
44*3bb13196SJérôme Duval #define PCH_THERMAL_CTT				0x10
45*3bb13196SJérôme Duval #define PCH_THERMAL_CTT_CTRIP_SHIFT		0
46*3bb13196SJérôme Duval #define PCH_THERMAL_CTT_CTRIP_MASK		0x1ff
47*3bb13196SJérôme Duval #define PCH_THERMAL_TAHV			0x14
48*3bb13196SJérôme Duval #define PCH_THERMAL_TAHV_AH_SHIFT		0
49*3bb13196SJérôme Duval #define PCH_THERMAL_TAHV_AH_MASK		0x1ff
50*3bb13196SJérôme Duval #define PCH_THERMAL_TALV			0x18
51*3bb13196SJérôme Duval #define PCH_THERMAL_TALV_AL_SHIFT		0
52*3bb13196SJérôme Duval #define PCH_THERMAL_TALV_AL_MASK		0x1ff
53*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM			0x1c
54*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_LTT_SHIFT		0
55*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_LTT_MASK		0x1ff
56*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_MAXTSST_SHIFT	9
57*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_MAXTSST_MASK	0xf
58*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_DTSSIC0		(1 << 13)
59*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_DTSSS0EN		(1 << 14)
60*3bb13196SJérôme Duval #define PCH_THERMAL_TSPM_TSPMLOCK		(1 << 15)
61*3bb13196SJérôme Duval #define PCH_THERMAL_TL				0x40
62*3bb13196SJérôme Duval #define PCH_THERMAL_TL_T0L_SHIFT		0
63*3bb13196SJérôme Duval #define PCH_THERMAL_TL_T0L_MASK			0x1ff
64*3bb13196SJérôme Duval #define PCH_THERMAL_TL_T1L_SHIFT		10
65*3bb13196SJérôme Duval #define PCH_THERMAL_TL_T1L_MASK			0x1ff
66*3bb13196SJérôme Duval #define PCH_THERMAL_TL_T2L_SHIFT		20
67*3bb13196SJérôme Duval #define PCH_THERMAL_TL_T2L_MASK			0x1ff
68*3bb13196SJérôme Duval #define PCH_THERMAL_TL_TTEN				(1 << 29)
69*3bb13196SJérôme Duval #define PCH_THERMAL_TL_TT13EN			(1 << 30)
70*3bb13196SJérôme Duval #define PCH_THERMAL_TL_TTL				(1 << 31)
71*3bb13196SJérôme Duval #define PCH_THERMAL_TL2				0x50
72*3bb13196SJérôme Duval #define PCH_THERMAL_TL2_TL2LOCK_SHIFT	15
73*3bb13196SJérôme Duval #define PCH_THERMAL_TL2_PCMTEN_SHIFT	16
74*3bb13196SJérôme Duval #define PCH_THERMAL_PHL				0x60
75*3bb13196SJérôme Duval #define PCH_THERMAL_PHL_PHLL_SHIFT		0
76*3bb13196SJérôme Duval #define PCH_THERMAL_PHL_PHLL_MASK		0x1ff
77*3bb13196SJérôme Duval #define PCH_THERMAL_PHL_PHLE			(1 << 15)
78*3bb13196SJérôme Duval #define PCH_THERMAL_PHLC			0x62
79*3bb13196SJérôme Duval #define PCH_THERMAL_PHLC_PHLL			(1 << 0)
80*3bb13196SJérôme Duval #define PCH_THERMAL_TAS				0x80
81*3bb13196SJérôme Duval #define PCH_THERMAL_TAS_ALHE			(1 << 0)
82*3bb13196SJérôme Duval #define PCH_THERMAL_TAS_AHLE			(1 << 1)
83*3bb13196SJérôme Duval #define PCH_THERMAL_TSPIEN			0x82
84*3bb13196SJérôme Duval #define PCH_THERMAL_TSPIEN_ALHEN		(1 << 0)
85*3bb13196SJérôme Duval #define PCH_THERMAL_TSPIEN_AHLEN		(1 << 1)
86*3bb13196SJérôme Duval #define PCH_THERMAL_TSGPEN			0x84
87*3bb13196SJérôme Duval #define PCH_THERMAL_TSGPEN_ALHEN		(1 << 0)
88*3bb13196SJérôme Duval #define PCH_THERMAL_TSGPEN_AHLEN		(1 << 1)
89*3bb13196SJérôme Duval #define PCH_THERMAL_TCFD			0xf0
90*3bb13196SJérôme Duval #define PCH_THERMAL_TCFD_TCD			(1 << 0)
91*3bb13196SJérôme Duval 
92*3bb13196SJérôme Duval 
93*3bb13196SJérôme Duval #endif // _PCH_THERMAL_H
94*3bb13196SJérôme Duval 
95