Port-macppc archive

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

SMU support for PowerMac G5 11,2




Hi,

at length i implemented the initial support of SMU and sensors for PowerMac G5. Now it's possible to control fan RPM and see current temperature of the CPUs too.
At boot all fans are at the maximum RPM which makes it impossible to
work on G5 due to loud noise made by fans. With SMU we can control it and
set to values which make fans noiseless.
I implemented the necessary drivers with syctl and envsys support.

We also need to send "quisce" command to OFW at boot else
it's not possible to communicate with SMU. It just ignores my SMU commands in this case. Sending this command solves the issue. I spend several days figuring it out, thanks to FreeBSD i could fix it ;) Patches for quisce are attached.

Quastion:
----------
I'm not very familiar with envsys but is it possible to
make it control fan speed automatically depending on the current temperature ? Or is it better to control fan speed in the kernel space, like
Linux or FreeBSD kernels do it. I would appreciate any pointers here.
Currently i'm doing it with a shell script which runs periodically.
One odd thing i noticed is that if i set e.g. all fan speeds to 1500
but then do not read fan rpm back for a while, SMU automatically increases all fan speeds. If i read fan rpms periodically then it remains
at the speed which i configured last. Very odd.


I'll prepare the necessary SMU patches for commit shortly.

Regards


dmesg
------

smu0 at mainbus0 mbox 0x860c gpio 0x62 irq 53
smuiic0 at smu0iic0 at smu
iic0: I2C bus
smusat0 at smuiic0
system-clock at smuiic0 address 0xd4 not configured
smuiic1 at smu0
iic1 at smuiic1: I2C bus



Reading SMU sensors with sysctl
--------------------------------

# sysctl machdep.smu0
machdep.smu0.fans.drive_bay_a_intake.min_rpm = 1000
machdep.smu0.fans.drive_bay_a_intake.max_rpm = 4000
machdep.smu0.fans.drive_bay_a_intake.default_rpm = 4000
machdep.smu0.fans.drive_bay_a_intake.rpm = 1500
machdep.smu0.fans.backside.min_rpm = 1100
machdep.smu0.fans.backside.max_rpm = 3000
machdep.smu0.fans.backside.default_rpm = 3000
machdep.smu0.fans.backside.rpm = 1505
machdep.smu0.fans.cpu_a_intake.min_rpm = 485
machdep.smu0.fans.cpu_a_intake.max_rpm = 3200
machdep.smu0.fans.cpu_a_intake.default_rpm = 3200
machdep.smu0.fans.cpu_a_intake.rpm = 1500
machdep.smu0.fans.cpu_b_intake.min_rpm = 485
machdep.smu0.fans.cpu_b_intake.max_rpm = 3200
machdep.smu0.fans.cpu_b_intake.default_rpm = 3200
machdep.smu0.fans.cpu_b_intake.rpm = 1500
machdep.smu0.fans.cpu_a_exhaust.min_rpm = 500
machdep.smu0.fans.cpu_a_exhaust.max_rpm = 3200
machdep.smu0.fans.cpu_a_exhaust.default_rpm = 3200
machdep.smu0.fans.cpu_a_exhaust.rpm = 1500
machdep.smu0.fans.cpu_b_exhaust.min_rpm = 500
machdep.smu0.fans.cpu_b_exhaust.max_rpm = 3200
machdep.smu0.fans.cpu_b_exhaust.default_rpm = 3200
machdep.smu0.fans.cpu_b_exhaust.rpm = 1500
machdep.smu0.fans.expansion_slots_intake.min_rpm = 1560
machdep.smu0.fans.expansion_slots_intake.max_rpm = 4500
machdep.smu0.fans.expansion_slots_intake.default_rpm = 4500
machdep.smu0.fans.expansion_slots_intake.rpm = 1559

