mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabriel C <nix.or.die@googlemail.com>
To: Justin Piszcz <jpiszcz@lucidpixels.com>
Cc: Gabriel C <crazy@frugalware.org>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Dan Williams <dan.j.williams@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	Andriy Gapon <avg@icyb.net.ua>
Subject: Re: [lm-sensors] Status/support for Linux HECI from Intel? (for  temp/voltage monitoring)
Date: Mon, 4 Jan 2010 14:51:08 +0100	[thread overview]
Message-ID: <1820d69d1001040551k26cfd925q4ada6b226740ac30@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0902121236120.19381@p34.internal.lan>

[-- Attachment #1: Type: text/plain, Size: 3231 bytes --]

2009/2/12 Justin Piszcz <jpiszcz@lucidpixels.com>:
>
>
> On Thu, 12 Feb 2009, Gabriel C wrote:
>
>> Maxim Levitsky wrote:
>>
>>> On Wed, 2009-01-07 at 11:42 -0500, Justin Piszcz wrote:
>>>>
>>>> On Wed, 7 Jan 2009, Dan Williams wrote:
>>>>
>>>>> Justin Piszcz wrote:
>>>>>>
>>>>>> The HECI interface would allow lm_sensors developers to grab the
>>>>>> temperatures off the chips on the board.
>>>>>>
>>>>>> From 2005(?)-2008 there was some chatter about supporting it but it
>>>>>> never
>>>>>> seemed to happen, is there any eventual planned support for supporting
>>>>>> Intel's HECI interface or if the user wants to see the
>>>>>> temperatures/voltages just buy a different motherboard with an ITE I/O
>>>>>> controller?
>>>>>>
>>>>>> I have a couple DG965WH boards and it would be nice to see the
>>>>>> temperature of the chipset etc without having to reboot into the BIOS.
>>>>>>
>>>>> Hi Justin,
>>>>>
>>>>> I am not up to date on the progress in this area, but perhaps this site
>>>>> (http://www.openamt.org/) has what you are looking for?
>>>>>
>>>>> Regards,
>>>>> Dan
>>>>>
>>>> Yeah that is the site-- however, will it ever get merged?  I have not
>>>> heard anything about it for a year or so.
>>>
>>> Nope, the heci is just a controller, but we need a way to tell that
>>> controller to show us the temperature data.
>>> But intel hasn't released the QST sdk, and probably never will.
>>>
>>> Sad,
>>
>>
>> Well I found this interesting thread about :
>>
>>
>> http://software.intel.com/en-us/forums/manageability-software-development/topic/54851/
>>
>> It looks like the QST SDK already exists and is planned to be released..
>> (
>>  http://software.intel.com/en-us/forums/manageability-software-development/topic/54851/reply/74068/
>> )
> I volunteer to test any patches if/when they are created after the SDK is
> released.
>


Again me .. Well the SDK is *still* not released ..  The Intel folks
said back in August :

"The latest word is that the SDK is being prepared for approval but it
is contingent upon an upcoming platform release."

( whatever that means )


Anyway Andriy Gapon has posted on lm-sensors some nice tool to read
the sensors output ( thx :) )
(http://lists.lm-sensors.org/pipermail/lm-sensors/2009-October/026830.html)

Today I'm out from hospital so I've decided to quick hack this tool
and make it work on Linux.

Here the output from my DQ45CB mobo:

crazy@thor:~/INTEL/QST/Li$ sudo ./heci-qst
CPU  Temp:      56.00   °C
MB   Temp:      31.14   °C
ICH  Temp:      67.37   °C
MCH  Temp:      66.00   °C
CPU  Fan:       1080    RPM
INL  Fan:       1202    RPM
OUTL Fan:       288     RPM
+12  Volts:     11.965  V
+5   Volts:     5.021   V
+3.3 Volts:     3.316   V
MCH  Vccp:      1.122   V
CPU1 Vccp:      1.125   V

Justin I know is not based on released SDK of Intel but maybe you
still want to do some tests ?:)

( of course you need the heci kernel modules first )

@Andriy there is a smallish bug in your original code .. you should
use ..... , abs(value) ...., abs(value) ...);
that will solve the negative CPU TEMP values you get with your version.

Best Regards,

Gabriel C

[-- Attachment #2: heci-qst-linux.c --]
[-- Type: application/octet-stream, Size: 6048 bytes --]

/*-
 * Copyright (c) 2009 Andriy Gapon <avg@icyb.net.ua>
 * Copyright (c) 2009 Gabriel Craciunescu <crazy@frugalware.org>
 * ( Added some Linux support )
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/ioctl.h>
#include <inttypes.h>

/* heci.h in linux is broken ... what a surprise :P */

struct guid
{
        uint32_t   data1;
        uint16_t   data2;
        uint16_t   data3;
        uint8_t   data4[8];

};

struct heci_message_data
{
        uint32_t size;
        char *data;
}__attribute__((packed));


#undef IOCTL_HECI_CONNECT_CLIENT
#define IOCTL_HECI_CONNECT_CLIENT _IOWR(0x48, 0x01, struct heci_message_data)

struct therm_sensor
{
	int8_t valid;
	int32_t value;
} __attribute__((packed));

struct volt_sensor
{
	int8_t valid;
	int32_t value;
} __attribute__((packed));

struct fan_sensor
{
	int8_t valid;
	int16_t value;
} __attribute__((packed));

#define THERM_SENSOR_COUNT	12
struct therm_data
{
	int8_t status;
	struct therm_sensor data[THERM_SENSOR_COUNT];
} __attribute__((packed));

#define VOLT_SENSOR_COUNT	8
struct volt_data
{
	int8_t status;
	struct volt_sensor data[VOLT_SENSOR_COUNT];
} __attribute__((packed));

#define FAN_SENSOR_COUNT	8
struct fan_data
{
	int8_t status;
	struct fan_sensor data[FAN_SENSOR_COUNT];
} __attribute__((packed));

struct qst_cmd
{
	uint8_t cmd;
	uint16_t in_len;
	uint16_t out_len;
} __attribute__((packed));


#define QST_THERMAL_CMD		0x12
static const struct qst_cmd therm_cmd = { QST_THERMAL_CMD, 0, sizeof(struct therm_data) };

#define QST_VOLT_CMD		0x58
static const struct qst_cmd volt_cmd = { QST_VOLT_CMD, 0, sizeof(struct volt_data) };

#define QST_FAN_CMD		0x37
static const struct qst_cmd fan_cmd = { QST_FAN_CMD, 0, sizeof(struct fan_data) };

/* Hmmmm seems the output is different depeinding on chipset / ICH version */
/* On my DQ45CB ( ICH10DO / Q45 ) mobo this is right
  also is the same output Intel Desktop Utils is giving me */

const char * const temp_names[THERM_SENSOR_COUNT] = {
	"CPU  Temp",
	"MB   Temp",
	"ICH  Temp",
	"MCH  Temp",
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
};

const char * const volt_names[VOLT_SENSOR_COUNT] = {
	"+12  Volts",
	"+5   Volts",
	"+3.3 Volts",
	"MCH  Vccp",
	"CPU1 Vccp",
	NULL,
	NULL,
	NULL,
};

const char * const fan_names[FAN_SENSOR_COUNT] = {
	"CPU  Fan",
	"INL  Fan",
	"OUTL Fan",
	"AUX  Fan",
	NULL,
	NULL,
	NULL,
	NULL,
};


static const struct guid _hwm_guid = {
	0x6B5205B9,
	0x8185,
	0x4519,
	{0xB8, 0x89, 0xD9, 0x87, 0x24, 0xB5, 0x86, 0x07}
};


int main()
{
	int fd;
	int rc;
	int i;
	struct heci_message_data hwm_guid;

	fd = open("/dev/heci", O_RDWR);
	if (fd < 0) {
		perror("/dev/heci");
		fprintf(stderr, "Please load the HECI Kernel module first!\n");
		return 1;
	}

	hwm_guid.size = sizeof(struct guid);
	hwm_guid.data = (char *)malloc(hwm_guid.size);

	if(!hwm_guid.data) {
		fprintf(stderr, "malloc failure.\n");
		return 1;
	}

	memcpy(hwm_guid.data, &_hwm_guid, sizeof(_hwm_guid));
	rc = ioctl(fd, IOCTL_HECI_CONNECT_CLIENT, &hwm_guid);

	if (rc < 0) {
		perror("ioctl IOCTL_HECI_CONNECT_CLIENT");
		return 1;
	}
	/* Request temp. */
	struct therm_data therm_data;
	rc = write(fd, &therm_cmd, sizeof(therm_cmd));
	if (rc < 0) {
		perror("therm write");
		return 1;
	}

	rc = read(fd, &therm_data, sizeof(therm_data));
	if (rc < 0) {
		perror("therm read");
		return 1;
	}

	for (i = 0; i < THERM_SENSOR_COUNT; i++) {
		if (therm_data.data[i].valid) {
			int32_t value = therm_data.data[i].value;
			if (temp_names[i])
				printf("%s", temp_names[i]);
			else
				printf("%02d", i);
			printf(":\t%d.%02d \t°C\n", abs(value) / 100, abs(value) % 100);
		}
	}

	/* Request fans */
	struct fan_data fan_data;
	rc = write(fd, &fan_cmd, sizeof(fan_cmd));
	if (rc < 0) {
		perror("fan write");
		return 1;
	}

	rc = read(fd, &fan_data, sizeof(fan_data));
	if (rc < 0) {
		perror("fan read");
		return 1;
	}
	for (i = 0; i < FAN_SENSOR_COUNT; i++) {
		if (fan_data.data[i].valid) {
			int32_t value = fan_data.data[i].value;

			if (fan_names[i])
				printf("%s", fan_names[i]);
			else
				printf("%02d", i);
			printf(":\t%d \tRPM\n", value);
		}
	}

	/* Request volts. */
	struct volt_data volt_data;
	rc = write(fd, &volt_cmd, sizeof(volt_cmd));
	if (rc < 0) {
		perror("volts write");
		return 1;
	}

	rc = read(fd, &volt_data, sizeof(volt_data));
	if (rc < 0) {
		perror("volts read");
		return 1;
	}
	for (i = 0; i < VOLT_SENSOR_COUNT; i++) {
		if (volt_data.data[i].valid) {
			int32_t value = volt_data.data[i].value;

			if (volt_names[i])
				printf("%s", volt_names[i]);
			else
				printf("%02d", i);
			printf(":\t%d.%03d \tV\n", abs(value) / 1000, abs(value) % 1000);
		}
	}
	close(fd);
	return 0;
}


  reply	other threads:[~2010-01-04 13:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 12:26 Justin Piszcz
2009-01-07 16:41 ` Dan Williams
2009-01-07 16:42   ` Justin Piszcz
2009-01-07 19:21     ` Maxim Levitsky
2009-02-12  1:35       ` [lm-sensors] " Gabriel C
2009-02-12  2:36         ` Joshua D Doll
2009-02-12 17:39         ` Justin Piszcz
2010-01-04 13:51           ` Gabriel C [this message]
2010-01-04 13:54             ` Justin Piszcz
2010-01-04 14:09               ` Gabriel C
2010-01-04 14:22                 ` Justin Piszcz
2010-01-04 14:43                   ` Gabriel C
2010-01-04 14:55                     ` Justin Piszcz
2010-01-04 15:07                       ` Gabriel C
2010-01-13  8:19             ` Andriy Gapon
2010-02-23 17:56           ` Gabriel C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1820d69d1001040551k26cfd925q4ada6b226740ac30@mail.gmail.com \
    --to=nix.or.die@googlemail.com \
    --cc=avg@icyb.net.ua \
    --cc=crazy@frugalware.org \
    --cc=dan.j.williams@intel.com \
    --cc=jpiszcz@lucidpixels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=maximlevitsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®