+ * BIOS and Kernel Developer’s Guide for AMD NPT Family 0Fh Processors
+ * 32559 Rev. 3.16 November 2009
*/
-#define AMDTEMP_THERMTP_STAT 0xe4
-#define AMDTEMP_TTSR_SELCORE 0x04
-#define AMDTEMP_TTSR_SELSENSOR 0x40
+/* D18F3xE4 Thermtrip Status Register */
+#define AMD_REG_THERMTRIP_STAT 0xe4
+union reg_amd_thermtrip_status_desc {
+ uint32_t u32;
+ struct reg_amd_thermtrip_status_bits {
+ uint32_t r0:1; /* 0 Reserved. */
+ uint32_t Thermtp:1; /* 1 ro The processor has entered the THERMTRIP state. */
+ uint32_t ThermSenseCoreSel:1; /* 2 rw */
+ uint32_t ThermtpSense0:1; /* 3 ro */
+ uint32_t ThermtpSense1:1; /* 4 ro */
+ uint32_t ThermtpEn:1; /* 5 ro The THERMTRIP state is supported by the processor. */
+ uint32_t ThermSenseSel:1; /* 6 rw */
+ uint32_t r1:1; /* 7 Reserved. */
+ uint32_t DiodeOffset:6; /* 13:8 ro Thermal diode offset is used to correct the measurement made by an external temperature sensor. */
+ uint32_t CurTmp:10; /* 23:14 ro This field returns the current value of the internal thermal sensor. */
+ uint32_t TjOffset:5; /* 28:24 ro This field is the offset from CurTmp used to normalize to Tcontrol. */
+ uint32_t r2:2; /* 30:29 Reserved. */
+ uint32_t SwThermtp:1; /* 31 rw */
+ } __packed bits;
+};
+
+/* DRAM Configuration High Register */
+#define AMD_REG_DRAM_CONF_HIGH 0x94 /* Function 2 */
+#define AMD_REG_DRAM_MODE_DDR3 0x0100
+
/*
- * DRAM Configuration High Register
+ * The default value of the HTC temperature threshold (Tctl_max) is specified
+ * in the AMD Family 14h Processor Power and Thermal Datasheet.
*/
-#define AMDTEMP_DRAM_CONF_HIGH 0x94 /* Function 2 */
-#define AMDTEMP_DRAM_MODE_DDR3 0x0100
+/* D18F3x64 Hardware Thermal Control (HTC) */
+#define AMD_REG_HTC_CTRL 0x64
+union reg_amd_htc_desc {
+ uint32_t u32;
+ struct reg_amd_htc_bits {
+ uint32_t HtcEn:1; /* 0 rw 1=HTC is enabled; the processor is capable of entering the HTC-active state. */
+ uint32_t r0:3; /* 3:1 Reserved. */
+ uint32_t HtcAct:1; /* 4 ro 1=The processor is currently in the HTC-active state. */
+ uint32_t HtcActSts:1; /* 5 ro Read; set-by-hardware; write-1-to-clear. Reset: 0. This bit is set by hardware when the processor enters the HTC-active state. It is cleared by writing a 1 to it. */
+ uint32_t HtcHystLmt:4; /* 27:24 rw HTC hysteresis. The processor exits the HTC active state when the temperature selected by HtcSlewSel is less than the HTC temperature limit (HtcTmpLmt) minus the HTC hysteresis (HtcHystLmt). */
+ { AMD_REG_THERMTRIP_STAT, 24, 5, (CTLFLAG_RD | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "TjOffset", "This field is the offset from CurTmp used to normalize to Tcontrol." },
+ { AMD_REG_THERMTRIP_STAT, 8, 6, (CTLFLAG_RD | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "DiodeOffset", "Thermal diode offset is used to correct the measurement made by an external temperature sensor." },
+ { AMD_REG_THERMTRIP_STAT, 5, 1, (CTLFLAG_RD | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "ThermtpEn", "The THERMTRIP state is supported by the processor." },
+ { AMD_REG_THERMTRIP_STAT, 1, 1, (CTLFLAG_RD | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "Thermtrip", "The processor has entered the THERMTRIP state." },
+ { AMD_REG_HTC_CTRL, 24, 4, (CTLFLAG_RW | CTLTYPE_INT), "IK", amdtemp_htc_temp_sysctl, "HtcHystLmt", "HTC hysteresis. The processor exits the HTC active state when the temperature selected by HtcSlewSel is less than the HTC temperature limit (HtcTmpLmt) minus the HTC hysteresis (HtcHystLmt)." },
+ { AMD_REG_HTC_CTRL, 0, 1, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "HtcEn", "HTC is enabled; the processor is capable of entering the HTC-active state." },
+ { AMD_REG_HTC_CTRL, 31, 1, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "HtcLock", "HtcPstateLimit, HtcHystLmt, HtcTmpLmt, and HtcEn are read-only." },
+ { AMD_REG_HTC_CTRL, 4, 1, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "HtcAct", "The processor is currently in the HTC-active state." },
+ { AMD_REG_HTC_CTRL, 5, 1, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "HtcActSts", "set-by-hardware; write-1-to-clear. Reset: 0. This bit is set by hardware when the processor enters the HTC-active state. It is cleared by writing a 1 to it." },
+ { AMD_REG_REPTMP_CTRL, 21,11, (CTLFLAG_RD | CTLTYPE_INT), "IK", amdtemp_rtc_temp_sysctl, "CurTmp", "Provides the current control temperature, Tctl, after the slew-rate controls have been applied." },
+ { AMD_REG_REPTMP_CTRL, 16, 2, (CTLFLAG_RW | CTLTYPE_INT), "IK", amdtemp_rtc_temp_sysctl, "CurTmpTjSel", "Specifies a value used to create Tctl." },
+ { AMD_REG_REPTMP_CTRL, 5, 2, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "TmpMaxDiffUp", "Specifies the maximum difference, (Tctlm - Tctl), when Tctl immediatly updates to Tctlm." },
+ { AMD_REG_REPTMP_CTRL, 8, 5, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "PerStepTimeDn", "Specifies the time that Tctlm must remain below Tctl before applying a 0.125 downward step." },
+ { AMD_REG_REPTMP_CTRL, 0, 5, (CTLFLAG_RW | CTLTYPE_UINT), "IU", amdtemp_sysctl_reg_bits, "PerStepTimeUp", "Specifies the time that Tctlm must remain above Tctl before applying a 0.125 upward step." },