From owner-p4-projects@FreeBSD.ORG Sat May 26 11:31:18 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5206B16A46B; Sat, 26 May 2007 11:31:18 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E970116A41F for ; Sat, 26 May 2007 11:31:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id D9F9113C45B for ; Sat, 26 May 2007 11:31:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l4QBVHcC040639 for ; Sat, 26 May 2007 11:31:17 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l4QBVHsT040632 for perforce@freebsd.org; Sat, 26 May 2007 11:31:17 GMT (envelope-from rpaulo@FreeBSD.org) Date: Sat, 26 May 2007 11:31:17 GMT Message-Id: <200705261131.l4QBVHsT040632@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 120422 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 May 2007 11:31:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=120422 Change 120422 by rpaulo@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" }