Attention is currently required from: Joel Linn, Matt DeVillier.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/81426?usp=email )
Change subject: superio/ite: Add special fan vectors and further options ......................................................................
Patch Set 1:
(7 comments)
File src/superio/ite/common/env_ctrl.h:
https://review.coreboot.org/c/coreboot/+/81426/comment/da992687_84b281ea : PS1, Line 211: #define ITE_EC_FAN_VEC_CTL_SLOPESIGN(x) (((x) & 0x1) << 7) As many of the bits are in unexpected registers, it might be worth to put the full register name into the bit definitions, e.g. ``` ITE_EC_FAN_VEC_CTL_SLOPE_TMPIN0(x) ITE_EC_FAN_VEC_CTL_DELTA_TMPIN1(x) ITE_EC_FAN_VEC_CTL_DELTA_FANOUT(x) ITE_EC_FAN_VEC_CTL_RANGE_SLOPE_SIGN(x) ```
File src/superio/ite/common/env_ctrl.c:
https://review.coreboot.org/c/coreboot/+/81426/comment/0cdfc806_d1fbff97 : PS1, Line 128: } I guess the whole thing should be handled in mainboard code. Then we wouldn't need the callback nor special values.
You can actually change devicetree settings in ramstage C code, for instance your mainboard_enable(). e.g. ``` #include <static_devices.h> ... static void mainboard_enable(struct device *dev) { ... __pnp_002e_04->chip->config.ec.tmpin[2].offset = cpu_get_temp_offset(); } ```
https://review.coreboot.org/c/coreboot/+/81426/comment/394057a2_deb728f2 : PS1, Line 274: s8 slope = conf->slope; : bool slope_neg = slope < 0; Both should be `const` to show the intention.
https://review.coreboot.org/c/coreboot/+/81426/comment/968104e5_3517200d : PS1, Line 369: #endif If trying the 0 array length (see comment in `env_ctrl_chip.h`), this should become a C `if (CONFIG(SUPERIO_ITE_ENV_CTRL_FAN_VECTOR)) { ... }` so garbage collection would know that we don't need enable_fan_vector() in the binary.
File src/superio/ite/common/env_ctrl_chip.h:
https://review.coreboot.org/c/coreboot/+/81426/comment/6f6dcb02_665e3a1b : PS1, Line 106: #endif As odd as it may seem, GCC accepts a `[0]` here (hopefully clang too). This would save us from all of the `#if` in C code. e.g. if we did ``` #if CONFIG(SUPERIO_ITE_ENV_CTRL_FAN_VECTOR) #define ITE_EC_FAN_VECTOR_CNT 2 #else #define ITE_EC_FAN_VECTOR_CNT 0 #endif ```
File src/superio/ite/common/ite.h:
https://review.coreboot.org/c/coreboot/+/81426/comment/557575bd_2e7afead : PS1, Line 21: void ite_pme_out_disable(pnp_devfn_t dev); The other APIs above have the verb first. So how about `ite_diable_pme_out()`?
https://review.coreboot.org/c/coreboot/+/81426/comment/a613e6b3_62001f62 : PS1, Line 26: #define ite_disable_3vsbsw(dev) ite_set_3vsbsw((dev), false) Inline functions are preferred. e.g. ``` static inline void ite_disable_3vsbsw(pnp_devfn_t dev) { ite_set_3vsbsw(dev, false); } ```