patches/cooling.diff

90 lines
2.9 KiB
Diff
Raw Normal View History

2023-01-11 10:10:34 +01:00
Index: sys/dev/acpi/acpitz.c
===================================================================
RCS file: /home/cvs/src/sys/dev/acpi/acpitz.c,v
retrieving revision 1.58
diff -u -p -r1.58 acpitz.c
--- sys/dev/acpi/acpitz.c 6 Apr 2022 18:59:27 -0000 1.58
+++ sys/dev/acpi/acpitz.c 27 Jun 2022 07:42:36 -0000
@@ -224,6 +224,12 @@ acpitz_attach(struct device *parent, str
else
printf(": critical temperature is %d degC\n", KTOC(sc->sc_crt));
+ if ((sc->sc_psv = acpitz_gettempreading(sc, "_PSV")) == -1)
+ printf(" `--> no cpu throttle point defined\n");
+ else
+ printf(" `--> throttle cpu at %d degC\n", KTOC(sc->sc_psv));
+
+
sc->sc_hot = acpitz_gettempreading(sc, "_HOT");
sc->sc_tc1 = acpitz_getreading(sc, "_TC1");
sc->sc_tc2 = acpitz_getreading(sc, "_TC2");
@@ -383,8 +389,8 @@ acpitz_refresh(void *arg)
nperf = acpitz_perflevel;
if (sc->sc_psv <= sc->sc_tmp) {
/* Passive cooling enabled */
- dnprintf(1, "%s: enabling passive %d %d\n",
- DEVNAME(sc), sc->sc_tmp, sc->sc_psv);
+ printf("%s: enabling passive %d degC >= %d degC\n",
+ DEVNAME(sc), KTOC(sc->sc_tmp), KTOC(sc->sc_psv));
if (!sc->sc_pse)
sc->sc_acpi->sc_pse++;
sc->sc_pse = 1;
@@ -400,8 +406,8 @@ acpitz_refresh(void *arg)
}
else {
/* Passive cooling disabled, increase % */
- dnprintf(1, "%s: disabling passive %d %d\n",
- DEVNAME(sc), sc->sc_tmp, sc->sc_psv);
+ printf("%s: disabling passive %d degC < %d degC\n",
+ DEVNAME(sc), KTOC(sc->sc_tmp), KTOC(sc->sc_psv));
if (sc->sc_pse)
sc->sc_acpi->sc_pse--;
sc->sc_pse = 0;
Index: sys/arch/amd64/amd64/k1x-pstate.c
===================================================================
RCS file: /home/cvs/src/sys/arch/amd64/amd64/k1x-pstate.c,v
retrieving revision 1.11
diff -u -p -r1.11 k1x-pstate.c
--- sys/arch/amd64/amd64/k1x-pstate.c 11 Aug 2021 18:31:48 -0000 1.11
+++ sys/arch/amd64/amd64/k1x-pstate.c 27 Jun 2022 07:44:46 -0000
@@ -41,14 +41,8 @@
extern int setperf_prio;
-#define MSR_K1X_LIMIT 0xc0010061
#define MSR_K1X_CONTROL 0xc0010062
#define MSR_K1X_STATUS 0xc0010063
-#define MSR_K1X_CONFIG 0xc0010064
-
-/* MSR_K1X_LIMIT */
-#define K1X_PSTATE_MAX_VAL(x) (((x) >> 4) & 0x7)
-#define K1X_PSTATE_LIMIT(x) (((x)) & 0x7)
/* MSR_K1X_CONFIG */
#define K1X_FID(x) ((x) & 0x3f)
@@ -95,19 +89,15 @@ void
k1x_transition(struct k1x_cpu_state *cstate, int level)
{
u_int64_t msr;
- int i, cfid, fid = cstate->state_table[level].fid;
+ int cfid, fid = cstate->state_table[level].fid;
wrmsr(MSR_K1X_CONTROL, fid);
- for (i = 0; i < 100; i++) {
- msr = rdmsr(MSR_K1X_STATUS);
- cfid = K1X_FID(msr);
- if (cfid == fid)
- break;
- DELAY(100);
- }
+ msr = rdmsr(MSR_K1X_STATUS);
+ cfid = K1X_FID(msr);
+
if (cfid == fid) {
cpuspeed = cstate->state_table[level].freq;
-#if 0
+#if 1
(void)printf("Target: %d Current: %d Pstate: %d\n",
cstate->state_table[level].freq,
cpuspeed, cfid);