# Fan control issue



## AtariAvenger (Oct 28, 2013)

Hi,

I have installed FreeBSD 9.2-RELEASE (amd64) on a system with a MSI P35-Neo motherboard. This motherboard utilises the Intel P35 and ICH9 chipset's coupled with an Intel Core 2 Duo CPU.

Previously, this system was used as a Windows 7 desktop and at power-on, the CPU cooling fan would start at maximum rpm but then slow down as the Windows boot progressed.  The cooling fan RPM would then vary depending on CPU temperature as per standard pulse-width modulation fan control. This system has also been tested with Linux, which also correctly controls fan RPM.

As the title suggests, I am having issues with fan control while running FreeBSD. Running FreeBSD, the fan operates at maximum RPM constantly. I have attempting using powerd using various settings but this made no difference. I assume the fan control is a part of ACPI, but I see no fan output when running `sysctl`.


```
root@freebsd:~ # sysctl hw.acpi
hw.acpi.supported_sleep_state: S1 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S1
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: NONE
hw.acpi.sleep_delay: 1
hw.acpi.s4bios: 0
hw.acpi.verbose: 0
hw.acpi.disable_on_reboot: 0
hw.acpi.handle_reboot: 0
hw.acpi.reset_video: 0
hw.acpi.cpu.cx_lowest: C1
root@freebsd:~ #
```

I've also loaded the ichsmb module, which correctly detects the SMBus controller, but this by itself does not effect the fan speed.

No BIOS settings have been changed since it was running Windows and now I honestly have no clue on what do look at next to get the fan control working and appreciate any advice.  

Cheers.


----------



## User23 (Oct 28, 2013)

Do I have this right? Your problem is only the CPU fan speed, not the system fan speed? The CPU cooling fan is controlled by the BIOS (Section: H/W Monitor -> CPU Smart FAN Target), not by the OS.


----------



## AtariAvenger (Oct 29, 2013)

User23 said:
			
		

> Do I have this right? Your problem is only the CPU fan speed, not the system fan speed? The CPU cooling fan is controlled by the BIOS (Section: H/W Monitor -> CPU Smart FAN Target), not by the OS.



On every other day of the week I'd agree with you.  The fact is that the CPU Smart FAN Target has always been disabled for the 5+ years I have had the system, and remains disabled.  The only difference between the Windows, Linux and FreeBSD installs is that FreeBSD is running from a USB flash drive.

As stated in my original post, with a Windows or Linux install the fan appears to be controlled.  With no settings changed in the BIOS, a FreeBSD system maxes out the fan rpm and stays that way.

Could this potentially be an issue with how FreeBSD is interfacing with the BIOS?


----------



## Martillo1 (Oct 29, 2013)

I trust the BIOS fan control over OS' any day.


----------



## AtariAvenger (Oct 29, 2013)

For the sake of argument I have enabled the CPU Smart FAN Target settings in the BIOS.  As before, these settings made no difference until Linux was half way through boot.  Running FreeBSD the fan remains at 100%.

I have noticed some ACPI errors in my dmesg so I'll post it here in the hopes of someone knowing what it might mean.


