PERFORCE change 120422 for review

Rui Paulo rpaulo at FreeBSD.org
Sat May 26 11:31:18 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=120422

Change 120422 by rpaulo at rpaulo_epsilon on 2007/05/26 11:31:01

	The temperature values/names were wrong. By inspecting
	Hardware Monitor for Mac OS X, I figured it out how
	to correctly fetch the temperature and also what are the
	appropriate names for the keys.

Affected files ...

.. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#2 edit
.. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#2 edit

Differences ...

==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#1 $
+ * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#2 $
  *
  */
 
@@ -75,7 +75,7 @@
 static int	asmc_fan_getvalue(device_t, const char *, int);
 static int	asmc_temp_getvalue(device_t, const char *);
 static int	asmc_sms_read(device_t, const char *, int16_t *);
-static int	asms_sms_calibrate(device_t);
+static void	asms_sms_calibrate(device_t);
 
 /*
  * Model functions.
@@ -373,7 +373,7 @@
 {
 	struct asmc_softc *sc = device_get_softc(dev);
 	int i, error = 1;
-	uint8_t buf[2];
+	uint8_t buf[4];
 
 	/*
 	 * Wait up to 5 seconds for SMS initialization.
@@ -399,7 +399,16 @@
 		device_printf(dev, "more than %d fans were detected. Please "
 			           "report this.", ASMC_MAXFANS);
 		sc->sc_nfan = ASMC_MAXFANS;
-	}			      
+	}
+
+	if (bootverbose) {
+		/*
+		 * XXX: The number of keys is a 32 bit buffer, but
+		 * right now Apple only uses the last 8 bit.
+		 */
+		asmc_key_read(dev, ASMC_NKEYS, buf, 4);
+		device_printf(dev, "number of keys: %d\n", buf[3]);
+	}	      
 
 	return error;
 }
@@ -605,9 +614,7 @@
 	if (asmc_key_read(dev, key, buf, 2) < 0)
 		return -1;
 
-	temp = buf[0] | ((buf[1] >> 6) * 25);
-
-	return temp;
+	return buf[0];
 }
 
 static int
@@ -651,7 +658,7 @@
 	return error;
 }
 
-static int
+static void
 asms_sms_calibrate(device_t dev)
 {
 	struct asmc_softc *sc = device_get_softc(dev);

==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#1 $
+ * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#2 $
  *
  */
 
@@ -80,6 +80,9 @@
 #define ASMC_CMDREAD		0x10
 #define ASMC_CMDWRITE		0x11
 
+/* Number of keys */
+#define ASMC_NKEYS		"#KEY"	/* RO; 4 bytes */ 
+
 /*
  * Fan control via SMC.
  */
@@ -120,16 +123,17 @@
  * 
  */
 
-#define ASMC_MB_TEMPS		{ "TB0T", "TC0D", "TC0P", "Th0H", "Th1H", \
-				  "Ts0P", NULL }
+#define ASMC_MB_TEMPS		{ "TB0T", "TN0P", "TN1P", "Th0H", "Th1H", \
+				  "TM0P", NULL }
 #define ASMC_MB_TEMPNAMES	{ "enclosure", "northbridge1", \
 				  "northbridge2", "heatsink1", \
 				  "heatsink2", "memory", }
-#define ASMC_MB_TEMPDESCS	{ "Enclosure Bottom", "Northbridge Point 1", \
+#define ASMC_MB_TEMPDESCS	{ "Enclosure Bottomside", \
+				  "Northbridge Point 1", \
 				  "Northbridge Point 2", "Heatsink 1", \
 				  "Heatsink 2", "Memory Bank A", }
 
-#define ASMC_MM_TEMPS		{ "TC0D", "TC0P", NULL }
+#define ASMC_MM_TEMPS		{ "TN0P", "TN1P", NULL }
 #define ASMC_MM_TEMPNAMES	{ "northbridge1", "northbridge2" }
 #define ASMC_MM_TEMPDESCS	{ "Northbridge Point 1", \
 				  "Northbridge Point 2" }


More information about the p4-projects mailing list