summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2008-02-20 09:44:48 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2008-02-20 09:44:48 +0000
commitac77ddc5437d730485d40e45d815561181c18d11 (patch)
treeb69e62fd81877111c980e90c1162bbc8d323a08a /sys
parent7444b3884b447e65f1338853abfda93b9dd4897d (diff)
make tda(4) run the fans at maximum speed when we are about to drop
drop to ddb(4) in order to avoid overheating in case of a system crash. ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/conf/files.sparc644
-rw-r--r--sys/arch/sparc64/dev/tda.c46
-rw-r--r--sys/arch/sparc64/include/cpu.h4
-rw-r--r--sys/arch/sparc64/sparc64/db_interface.c8
4 files changed, 57 insertions, 5 deletions
diff --git a/sys/arch/sparc64/conf/files.sparc64 b/sys/arch/sparc64/conf/files.sparc64
index d46e3b1e2f4..d1f3f010175 100644
--- a/sys/arch/sparc64/conf/files.sparc64
+++ b/sys/arch/sparc64/conf/files.sparc64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.sparc64,v 1.94 2008/02/12 10:12:14 robert Exp $
+# $OpenBSD: files.sparc64,v 1.95 2008/02/20 09:44:47 robert Exp $
# $NetBSD: files.sparc64,v 1.50 2001/08/10 20:53:50 eeh Exp $
# maxpartitions must be first item in files.${ARCH}
@@ -314,7 +314,7 @@ file arch/sparc64/dev/pcf8591_envctrl.c ecadc
# TDA8444 (sparc64 only for now)
device tda
attach tda at i2c
-file arch/sparc64/dev/tda.c tda
+file arch/sparc64/dev/tda.c tda needs-flag
#
# Machine-independent GPIO drivers
diff --git a/sys/arch/sparc64/dev/tda.c b/sys/arch/sparc64/dev/tda.c
index eb00ac3ca72..ca5cdfa8d98 100644
--- a/sys/arch/sparc64/dev/tda.c
+++ b/sys/arch/sparc64/dev/tda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tda.c,v 1.2 2008/02/18 21:23:00 kettenis Exp $ */
+/* $OpenBSD: tda.c,v 1.3 2008/02/20 09:44:47 robert Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -74,6 +74,8 @@ struct cfdriver tda_cd = {
NULL, "tda", DV_DULL
};
+void *tda_cookie;
+
int
tda_match(struct device *parent, void *match, void *aux)
{
@@ -122,6 +124,8 @@ tda_attach(struct device *parent, struct device *self, void *aux)
printf("%s: unable to register update task\n", DEVNAME(sc));
return;
}
+
+ tda_cookie = sc;
}
void
@@ -218,3 +222,43 @@ tda_adjust(void *v)
out:
tda_setspeed(sc);
}
+
+/* This code gets called when we are about to drop to ddb,
+ * in order to operate the fans at full speed during the
+ * timeouts are not working.
+ */
+void
+tda_full_blast()
+{
+ struct tda_softc *sc = tda_cookie;
+ u_int8_t cmd[2];
+
+ if (sc == NULL)
+ return;
+
+ sc->sc_cfan_speed = sc->sc_sfan_speed = TDA_FANSPEED_MAX;
+
+ iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
+
+ cmd[0] = TDA_CPUFAN_REG;
+ cmd[1] = sc->sc_cfan_speed;
+ if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
+ sc->sc_addr, &cmd, sizeof(cmd), NULL, 0, 0)) {
+ printf("%s: cannot write cpu-fan register\n",
+ DEVNAME(sc));
+ iic_release_bus(sc->sc_tag, I2C_F_POLL);
+ return;
+ }
+
+ cmd[0] = TDA_SYSFAN_REG;
+ cmd[1] = sc->sc_sfan_speed;
+ if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
+ sc->sc_addr, &cmd, sizeof(cmd), NULL, 0, 0)) {
+ printf("%s: cannot write system-fan register\n",
+ DEVNAME(sc));
+ iic_release_bus(sc->sc_tag, I2C_F_POLL);
+ return;
+ }
+
+ iic_release_bus(sc->sc_tag, I2C_F_POLL);
+}
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index 7aadcad9a87..a78e72b34c8 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.54 2008/02/18 10:37:20 robert Exp $ */
+/* $OpenBSD: cpu.h,v 1.55 2008/02/20 09:44:47 robert Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -255,6 +255,8 @@ void zs_kgdb_init(void);
#endif
/* fb.c */
void fb_unblank(void);
+/* tda.c */
+void tda_full_blast(void);
/* kgdb_stub.c */
#ifdef KGDB
void kgdb_attach(int (*)(void *), void (*)(void *, int), void *);
diff --git a/sys/arch/sparc64/sparc64/db_interface.c b/sys/arch/sparc64/sparc64/db_interface.c
index 94dc495514e..b97e756765f 100644
--- a/sys/arch/sparc64/sparc64/db_interface.c
+++ b/sys/arch/sparc64/sparc64/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.24 2007/10/27 22:20:16 martin Exp $ */
+/* $OpenBSD: db_interface.c,v 1.25 2008/02/20 09:44:47 robert Exp $ */
/* $NetBSD: db_interface.c,v 1.61 2001/07/31 06:55:47 eeh Exp $ */
/*
@@ -59,6 +59,8 @@
#include "esp_sbus.h"
#endif
+#include "tda.h"
+
db_regs_t ddb_regs; /* register state */
extern void OF_enter(void);
@@ -259,6 +261,10 @@ kdb_trap(type, tf)
trap_trace_dis++;
+#if NTDA > 0
+ tda_full_blast();
+#endif
+
fb_unblank();
switch (type) {