```
root@freebsd:~ # dmesg
Copyright (c) 1992-2013 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013
    root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
gcc version 4.2.1 20070831 patched [FreeBSD]
CPU: Intel(R) Core(TM)2 Duo CPU     E7200  @ 2.53GHz (2535.90-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x10676  Family = 0x6  Model = 0x17  Stepping = 6
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x8e39d<SSE3,DTES64,MON,DS_CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1>
  AMD Features=0x20000800<SYSCALL,LM>
  AMD Features2=0x1<LAHF>
  TSC: P-state invariant, performance statistics
real memory  = 6442450944 (6144 MB)
avail memory = 6162079744 (5876 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table: <111108 APIC0906>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
ioapic0 <Version 2.0> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <111108 RSDT0906> on motherboard
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, cff00000 (3) failed
cpu0: <ACPI CPU> on acpi0
ACPI Warning: Incorrect checksum in table [OEMB] - 0x92, should be 0x8D (20110527/tbutils-282)
cpu1: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> irq 16 at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0xcc00-0xcc7f mem 0xfd000000-0xfdffffff,0xd0000000-0xdfffffff,0xfa000000-0xfbffffff irq 16 at device 0.0 on pci1
uhci0: <Intel 82801I (ICH9) USB controller> port 0xbc00-0xbc1f irq 16 at device 26.0 on pci0
uhci0: LegSup = 0x2f00
usbus0 on uhci0
uhci1: <Intel 82801I (ICH9) USB controller> port 0xb880-0xb89f irq 21 at device 26.1 on pci0
uhci1: LegSup = 0x2f00
usbus1 on uhci1
ehci0: <Intel 82801I (ICH9) USB 2.0 controller> mem 0xf9fffc00-0xf9ffffff irq 18 at device 26.7 on pci0
usbus2: EHCI version 1.0
usbus2 on ehci0
hdac0: <Intel 82801I HDA Controller> mem 0xf9ff8000-0xf9ffbfff irq 22 at device 27.0 on pci0
pcib2: <ACPI PCI-PCI bridge> irq 17 at device 28.0 on pci0
pci2: <ACPI PCI bus> on pcib2
pcib3: <ACPI PCI-PCI bridge> irq 17 at device 28.4 on pci0
pci3: <ACPI PCI bus> on pcib3
atapci0: <Marvell 88SE6121 UDMA133 controller> port 0xdc00-0xdc07,0xd880-0xd883,0xd800-0xd807,0xd480-0xd483,0xd400-0xd40f mem 0xfe9ffc00-0xfe9fffff irq 16 at device 0.0 on pci3
ahci0: <Marvell 88SE6121 AHCI SATA controller> at channel -1 on atapci0
ahci0: AHCI v1.00 with 2 3Gbps ports, Port Multiplier supported
ahci0: quirks=0x455<NOFORCE,NONCQ,2CH,EDGEIS,NOCOUNT>
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich1: <AHCI channel> at channel 1 on ahci0
ata2: <ATA channel> at channel 0 on atapci0
pcib4: <ACPI PCI-PCI bridge> irq 16 at device 28.5 on pci0
pci4: <ACPI PCI bus> on pcib4
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet> port 0xe800-0xe8ff mem 0xfeaff000-0xfeafffff irq 17 at device 0.0 on pci4
re0: Using 1 MSI message
re0: Chip rev. 0x38000000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re0: Ethernet address: 00:1d:92:98:07:27
uhci2: <Intel 82801I (ICH9) USB controller> port 0xb800-0xb81f irq 23 at device 29.0 on pci0
uhci2: LegSup = 0x2f00
usbus3 on uhci2
uhci3: <Intel 82801I (ICH9) USB controller> port 0xb480-0xb49f irq 19 at device 29.1 on pci0
uhci3: LegSup = 0x2f00
usbus4 on uhci3
uhci4: <Intel 82801I (ICH9) USB controller> port 0xb400-0xb41f irq 18 at device 29.2 on pci0
uhci4: LegSup = 0x2f00
usbus5 on uhci4
uhci5: <Intel 82801I (ICH9) USB controller> port 0xb080-0xb09f irq 16 at device 29.3 on pci0
uhci5: LegSup = 0x2f00
usbus6 on uhci5
ehci1: <Intel 82801I (ICH9) USB 2.0 controller> mem 0xf9fff800-0xf9fffbff irq 23 at device 29.7 on pci0
usbus7: EHCI version 1.0
usbus7 on ehci1
pcib5: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci5: <ACPI PCI bus> on pcib5
ath0: <Atheros 5212> mem 0xfebf0000-0xfebfffff irq 17 at device 1.0 on pci5
ath0: AR2413 mac 7.9 RF2413 phy 4.5
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci1: <Intel ICH9 SATA300 controller> port 0xb000-0xb007,0xac00-0xac03,0xa880-0xa887,0xa800-0xa803,0xa480-0xa48f,0xa400-0xa40f irq 19 at device 31.2 on pci0
ata3: <ATA channel> at channel 0 on atapci1
ata4: <ATA channel> at channel 1 on atapci1
ichsmb0: <Intel 82801I (ICH9) SMBus controller> port 0x400-0x41f mem 0xf9fff400-0xf9fff4ff irq 18 at device 31.3 on pci0
smbus0: <System Management Bus> on ichsmb0
smb0: <SMBus generic I/O> on smbus0
atapci2: <Intel ICH9 SATA300 controller> port 0xa000-0xa007,0x9c00-0x9c03,0x9880-0x9887,0x9800-0x9803,0x9480-0x948f,0x9400-0x940f irq 19 at device 31.5 on pci0
ata5: <ATA channel> at channel 0 on atapci2
ata6: <ATA channel> at channel 1 on atapci2
acpi_button0: <Power Button> on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
ppc0: <Parallel port> port 0x378-0x37f irq 7 on acpi0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
coretemp0: <CPU On-Die Thermal Sensors> on cpu0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
p4tcc0: <CPU Frequency Thermal Control> on cpu0
coretemp1: <CPU On-Die Thermal Sensors> on cpu1
est1: <Enhanced SpeedStep Frequency Control> on cpu1
p4tcc1: <CPU Frequency Thermal Control> on cpu1
Timecounters tick every 1.000 msec
hdacc0: <Realtek ALC888 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC888 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC888 (Rear Analog 7.1/2.0)> at nid 20,22,21,23 and 24,26 on hdaa0
pcm1: <Realtek ALC888 (Front Analog)> at nid 27 and 25 on hdaa0
pcm2: <Realtek ALC888 (Rear Digital)> at nid 30 on hdaa0
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 12Mbps Full Speed USB v1.0
usbus2: 480Mbps High Speed USB v2.0
usbus3: 12Mbps Full Speed USB v1.0
usbus4: 12Mbps Full Speed USB v1.0
usbus5: 12Mbps Full Speed USB v1.0
usbus6: 12Mbps Full Speed USB v1.0
usbus7: 480Mbps High Speed USB v2.0
ugen0.1: <Intel> at usbus0
uhub0: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <Intel> at usbus1
uhub1: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1
ugen2.1: <Intel> at usbus2
uhub2: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
ugen3.1: <Intel> at usbus3
uhub3: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
ugen4.1: <Intel> at usbus4
uhub4: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4
ugen5.1: <Intel> at usbus5
uhub5: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus5
ugen6.1: <Intel> at usbus6
uhub6: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus6
ugen7.1: <Intel> at usbus7
uhub7: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus7
uhub0: 2 ports with 2 removable, self powered
uhub1: 2 ports with 2 removable, self powered
uhub3: 2 ports with 2 removable, self powered
uhub4: 2 ports with 2 removable, self powered
uhub5: 2 ports with 2 removable, self powered
uhub6: 2 ports with 2 removable, self powered
uhub2: 4 ports with 4 removable, self powered
cd0 at ata4 bus 0 scbus4 target 0 lun 0
cd0: <Optiarc DVD RW AD-7240S 1.03> Removable CD-ROM SCSI-0 device
cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO 8192bytes)
cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
SMP: AP CPU #1 Launched!
Timecounter "TSC-low" frequency 1267949762 Hz quality 1000
Root mount waiting for: usbus7
Root mount waiting for: usbus7
uhub7: 8 ports with 8 removable, self powered
Root mount waiting for: usbus7
Root mount waiting for: usbus7
ugen7.2: <Lexar> at usbus7
umass0: <Lexar JD FireFly, class 0/0, rev 2.00/11.00, addr 2> on usbus7
umass0:  SCSI over Bulk-Only; quirks = 0x0100
umass0:7:0:-1: Attached to scbus7
Trying to mount root from ufs:/dev/da0p2 [rw]...
mountroot: waiting for device /dev/da0p2 ...
da0 at umass-sim0 bus 0 scbus7 target 0 lun 0
da0: <Lexar JD FireFly 1100> Removable Direct Access SCSI-0 device
da0: 40.000MB/s transfers
da0: 15296MB (31326208 512 byte sectors: 255H 63S/T 1949C)
da0: quirks=0x2<NO_6_BYTE>
```
To confirm, FreeBSD does not and cannot communicate to the SMBus controller to set CPU fan speed?

Cheers


----------



## User23 (Oct 29, 2013)

The CPU could have a high load. What is the temperature of your CPU cores? What smart fan target is used?


----------



## AtariAvenger (Oct 29, 2013)

I think the CPU fan is a red herring.  I'm pretty sure the actual noise I'm hearing is from the video card.  It's a Nvidia 9600GT and from searching it appears they are notorious for fan noise until the graphics driver starts.  A pity I'm not planning on running X.

I will confirm all this tonight when I get home.


----------



## AtariAvenger (Oct 30, 2013)

Ok, it's offical, I'm a jackass.

It's been the cooler on the Nvidia 9600GT card all along.x(  From what I've read it appears the fan will run flat-out until the driver is loaded.  This explains why it went silent midway through booting Windows and Linux GUIs.  

I guess I can always install X and run an extremely low resource window manager like x11-wm/blackbox, but I wonder if the driver from X.org will be enough without using x11/nvidia-driver-96.

One way to find I suppose.  At least I know it's not the CPU cooler. :r


----------

