summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev
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/arch/sparc64/dev
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/arch/sparc64/dev')
-rw-r--r--sys/arch/sparc64/dev/tda.c46
1 files changed, 45 insertions, 1 deletions
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);
+}