summaryrefslogtreecommitdiff
path: root/sysutils/mbmon
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2005-12-21 14:03:54 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2005-12-21 14:03:54 +0000
commite78bd3f1186e6da56397af4d0e777e3959b0fd22 (patch)
tree50d11d526fbe207836d3e58abc4c44852bd0b955 /sysutils/mbmon
parent- now p5-MIME-Base64 is compatible on perl 5.005, however, another dependency (diff)
Fix reading temperature and voltage from ADM1027 sensors:
- Don't add offsets, they are added automatically by the chip. - Make sure to read all registers with MSBs after reading from the extended resoltion register, otherwise they stay locked. This makes mbmon actually work on Asus S2882-D Opteron server motherboards with the ADM1027 chip, using amdpm(4) + smb(4). (Except it doesn't show the 4th FAN RPM counter; fix not committed at this time.) In collaboration with: Vsevolod Lobko
Notes
Notes: svn path=/head/; revision=151751
Diffstat (limited to 'sysutils/mbmon')
-rw-r--r--sysutils/mbmon/Makefile2
-rw-r--r--sysutils/mbmon/files/patch-sens_lm85.c71
2 files changed, 72 insertions, 1 deletions
diff --git a/sysutils/mbmon/Makefile b/sysutils/mbmon/Makefile
index 139afddb9b78..3f89b2928141 100644
--- a/sysutils/mbmon/Makefile
+++ b/sysutils/mbmon/Makefile
@@ -7,7 +7,7 @@
PORTNAME= xmbmon
PORTVERSION= 205
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= sysutils
MASTER_SITES= http://www.nt.phys.kyushu-u.ac.jp/shimizu/download/xmbmon/
.if defined(WITHOUT_X11)
diff --git a/sysutils/mbmon/files/patch-sens_lm85.c b/sysutils/mbmon/files/patch-sens_lm85.c
new file mode 100644
index 000000000000..3caa2c7a9754
--- /dev/null
+++ b/sysutils/mbmon/files/patch-sens_lm85.c
@@ -0,0 +1,71 @@
+$FreeBSD$
+
+--- sens_lm85.c Mon Oct 13 10:12:58 2003
++++ sens_lm85.c Wed Dec 21 15:37:56 2005
+@@ -53,7 +53,6 @@
+ #define ADM_24FAN(nr) (0x28 + (nr))
+ #define ADM_24FANDIV 0x47
+ #define ADM_24MODE 0x16
+-#define ADM_TEMPOFF(nr) (0x70 + (nr))
+ #define ADM_EXTRES1 0x76
+ #define ADM_EXTRES2 0x77
+ #define ADM_FANPPR 0x7B
+@@ -213,7 +212,7 @@
+ static float lm85_temp( LM_METHODS *method, int no )
+ {
+ int n, ne;
+- float ext = 0.0, offset = 0.0;
++ float ext = 0.0;
+
+ if (no < 0 || 2 < no)
+ return 0xFFFF;
+@@ -226,18 +225,20 @@
+ } else if (lm85chipid >= ADM1027) {
+ ne = method->Read(ADM_EXTRES2);
+ ext = 0.25 * ((ne >> ((no + 1) * 2)) & 0x03);
+- n = method->Read(ADM_TEMPOFF(no));
+- if (n > 0x80)
+- n -= 0xFF;
+- offset = (float) n;
++ /* Unlock temperature registers. */
++ if (no != 0) method->Read(LM85_TEMP(0));
++ if (no != 1) method->Read(LM85_TEMP(1));
++ if (no != 2) method->Read(LM85_TEMP(2));
++ /* Unlock voltage register. */
++ method->Read(LM85_VOLT(4));
+ }
+ n = method->Read(LM85_TEMP(no));
+ if (n == 0x80)
+ return 0xFFFF;
+ else if (n > 0x80)
+- return (float) (n - 0xFF) + ext - offset;
++ return (float) (n - 0xFF) + ext;
+ else
+- return (float) n + ext - offset;
++ return (float) n + ext;
+ }
+
+
+@@ -262,10 +263,20 @@
+ return 0xFFFF;
+
+ if (lm85chipid >= ADM1027) {
+- if (no == 4)
++ if (no == 4) {
+ ne = method->Read(ADM_EXTRES2) & 0x03;
+- else
++ /* Unlock temperature registers. */
++ method->Read(LM85_TEMP(0));
++ method->Read(LM85_TEMP(1));
++ method->Read(LM85_TEMP(2));
++ } else {
+ ne = (method->Read(ADM_EXTRES1) >> (no * 2)) & 0x03;
++ /* Unlock voltage registers. */
++ if (no != 0) method->Read(LM85_VOLT(0));
++ if (no != 1) method->Read(LM85_VOLT(1));
++ if (no != 2) method->Read(LM85_VOLT(2));
++ if (no != 3) method->Read(LM85_VOLT(3));
++ }
+ }
+ n = method->Read(LM85_VOLT(no));
+ if (lm85chipid >= ADM1027)