Hi, It may not be the proper solution to control the fans on macppc smu (G5) but the following patch allows me to work with my iMac G5 without losing my hearing capacity ...
$ sysctl hw.sensors hw.sensors.smu0.temp0=44.72 degC (CPU T-Diode) hw.sensors.smu0.fan0=1530 RPM (System Fan) hw.sensors.smu0.fan1=1530 RPM (CPU fan) hw.sensors.smu0.fan2=1530 RPM (Hard Drive) hw.sensors.smu0.volt0=11.87 VDC (CPU Voltage) hw.sensors.smu0.current0=0.63 A (CPU Current) hw.sensors.lmtemp0.temp0=51.00 degC $ The fan range are: smu0 at mainbus0 system: min-value: 1000 system: max-value: 4000 system: unmanage-value: 4000 cpu: min-value: 1500 cpu: max-value: 4400 cpu: unmanage-value: 4400 hd: min-value: 1800 hd: max-value: 6000 hd: unmanage-value: 6000 Thanks, Best -- Olivier Cherrier - Symacx.com mailto:o...@symacx.com
OpenBSD 5.9-beta (GENERIC) #20: Sun Jan 31 23:23:06 CET 2016 o...@napoleon.symacx.com:/usr/src/sys/arch/macppc/compile/GENERIC real mem = 536870912 (512MB) avail mem = 500060160 (476MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root: model PowerMac8,1 cpu0 at mainbus0: 970FX (Revision 0x300): 1800 MHz mem0 at mainbus0 spdmem0 at mem0: 512MB DDR SDRAM non-parity PC3200CL3.0 memc0 at mainbus0: u3 rev 0x39 kiic0 at memc0 offset 0xf8001000 iic0 at kiic0 "dart" at memc0 offset 0xf8033000 not configured "mpic" at memc0 offset 0xf8040000 not configured mpcpcibr0 at mainbus0 pci: u3-agp pci0 at mpcpcibr0 bus 0 pchb0 at pci0 dev 11 function 0 "Apple U3L AGP" rev 0x00 appleagp0 at pchb0 agp0 at appleagp0: aperture at 0x0, size 0x10000000 vgafb0 at pci0 dev 16 function 0 "NVIDIA GeForce FX Go 5200" rev 0xa1 wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation) wsdisplay0: screen 1-5 added (std, vt100 emulation) ht0 at mainbus0: u3-ht, 4 devices pci1 at ht0 bus 0 hpb0 at pci1 dev 1 function 0 "Apple Shasta PCI" rev 0x00: 85 sources pci2 at hpb0 bus 3 gem0 at pci2 dev 15 function 0 "Apple Shasta GMAC" rev 0x00: irq 40, address 00:0d:93:47:01:ec bmtphy0 at gem0 phy 0: BCM5221 100baseTX PHY, rev. 4 ppb0 at pci1 dev 2 function 0 "Apple Shasta PCI" rev 0x00 pci3 at ppb0 bus 1 macobio0 at pci3 dev 7 function 0 "Apple Shasta" rev 0x00 openpic0 at macobio0 offset 0x40000: version 0x4614 feature 7b0302 LE macgpio0 at macobio0 offset 0x50 "smu-doorbell" at macgpio0 offset 0x12 not configured "smu-interrupt" at macgpio0 offset 0xd not configured "programmer-switch" at macgpio0 offset 0xc not configured "modem-reset" at macgpio0 offset 0x8 not configured "modem-power" at macgpio0 offset 0x16 not configured "slewing-done" at macgpio0 offset 0x38 not configured "amp-mute" at macgpio0 offset 0x30 not configured "combo-out-sense" at macgpio0 offset 0x29 not configured "hw-reset" at macgpio0 offset 0x34 not configured "linein-detect" at macgpio0 offset 0x2a not configured "lineout-detect" at macgpio0 offset 0x28 not configured "lineout-mute" at macgpio0 offset 0x2e not configured "internal-speaker-id" at macgpio0 offset 0x33 not configured "escc-legacy" at macobio0 offset 0x12000 not configured zs0 at macobio0 offset 0x13000: irq 23,24 zstty0 at zs0 channel 0 zstty1 at zs0 channel 1 kiic1 at macobio0 offset 0x18000 iic1 at kiic1 onyx0 at macobio0 offset 0x0: irq 28,11,12 "timer" at macobio0 offset 0x15000 not configured "backlight" at macobio0 offset 0xf300 not configured audio0 at onyx0 bwi0 at pci3 dev 1 function 0 "Broadcom BCM4306" rev 0x03: irq 60, address 00:11:24:22:a6:ba ohci0 at pci3 dev 11 function 0 "NEC USB" rev 0x43: irq 70, version 1.0 ohci1 at pci3 dev 11 function 1 "NEC USB" rev 0x43: irq 70, version 1.0 ehci0 at pci3 dev 11 function 2 "NEC USB" rev 0x04: irq 70 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 "NEC EHCI root hub" rev 2.00/1.00 addr 1 usb1 at ohci0: USB revision 1.0 uhub1 at usb1 "NEC OHCI root hub" rev 1.00/1.00 addr 1 usb2 at ohci1: USB revision 1.0 uhub2 at usb2 "NEC OHCI root hub" rev 1.00/1.00 addr 1 ppb1 at pci1 dev 3 function 0 "Apple Shasta PCI" rev 0x00 pci4 at ppb1 bus 2 pciide0 at pci4 dev 12 function 0 "ServerWorks K2 SATA" rev 0x00: DMA pciide0: using irq 10 for native-PCI interrupt pciide0: port 0: 1.5Gb/s wd0 at pciide0 channel 0 drive 0: <WDC WD1600JD-40GBB2> wd0: 16-sector PIO, LBA48, 152627MB, 312581808 sectors wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5 pciide0: port 1: PHY offline kauaiata0 at pci4 dev 13 function 0 "Apple Shasta ATA" rev 0x00 wdc0 at kauaiata0 irq 38: DMA atapiscsi0 at wdc0 channel 0 drive 0 scsibus1 at atapiscsi0: 2 targets cd0 at scsibus1 targ 0 lun 0: <MATSHITA, DVD-R UJ-825, DBN7> ATAPI 5/cdrom removable cd0(wdc0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4 "Apple Shasta Firewire" rev 0x00 at pci4 dev 14 function 0 not configured smu0 at mainbus0 iic2 at smu0 lmtemp0 at iic2 addr 0x49: lm75 "smu-pulsar" at iic2 addr 0x6a not configured uhub3 at uhub1 port 2 "Mitsumi Electric Hub in Apple Extended USB Keyboard" rev 1.10/4.00 addr 2 uhidev0 at uhub3 port 2 configuration 1 interface 0 "Fujitsu Component Type 6 Mouse" rev 1.00/1.02 addr 3 uhidev0: iclass 3/1 ums0 at uhidev0: 3 buttons wsmouse0 at ums0 mux 0 uhidev1 at uhub3 port 3 configuration 1 interface 0 "Mitsumi Electric Apple Extended USB Keyboard" rev 1.10/4.00 addr 4 uhidev1: iclass 3/1 ukbd0 at uhidev1: 8 variable keys, 6 key codes, country code 13 wskbd0 at ukbd0: console keyboard, using wsdisplay0 uhidev2 at uhub3 port 3 configuration 1 interface 1 "Mitsumi Electric Apple Extended USB Keyboard" rev 1.10/4.00 addr 4 uhidev2: iclass 3/0, 3 report ids uhid0 at uhidev2 reportid 2: input=1, output=0, feature=0 uhid1 at uhidev2 reportid 3: input=3, output=0, feature=0 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets bootpath: /ht/pci@3/k2-sata-root/k2-sata@0/disk@0:/bsd root on wd0a (787a80921d72f7a1.a) swap on wd0b dump on wd0b
Index: smu.c =================================================================== RCS file: /data/OpenBSD_cvsync/src/sys/arch/macppc/dev/smu.c,v retrieving revision 1.27 diff -u -p -u -r1.27 smu.c --- smu.c 4 Jun 2015 18:01:44 -0000 1.27 +++ smu.c 31 Jan 2016 22:45:14 -0000 @@ -649,8 +649,40 @@ smu_refresh_sensors(void *arg) int i; rw_enter_write(&sc->sc_lock); - for (i = 0; i < sc->sc_num_sensors; i++) + int j; + u_int16_t val; + for (i = 0; i < sc->sc_num_sensors; i++) { smu_sensor_refresh(sc, &sc->sc_sensors[i]); + + /* Only take care of this CPU sensor for now. */ + if (strncmp(sc->sc_sensors[i].sensor.desc, "CPU T-Diode", + sizeof sc->sc_sensors[i].sensor.desc) == 0) { + int64_t temp = sc->sc_sensors[i].sensor.value; + temp -= 273150000; + temp /= 1000000; + /* Use this simple mechanism to start. It gives some + * results that seems to not be so bad. At least I + * can stay in front of my iMac G5 without wearing + * earplugs. The CPU didn't melt either for now. + * Your mileage may vary. */ + val = (u_int16_t)temp; + val *= val; + for (j = 0; j < sc->sc_num_fans; j++) { + /* The max speed of the system fan seems to be + * lower than the CPU one. */ + if (strncmp(sc->sc_fans[j].sensor.desc, + "System Fan", + sizeof sc->sc_fans[j].sensor.desc) == 0) + val -= 400; + if (val < sc->sc_fans[j].min_rpm) + val = sc->sc_fans[j].min_rpm; + if (val > sc->sc_fans[j].max_rpm) + val = sc->sc_fans[j].max_rpm; + + smu_fan_set_rpm(sc, &sc->sc_fans[j], val); + } + } + } for (i = 0; i < sc->sc_num_fans; i++) smu_fan_refresh(sc, &sc->sc_fans[i]); rw_exit_write(&sc->sc_lock);