# sysctl machdep.smusat0                    # Temperature is in Celcius
machdep.smusat0.sensors.cpu_a0_vcore = 1
machdep.smusat0.sensors.cpu_a1_vcore = 1
machdep.smusat0.sensors.cpu_a0_diode_temp = 38
machdep.smusat0.sensors.cpu_a1_diode_temp = 37
machdep.smusat0.sensors.cpu_a0_core_current = 28
machdep.smusat0.sensors.cpu_a1_core_current = 22
machdep.smusat0.sensors.cpu_a0_curr = 195
machdep.smusat0.sensors.cpu_a0_volts = 0
machdep.smusat0.sensors.cpu_a0_temp = 988  <----- Too HOT !!! :)
machdep.smusat0.sensors.cpu_a1_temp = 782
machdep.smusat0.sensors.cpu_a1_curr = 4
machdep.smusat0.sensors.cpu_a1_volts = 5
machdep.smusat0.sensors.cpu_a1_core_ref = 0
machdep.smusat0.sensors.cpu_a0_core_ref = 0


Setting fan RPM
-----------------


sysctl -w machdep.smu0.fans.expansion_slots_intake.rpm=1500



Reading SMU sensors with envstat
---------------------------------

# envstat
Current CritMax WarnMax WarnMin CritMin Unit
[smu0]
DRIVE BAY A INTAKE: 1500 RPM BACKSIDE: 1500 RPM CPU A INTAKE: 1500 RPM CPU B INTAKE: 1499 RPM CPU A EXHAUST: 1500 RPM CPU B EXHAUST: 1499 RPM EXPANSION SLOTS INTAKE: 1559 RPM
[smusat0]
CPU A0 VCORE: 1 0 0 0 0 none CPU A1 VCORE: 1 0 0 0 0 none CPU A0 DIODE TEMP: 38.000 degC CPU A1 DIODE TEMP: 37.000 degC CPU A0 CORE CURRENT: 28 0 0 0 0 none CPU A1 CORE CURRENT: 22 0 0 0 0 none CPU A0 CURR: 195 0 0 0 0 none CPU A0 VOLTS: 0 0 0 0 0 none CPU A0 TEMP: 988.000 degC CPU A1 TEMP: 782.000 degC CPU A1 CURR: 4 0 0 0 0 none CPU A1 VOLTS: 5 0 0 0 0 none CPU A1 CORE REF: 0 0 0 0 0 none CPU A0 CORE REF: 0 0 0 0 0 none


Index: sys/arch/powerpc/oea/ofwoea_machdep.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/arch/powerpc/oea/ofwoea_machdep.c,v
retrieving revision 1.32
diff -u -r1.32 ofwoea_machdep.c
--- sys/arch/powerpc/oea/ofwoea_machdep.c       11 Apr 2013 17:13:15 -0000      
1.32
+++ sys/arch/powerpc/oea/ofwoea_machdep.c       13 Apr 2013 11:59:44 -0000
@@ -174,6 +174,10 @@
                model_init();
        }
 
+       if (strcmp(model_name, "PowerMac11,2") == 0 ||
+           strcmp(model_name, "PowerMac11,1") == 0)
+               OF_quiesce();
+
        /* Initialize bus_space */
        ofwoea_bus_space_init();
 
Index: sys/arch/powerpc/powerpc/openfirm.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/arch/powerpc/powerpc/openfirm.c,v
retrieving revision 1.21
diff -u -r1.21 openfirm.c
--- sys/arch/powerpc/powerpc/openfirm.c 17 Jul 2011 20:54:46 -0000      1.21
+++ sys/arch/powerpc/powerpc/openfirm.c 13 Apr 2013 11:59:22 -0000
@@ -722,6 +722,23 @@
        return status;
 }
 
+void
+OF_quiesce(void)
+{
+       static struct {
+               const char *name;
+               int nargs;
+               int nreturns;
+       } args = {
+               "quiesce",
+               0,
+               0,
+       };
+
+       ofw_stack();
+       openfirmware(&args);
+}
+
 /*
  * This version of bcopy doesn't work for overlapping regions!
  */
Index: sys/dev/ofw/openfirm.h
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/dev/ofw/openfirm.h,v
retrieving revision 1.29
diff -u -r1.29 openfirm.h
--- sys/dev/ofw/openfirm.h      28 Feb 2010 13:59:05 -0000      1.29
+++ sys/dev/ofw/openfirm.h      13 Apr 2013 12:00:07 -0000
@@ -97,6 +97,7 @@
 void   OF_exit(void) __dead;
 int    OF_interpret(const char *, int, int, ...);
 void   (*OF_set_callback(void(*)(void *)))(void *);
+void   OF_quiesce(void);
 int    openfirmware(void *);
 
 /*


Home | Main Index | Thread Index | Old Index