Bug #12
closedUse of CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL is a mess
0%
Description
In Kconfig, the symbol MAINBOARD_POWER_ON_AFTER_POWER_FAIL is used in a few platforms. It is a bool. Because it's used in only a few mainboards, for MOST platforms, it's going to be defined as 0 (kconfig bools in coreboot are ALWAYS defined)
Here are those mainboards:
src/mainboard/samsung/lumpy/Kconfig
src/mainboard/samsung/stumpy/Kconfig
src/mainboard/asus/kgpe-d16/Kconfig
src/mainboard/asus/kfsn4-dre/Kconfig
src/mainboard/asus/kfsn4-dre_k8/Kconfig
src/mainboard/msi/ms9652_fam10/Kconfig
In a number of other platforms, CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL is used as if it were a standard #define - with three states:
from src/southbridge/intel/bd82x6x/pch.h:
#define MAINBOARD_POWER_OFF 0
#define MAINBOARD_POWER_ON 1
#define MAINBOARD_POWER_KEEP 2
#ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
#define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
#endif
Similar patterns are seen in these files:
src/southbridge/amd/agesa/hudson/sm.c
src/southbridge/amd/amd8111/acpi.c
src/southbridge/amd/pi/hudson/sm.c
src/southbridge/amd/sb600/sm.c
src/southbridge/amd/sb700/sm.c
src/southbridge/amd/sb800/sm.c
src/southbridge/intel/bd82x6x/pch.h
src/southbridge/intel/fsp_bd82x6x/pch.h
src/southbridge/intel/fsp_i89xx/pch.h
src/southbridge/intel/fsp_rangeley/soc.h
src/southbridge/intel/i3100/lpc.c
src/southbridge/intel/i82801dx/i82801dx.h
src/southbridge/intel/i82801ex/lpc.c
src/southbridge/intel/i82801gx/i82801gx.h
src/southbridge/intel/i82801ix/i82801ix.h
src/southbridge/intel/ibexpeak/pch.h
src/southbridge/intel/lynxpoint/pch.h
src/southbridge/nvidia/ck804/lpc.c
src/southbridge/nvidia/mcp55/lpc.c
src/southbridge/sis/sis966/lpc.c
src/southbridge/via/vt8237r/vt8237r.h
src/superio/nuvoton/nct5572d/superio.c
To fix:
- Make sure definitions are the same across all the platforms and fix them to be consistent if they're not already: ** 0 = power off, 1 = power on, 2 = restore previous state
- Add Kconfig symbols to show which platforms get these options based on which platforms are using the option - Everything using CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL needs to be set. ** HAVE_POWER_STATE_ON_AFTER_FAIL - This gets set for platforms that get the option ** HAVE_POWER_STATE_RESTORE - This gets set for platforms that can actually restore the previous state
- Turn the MAINBOARD_POWER_ON_AFTER_POWER_FAIL bool into a choice menu and move it to a higher level in the Kconfig tree.
- Add the HAVE_POWER_STATE_ON_AFTER_FAIL and HAVE_POWER_STATE_RESTORE to the correct Kconfigs
- Remove all of the existing #define stuff from the above files.
- Remove the current MAINBOARD_POWER_ON_AFTER_POWER_FAIL Kconfig options from their current locations (with the exception of setting new defaults)
- Test.
Updated by Alexander Couzens almost 9 years ago
at least for lenovo x201 (and likely all other lenovo devices), this feature isn't really implemented, because the EC controls the power and not the mainboard. And the EC don't have any code to handle this feature (yet).