Re: ktemp(8) on Phenom II

Previous thread: Re: ata problems @ r189170 by Alexander Motin on Sunday, March 1, 2009 - 1:43 am. (1 message)

Next thread: Logitech QuickCam 9000 Pro by Rainer Hurling on Sunday, March 1, 2009 - 8:01 am. (17 messages)
From: Norikatsu Shigemura
Date: Sunday, March 1, 2009 - 2:16 am

Hi Rui!

	I got Phenom II machine.  But k8temp(8) doesn't work.
	DO you have any idea?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
hostb4@pci0:0:24:3:     class=0x060000 card=0x00000000 chip=0x12031022 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices (AMD)'
    device     = '(Family 10h) Athlon 64/Opteron/Sempron Miscellaneous Control'
    class      = bridge
    subclass   = HOST-PCI
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Rui Paulo
Date: Sunday, March 1, 2009 - 6:48 am

Hi,



Try replacing 0x1103 by 0x1203 in k8temp.c.

Does that work?

--
Rui Paulo

From: Norikatsu Shigemura
Date: Sunday, March 1, 2009 - 7:43 am

Hi Rui!

On Sun, 1 Mar 2009 13:48:28 +0000

	I got following results:

$ sysctl -a | fgrep -e k8 -e temperature
dev.cpu.0.temperature: 143
dev.cpu.1.temperature: 143
dev.k8temp.0.%desc: AMD K8 Thermal Sensors
dev.k8temp.0.%driver: k8temp
dev.k8temp.0.%parent: hostb4
dev.k8temp.0.sensor0.core0: 143
dev.k8temp.0.sensor0.core1: 143
dev.k8temp.0.sensor1.core0: 143
dev.k8temp.0.sensor1.core1: 143

	Accordingly BIOS reports CPU temperature is 32-36 celsius
	(=89-97 fahrenheit).  I don't know what is '143'.
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Rui Paulo
Date: Sunday, March 1, 2009 - 8:05 am

I see that AMD has changed the register layout on recent processors.  
I'll try to cook up something when I have the time.

Regards,
--
Rui Paulo

From: Norikatsu Shigemura
Date: Sunday, March 1, 2009 - 8:39 am

Hi Rui!

On Sun, 1 Mar 2009 15:05:08 +0000

	Thank you.  I'm waiting for your works! :D
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Rui Paulo
Date: Sunday, March 1, 2009 - 9:32 am

http://groups.google.com/group/alt.os.linux/browse_thread/thread/b282c7410fd88d61

This is basically what one needs to do. You can see the register  
offset and the bitmask that's needed to fetch the temperature. Note  
that I don't really want to see another driver just for this.

--
Rui Paulo

From: Norikatsu Shigemura
Date: Monday, March 9, 2009 - 10:06 am

Hi Rui!

On Sun, 1 Mar 2009 16:32:56 +0000

	I merged some new codes to k8temp(8), please review it.

	1. Add support 10th generation CPU.  I confirmed on Phenom II.
	   And maybe 11th is same.  Sorry, my Puma note became hardware
	   trouble.  So I don't confirm on it.

$ sysctl dev.cpu | grep temperature
dev.cpu.0.temperature: 35.5C
dev.cpu.1.temperature: 35.5C
$ sysctl dev.k8temp
dev.k8temp.0.%desc: AMD K8 Thermal Sensors
dev.k8temp.0.%driver: k8temp
dev.k8temp.0.%parent: hostb4

	2. Change integer to kelvin*10(integer) as sysctl type.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--- sys/dev/k8temp/k8temp.c.orig	2008-11-29 23:26:22.000000000 +0900
+++ sys/dev/k8temp/k8temp.c	2009-03-10 01:04:54.908034051 +0900
@@ -48,6 +48,15 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
+typedef enum {
+	SENSOR0_CORE0,
+	SENSOR0_CORE1,
+	SENSOR1_CORE0,
+	SENSOR1_CORE1,
+	CORE0,
+	CORE1
+} k8sensor_t;
+
 struct k8temp_softc {
 	device_t	sc_dev;
 	int		sc_temps[4];
@@ -55,36 +64,38 @@
 	struct sysctl_oid *sc_oid;
 	struct sysctl_oid *sc_sysctl_cpu[2];
 	struct intr_config_hook sc_ich;
+	int32_t (*sc_gettemp)(device_t, k8sensor_t);
 };
 
 #define VENDORID_AMD		0x1022
