W83627DHG, steps to use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il Fri, Dec 29, 2006 at 07:50:54PM -0700, David Hubbard ha scritto: 
> Hi Rudolf,
> 
> It looks like there is some code in the kernel that could be extended
> to provide MSR data for the coretemp driver--maybe you already know
> about this?
> 
> >Btw, using /dev/cpuX/msr device you can read core temperatures, I just
> >copied the algorithm used by the kernel driver. Of course it's not
> >integrated with the rest of the hwmon subsystem...
> >If you're interested I can send you the source file as soon as I get
> >back to home.

I'm talking about an userspace application that read directly msr device
exposed by the kernel driver.
The program itself it's very trivial (I just added a bit of error checking so
it doesn't look so bad ;))

#include <stdio.h>
#include <stdint.h>

#define MSR_IA32_THERM_STATUS 0x019c
#define TJ_MAX 100

int main(void) {
	int cpus = 2;
	int i;
	char msr_name[64];
	FILE *msr;
	uint64_t val;
	int temp;

	for (i = 0; i < cpus; i++) {
		sprintf(msr_name, "/dev/cpu/%d/msr", i);

		msr = fopen(msr_name, "r");
		if (!msr) {
			perror("fopen()");
			return 1;
		}
		fseek(msr, MSR_IA32_THERM_STATUS, SEEK_SET);
		fread(&val, 8, 1, msr);
		fclose(msr);

		/* Valid bit */
		if (!(val & 0x80000000)) {
			fprintf(stderr, "Invalid reading for CPU %d\n", i);
			continue;
		}
		temp = TJ_MAX - ((val >> 16) & 0x7f);

		printf("CPU%d: %d?C\n", i, temp);
	}

	return 0;
}


What Rudolf wants (AFAICS) is a mean to call into the msr module from
the kernel.

Luca
-- 
Recursion n.:
	See Recursion.




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux