Project

General

Profile

Actions

Bug #601

open

superio/nuvoton/npcd378:379 FAN issue sandy/ivy-bridge & haswell on HP

Added by Walter Sonius 5 months ago. Updated 15 days ago.

Status:
New
Priority:
Normal
Category:
board support
Target version:
Start date:
07/05/2025
Due date:
% Done:

0%

Estimated time:
Affected versions:
Needs backport to:
Affected hardware:
compaq_8200_elite_sff, compaq_8300_elite_sff, compaq_pro_6300_sff, 260_g1_dm, prodesk_600_g1_sff
Affected OS:

Description

The NPCD378 HWM FAN control is limited to the PSU FAN only but should work for the "compaq_8200_elite_sff" according to its commit and instruction, which states "... the SuperIO has to be notified that a write is ongoing. After clearing the write-lock bit all changes are applied...".

Is there a special command that I missed that "clears the write-lock" or is there a bug and is its current implementation broken?

Since adjusting the nvram parameter sudo nvramtool -w psu_fan_lvl=1-7and doing a reboot or cold powerup does show that the nvram parameter changes (can be confirmed by coreboot log or reading the nvram parameter after boot again) it never changes the actual PSU FAN speed! Tried multiple coreboot/seabios/edk2 versions the last 3 months on 5 different HP machines and came to the following conclusion.

The following nvramtool psu_fan_lvl=values reflect the following PWM feedback from the coreboot log:

=1
[INFO ]  NPCD378: PSU fan PWM 0x37
=2
[INFO ]  NPCD378: PSU fan PWM 0x57
=3
[INFO ]  NPCD378: PSU fan PWM 0x77
=4
[INFO ]  NPCD378: PSU fan PWM 0x97
=5
[INFO ]  NPCD378: PSU fan PWM 0xb7
=6
[INFO ]  NPCD378: PSU fan PWM 0xd7
=7
[INFO ]  NPCD378: PSU fan PWM 0xf8

The following 3 supported sandy/ivy bridge HP variants share the same issue that nvram parameters and coreboot log show the requested manual psu_fan_lvl values but its PSU FAN speed won't change according to these values, atleast its FANs keep spinning after post/boot on these machines:

                                    VALUE       FAN SPEED
compaq_8200_elite_sff   NPCD378     adjusts     remains same
compaq_8300_elite_sff   NPCD379     adjusts     remains same
compaq_pro_6300_sff     NPCD379     adjusts     remains same

The following 2 yet uncommited HP Haswell coreboot variants, "HP 260 G1 DM (Desktop Mini) Business PC" and "HP Prodesk 600 G1 SFF" both come with a NPCD379 and both share the same issue with the former 3 variants that the psu_fan_lvl value's can be adjusted by nvramtool(if cmos backend is added to the code) and verified during boot or nvramtool that these values have changed with affecting the PSU FAN speed in a undesired way:

                                    VALUE       FAN SPEED
260_g1_dm               NPCD379     adjusts     stops spinning
prodesk_600_g1_sff      NPCD379     adjusts     stops spinning

These 2 Haswell machines will halt "and stop spinning" the PSU FAN as soon as during post the "PSU fan PWM" value kicks in!!! A side note is needed for the HP 260 G1 DM since it only has a single FAN, so I'm not sure if its CPU or its PSU FAN technically and its OEM BIOS misses a option the adjust FAN speed compared to the other 4 HP models! Another side note for the Prodesk 600 G1 SFF is that I'm forced to use a aftermarket non HP CPU FAN(old Intel CPU FAN), but it keeps spinning after coreboot post.
Removing the FAN/HWM code from the superio NPCD378 source, leads to the opposite it will force the PSU FAN to its MAXIMUM speed after poweron but atleast keeps the FAN spinning. This maximum forced full speed FAN behaviour can also be replicated by removing one of the 4 FAN wires, red or white cable not sure anymore.

Interesting FAN notes:
In case of the "Prodesk 600 G1", swapping its PSU with the PSU from the "compaq_8300_elite_sff" keeps the PSU fan spinning during and after coreboot post but it will still not adjust its PSU FAN speed to its requested values! Also the other way around, putting the PSU of the "Prodesk 600 G1" inside the "compaq_8300_elite_sff" stops the PSU FAN during coreboot post, but running the OEM firmware, keeps the fan spinning and let it adjust to all requested values on its donor FAN. So it seems there is a certain PWM compatibility to control these FAN's in similar ways between these boards. It seems the the newer PSU FAN from the Haswell generation can actually disable / stop spinning on a certain PWM value while older FAN keep spinning on these lower/ same PWM values.

Compared to the initial support commit by Patrick Rudolph, around April 2021 there were some code fixes but after that the last time this psu_fan_lvl code was verified functional was between 2023-05-02 and 2023-07-03 noted in the boardsupport commit of the variant compaq_8300_elite_sff_usdt by Riku Viitanen.

History for "coreboot/src/superio/nuvoton/npcd378" shows 6 patches from november 2023 till today.

Any tips hints welcome.


Files

Actions #1

Updated by Patrick Rudolph 5 months ago

The initial commit was tested on compaq_8200_elite_sff and definitely worked as expected.
I've never tested the code on other boards.

The code was introduced as the default fan speed (MAXIMUM speed) was too noisy.

You should check the original HP firmware how it does PWM fan control.
It might be that NPCD379 has a different firmware or is connected in a different fashion or uses different registers in the HWM I/O space.

Updated by Walter Sonius 5 months ago

You are correct indeed a "default" FAN speed does work, that's part of the active code behavior I forgot to mention (I took for granted) that part is still valid and works for 3 tested models including the sandy/ivy-bridge 379 variants. Like you mentioned it will go to a MAXIMUM speed which is to noisy and undesired if there is no NPCD378 FAN HWM code active, which I still can confirm for all 5 models.

Maybe that part is something which Riku confirmed with "...FAN levels stay in control..."?

This bug report, however is about setting a manual psu_fan_lvl which currently does not work on the "compaq_8200_elite_sff". The supplied coreboot logs show 7 reboots for all psu_fan_lvl with their respective "PWM" values for the "compaq_8200_elite_sff". My guess is that part of the code is broken that activates a custom value set by nvramtool -w psu_fan_lvl=value, therefor always a default quite silent speed is active or overrides?

Any hint in the code to just force a certain hex value without using or depending on the more complex psu_fan_lvl nvram/cmos values in npcd378/superio.c?

Did I read/remember correctly that a compaq 8200/8300 used in coreboot CI / jenkins project / build farm which auto builds and boots coreboot roms to check for errors, maybe I confused it with something else but if someone has access to those machines can they check if the PSU FAN level changes still work on current code?

Actions #4

Updated by Walter Sonius 15 days ago ยท Edited

Build and tried the following coreboot branches 4.22, 4.20, 4.15, 4.11 which goes back to November 2019. All of these behave the same as in there is a default acceptable FAN speed active on the Compaq Elite 8200 SFF when using the code, but it won't change to a altered speed based on a specific nvram parameter set (tried all 7). Going back from coreboot branch 4.15 to 4.11 even breaks adjusting the PWM values (stays same) although altered nvram values are still saved in nvram. Earlier releases I'm no longer to compile without errors, specifically I would like to build and test the first commit the FAN speed was added: 9bd601584350f51f112b15a7369f9aa82f1d0919.

#OBJCOPY    cbfs/fallback/romstage.elf
#make: *** No rule to make target '".car.data"', needed by 'build/coreboot.pre'.  Stop.

For compiling older coreboot branches on ubuntu 24.04, it was necessary to downgrade gnat and probably gcc package, replace broken acpica url with altered version and checksum, edit some binutils/gold and gcc/ada code and even allow coreboot to build with distribution toolchain ANY_TOOLCHAIN. Along the way back in the codebase it is also needed to adjust the port its BOARD name!

See following steps to reproduce:

#reproduced on kde neon which uses ubuntu noble 24.04 lts 

sudo apt install gnat-9 #removes gnat gnat-13 gnat-13-x86-64-linux-gnu
sudo apt install gcc-11 #was probably downgraded from 14 or 13 all using apt no hacks 

git fetch
git branch -v -a
#before switching branches
make distclean
make clean

git switch 4.11_branch #4.15_branch, 4.20_branch, 4.22_branch or even latest master
make crossgcc-i386 CPUS=$(nproc)

#4.22
# needs gcc 11

#4.20
# needs gcc 11 and gnat 9

#4.15
# needs gcc 11 and gnat 9
# additionally needs to alter acpica-unix2 version, url, checksum plus ANY_TOOLCHAIN
#https://ftp.mirrorservice.org/sites/ftp.gnu.org/gnu/gnuboot/mirrors/acpica.org
nano util/crossgcc/buildgcc #IASL/ACPICA BASE URL / VERSION
cp acpica-unix2-20190703.tar.gz.cksum.calc acpica-unix2-20190703.tar.gz.cksum
./util/scripts/config --enable ANY_TOOLCHAIN

#4.11
# plus all the earlier above needed changes...
# additionally edit binutils/gold and gcc/ada code
#https://sourceware.org/pipermail/binutils/2019-June/107194.html
nano util/crossgcc/binutils-2.32/gold/errors.h #~line25 + include <string>
#https://lists.gnu.org/archive/html/gnuboot-patches/2024-09/msg00006.html
nano util/crossgcc/gcc-8.3.0/gcc/ada/init.c #~line 570 see URL
nano util/crossgcc/gcc-8.3.0/gcc/ada/libgnarl/s-osinte__linux.ads #~line 328 edit 16>32
#./util/scripts/config --enable BOARD_HEWLETT_PACKARD_HP_COMPAQ_8200_ELITE_SFF_PC

#4.10 fails to build...

make distclean
touch .config
./util/scripts/config --enable VENDOR_HP
./util/scripts/config --enable BOARD_HP_COMPAQ_8200_ELITE_SFF_PC #add "HEWLETT_PACKARD_" <= 4.11
./util/scripts/config --enable USE_OPTION_TABLE

#full/stripped?
./util/scripts/config --enable HAVE_IFD_BIN
./util/scripts/config --set-str IFD_BIN_PATH "/home/neon/Desktop/8200/fd0.bin"
./util/scripts/config --enable HAVE_ME_BIN
./util/scripts/config --set-str ME_BIN_PATH "/home/neon/Desktop/8200/me2.bin"
./util/scripts/config --enable HAVE_GBE_BIN
./util/scripts/config --set-str GBE_BIN_PATH "/home/neon/Desktop/8200/gbe3.bin"

make olddefconfig
make

#flash the image on the target and set nvram values and reboot/shutdown to see if fan speed changes?
Actions

Also available in: Atom PDF