-#define DEVICEID_AMD_MISC	0x1103
+#define DEVICEID_AMD_MISC0F	0x1103
+#define DEVICEID_AMD_MISC10	0x1203
+#define DEVICEID_AMD_MISC11	0x1303
 
 static struct k8temp_product {
 	uint16_t	k8temp_vendorid;
 	uint16_t	k8temp_deviceid;
 } k8temp_products[] = {
-	{ VENDORID_AMD,	DEVICEID_AMD_MISC },
+	{ VENDORID_AMD,	DEVICEID_AMD_MISC0F },
+	{ VENDORID_AMD,	DEVICEID_AMD_MISC10 },
+	{ VENDORID_AMD,	DEVICEID_AMD_MISC11 },
 	{ 0, 0 }
 };
 
 /*
  * Register control
  */
-#define	K8TEMP_REG		0xe4
+#define	K8TEMP_REG0F		0xe4
 #define	K8TEMP_REG_SELSENSOR	0x40
 #define	K8TEMP_REG_SELCORE	0x04
 
-#define K8TEMP_MINTEMP		49	/* -49 C is the mininum temperature */
+#define	K8TEMP_REG		0xa4
 
-typedef enum ...
From: Rui Paulo
Date: Monday, March 9, 2009 - 12:30 pm

This looks ok, but I think we need to rename this driver to something  
more meaningful, like amdtemp.

Please commit this patch.

Thanks,
--
Rui Paulo

From: Norikatsu Shigemura
Date: Thursday, March 12, 2009 - 10:41 am

Hi Rui!

On Mon, 9 Mar 2009 19:30:13 +0000

	Thanks for your review.  But I cannot commit my patch.
	Because I am a ports committer, not src committer:-(.

	Thank you!
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Rui Paulo
Date: Thursday, March 12, 2009 - 10:47 am

Ok, then send the patch to me in mime format and I'll do it.

Regards,
--
Rui Paulo

From: Norikatsu Shigemura
Date: Thursday, March 12, 2009 - 10:58 am

Hi Rui!

On Thu, 12 Mar 2009 17:47:33 +0000

	Thank you, please!
From: Kurt Jaeger
Date: Monday, March 9, 2009 - 12:44 pm

Hi!


I have an quad-core CPU, see below. Your patch works, but
only displays values for the first two CPUs.

----------
CPU: AMD Phenom(tm) II X4 810 Processor (2608.81-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x100f42  Stepping = 2
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,<b23>>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,<b5>,<b6>,<b7>,Prefetch,<b9>,<b10>,<b12>,<b13>>
  TSC: P-state invariant
  Cores per package: 4
----------

#define DEVICEID_AMD_PHENOMII   0x1203


[...]
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00%
dev.cpu.0.temperature: 49.0C
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
[...]
dev.cpu.1.cx_usage: 100.00%
dev.cpu.1.temperature: 49.0C
dev.cpu.2.%desc: ACPI CPU
dev.cpu.2.%driver: cpu
[...]
dev.cpu.2.cx_lowest: C1
dev.cpu.2.cx_usage: 100.00%
dev.cpu.3.%desc: ACPI CPU
dev.cpu.3.%driver: cpu

Any ideas ?

-- 
pi@opsec.eu            +49 171 3101372                        11 years to go !
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Norikatsu Shigemura
Date: Thursday, March 12, 2009 - 10:49 am

Hi Kurt!

On Mon, 9 Mar 2009 20:44:55 +0100

	I re-read AMD's documents.  We can get only 1 data as CurTmp:
	current temperature, not by-cores from F3xA4 Reported
	Temperature Control Register.  So, in fact,
	dev.cpu.0.temperature == dev.cpu.1.temperature.
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Previous thread: Re: ata problems @ r189170 by Alexander Motin on Sunday, March 1, 2009 - 1:43 am. (1 message)

Next thread: Logitech QuickCam 9000 Pro by Rainer Hurling on Sunday, March 1, 2009 - 8:01 am. (17 messages)