From owner-freebsd-current@FreeBSD.ORG Thu Mar 12 03:00:53 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A29F1106566B for ; Thu, 12 Mar 2009 03:00:53 +0000 (UTC) (envelope-from sektie@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.174]) by mx1.freebsd.org (Postfix) with ESMTP id 6AF998FC0C for ; Thu, 12 Mar 2009 03:00:53 +0000 (UTC) (envelope-from sektie@gmail.com) Received: by wf-out-1314.google.com with SMTP id 27so335651wfd.7 for ; Wed, 11 Mar 2009 20:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=9m3TbSHzG3wIXiu3TxjX4Up77rLhvXFcvEkB9XRufc4=; b=ZKeB3moRfa18SZtJpAbD4o222CKXjhnZ1FEPwPzCxq53KdCxM0C2iVPcYJGFWt5eoh 8gSxb/lKsTOg9XFadymY367WeS9mNv8aV3rEj9RnxPcgT925DkgbgxTF5SamL4M5/nE5 A38RkQA4KSDEfl/lj17SJXwAOc9gWZ589vwd0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=NcTOFV90CxG86y2klmw8EozXP3aOqvStAiPIbROlvS9y/jdC40scuO0kOwKStkFQWl npvuXvi2gclZMKoQJ5MMMcwGqIZk0FmDgWmpOC2mKUplv8C2KomYH1SRN5LmRcRz2kS+ 3Fgc+OeQV0penATgTTRRwOMa0qQTjcxl/XkFk= MIME-Version: 1.0 Sender: sektie@gmail.com Received: by 10.143.6.19 with SMTP id j19mr4049408wfi.128.1236825481500; Wed, 11 Mar 2009 19:38:01 -0700 (PDT) Date: Wed, 11 Mar 2009 19:38:01 -0700 X-Google-Sender-Auth: 57a4452d3ab2976e Message-ID: From: Randi Harper To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: ktemp(8) on Phenom II X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2009 03:00:53 -0000 I'm not subscribed to current, so if you reply, make sure you include me in the CC. :) This adds support for all 4 cores of the Phenom II - although I'm not really sure why you'd need it. Please test, as I have no idea if this is going to break anything or if I did something obviously wrong. Works fine on my box, but I am *so* not a developer. Also, I didn't try it on current. Apply the patch referred to earlier in this thread before applying this one, or clearly it's not going to work. [root@deviant ~]# uname -a FreeBSD deviant.freebsdgirl.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 [root@deviant ~]# sysctl dev.cpu | grep temperature dev.cpu.0.temperature: 40.0C dev.cpu.1.temperature: 40.0C dev.cpu.2.temperature: 40.0C dev.cpu.3.temperature: 40.0C -- randi --- k8temp.c.orig 2009-03-12 10:25:41.000000000 -0700 +++ k8temp.c 2009-03-12 10:21:54.000000000 -0700 @@ -51,10 +51,16 @@ typedef enum { SENSOR0_CORE0, SENSOR0_CORE1, + SENSOR0_CORE2, + SENSOR0_CORE3, SENSOR1_CORE0, SENSOR1_CORE1, + SENSOR1_CORE2, + SENSOR1_CORE3, CORE0, - CORE1 + CORE1, + CORE2, + CORE3 } k8sensor_t; struct k8temp_softc { @@ -62,7 +68,7 @@ int sc_temps[4]; int sc_ntemps; struct sysctl_oid *sc_oid; - struct sysctl_oid *sc_sysctl_cpu[2]; + struct sysctl_oid *sc_sysctl_cpu[4]; struct intr_config_hook sc_ich; int32_t (*sc_gettemp)(device_t, k8sensor_t); }; @@ -227,6 +233,18 @@ OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, dev, SENSOR0_CORE1, k8temp_sysctl, "IK", "Sensor 0 / Core 1 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core2", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR0_CORE2, k8temp_sysctl, "IK", + "Sensor 0 / Core 2 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core3", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR0_CORE3, k8temp_sysctl, "IK", + "Sensor 0 / Core 3 temperature"); sysctlnode = SYSCTL_ADD_NODE(sysctlctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor1", @@ -244,6 +262,18 @@ dev, SENSOR1_CORE1, k8temp_sysctl, "IK", "Sensor 1 / Core 1 temperature"); + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core2", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR1_CORE2, k8temp_sysctl, "IK", + "Sensor 1 / Core 2 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core3", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR1_CORE3, k8temp_sysctl, "IK", + "Sensor 1 / Core 3 temperature"); + return (0); } @@ -264,7 +294,7 @@ nexus = device_find_child(root_bus, "nexus", 0); acpi = device_find_child(nexus, "acpi", 0); - for (i = 0; i < 2; i++) { + for (i = 0; i < 4; i++) { cpu = device_find_child(acpi, "cpu", device_get_unit(dev) * 2 + i); if (cpu) { @@ -315,6 +345,16 @@ auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE1); temp = imax(auxtemp[0], auxtemp[1]); break; + case CORE2: + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE2); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE2); + temp = imax(auxtemp[0], auxtemp[1]); + break; + case CORE3: + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE3); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE3); + temp = imax(auxtemp[0], auxtemp[1]); + break; default: temp = sc->sc_gettemp(dev, arg2); break;