Consolidate reset API, add generic reset_prepare mechanism

Hardware / Coreboot - Julius Werner [chromium.org] - 13 June 2017 14:53 EDT

There are many good reasons why we may want to run some sort of generic callback before we're executing a reset. Unfortunateley, that is really hard right now: code that wants to reset simply calls the hard_reset() function (or one of its ill-differentiated cousins) which is directly implemented by a myriad of different mainboards, northbridges, SoCs, etc. More recent x86 SoCs have tried to solve the problem in their own little corner of soc/intel/common, but it's really something that would benefit all of coreboot.

This patch expands the concept onto all boards: hard_reset() and friends get implemented in a generic location where they can run hooks before calling the platform-specific implementation that is now called do_hard_reset(). The existing Intel reset_prepare() gets generalized as soc_reset_prepare() (and other hooks for arch, mainboard, etc. can now easily be added later if necessary). We will also use this central point to ensure all platforms flush their cache before reset, which is generally useful for all cases where we're trying to persist information in RAM across reboots (like the new persistent CBMEM console does).

Also remove cpu_reset() completely since it's not used anywhere and doesn't seem very useful compared to the others.

Change-Id: I41b89ce4a923102f0748922496e1dd9bce8a610f

01f9aa5 Consolidate reset API, add generic reset_prepare mechanism
src/include/reset.h | 37 +++++++++++-----
src/lib/Makefile.inc | 7 +++
src/lib/reset.c | 59 ++++++++++++++++++++++++++
src/mainboard/asus/a8v-e_deluxe/romstage.c | 2 +-
src/mainboard/asus/a8v-e_se/romstage.c | 2 +-
src/mainboard/asus/k8v-x/romstage.c | 2 +-
src/mainboard/asus/m2v-mx_se/romstage.c | 2 +-
src/mainboard/asus/m2v/romstage.c | 2 +-
src/mainboard/google/foster/reset.c | 3 +-
src/mainboard/google/gale/reset.c | 2 +-
src/mainboard/google/gru/reset.c | 4 +-
src/mainboard/google/nyan/reset.c | 3 +-
src/mainboard/google/nyan_big/reset.c | 3 +-
src/mainboard/google/nyan_blaze/reset.c | 3 +-
src/mainboard/google/purin/reset.c | 4 +-
src/mainboard/google/rotor/reset.c | 2 +-
src/mainboard/google/smaug/reset.c | 4 +-
src/mainboard/google/storm/reset.c | 5 +--
src/mainboard/google/veyron/reset.c | 3 +-
src/mainboard/google/veyron_mickey/reset.c | 3 +-
src/mainboard/google/veyron_rialto/reset.c | 4 +-
src/northbridge/via/cx700/reset.c | 2 +-
src/northbridge/via/vx900/northbridge.c | 2 +-
src/soc/dmp/vortex86ex/hard_reset.c | 2 +-
src/soc/imgtec/pistachio/reset.c | 2 +-
src/soc/intel/apollolake/reset.c | 6 +--
src/soc/intel/baytrail/reset.c | 4 +-
src/soc/intel/broadwell/reset.c | 4 +-
src/soc/intel/common/reset.c | 27 +-----------
src/soc/intel/fsp_baytrail/reset.c | 4 +-
src/soc/intel/fsp_broadwell_de/reset.c | 2 +-
src/soc/intel/sch/reset.c | 4 +-
src/soc/intel/skylake/reset.c | 2 +-
src/soc/mediatek/mt8173/wdt.c | 5 +--
src/soc/samsung/exynos5250/power.c | 2 +-
src/southbridge/amd/agesa/hudson/reset.c | 2 +-
src/southbridge/amd/amd8111/early_ctrl.c | 4 +-
src/southbridge/amd/amd8111/reset.c | 2 +-
src/southbridge/amd/cimx/sb700/reset.c | 4 +-
src/southbridge/amd/cimx/sb800/reset.c | 4 +-
src/southbridge/amd/cimx/sb900/reset.c | 4 +-
src/southbridge/amd/pi/hudson/reset.c | 2 +-
src/southbridge/amd/sb600/early_setup.c | 4 +-
src/southbridge/amd/sb600/reset.c | 2 +-
src/southbridge/amd/sb700/reset.c | 4 +-
src/southbridge/amd/sb800/early_setup.c | 4 +-
src/southbridge/amd/sb800/reset.c | 2 +-
src/southbridge/broadcom/bcm5785/early_setup.c | 4 +-
src/southbridge/broadcom/bcm5785/reset.c | 2 +-
src/southbridge/intel/bd82x6x/reset.c | 4 +-
src/southbridge/intel/fsp_bd82x6x/reset.c | 4 +-
src/southbridge/intel/fsp_i89xx/reset.c | 4 +-
src/southbridge/intel/fsp_rangeley/reset.c | 4 +-
src/southbridge/intel/i3100/reset.c | 2 +-
src/southbridge/intel/i82801ax/reset.c | 2 +-
src/southbridge/intel/i82801bx/reset.c | 2 +-
src/southbridge/intel/i82801dx/reset.c | 2 +-
src/southbridge/intel/i82801gx/reset.c | 6 +--
src/southbridge/intel/lynxpoint/reset.c | 4 +-
src/southbridge/nvidia/ck804/early_setup.c | 4 +-
src/southbridge/nvidia/ck804/early_setup_car.c | 4 +-
src/southbridge/nvidia/ck804/reset.c | 2 +-
src/southbridge/nvidia/mcp55/early_ctrl.c | 4 +-
src/southbridge/nvidia/mcp55/reset.c | 2 +-
src/southbridge/sis/sis966/early_ctrl.c | 4 +-
src/southbridge/sis/sis966/reset.c | 2 +-
66 files changed, 181 insertions(+), 143 deletions(-)

Upstream: review.coreboot.org


  • Share