coreboot-kgpe-d16/src/lib/reset.c
Patrick Rudolph f677d17ab3 intel: Use CF9 reset (part 2)
Make use of the common CF9 reset in SOC_INTEL_COMMON_RESET. Also
implement board_reset() as a "full reset" (aka. cold reset) as that
is what was used here for hard_reset().

Drop soc_reset_prepare() thereby, as it was only used for APL. Also,
move the global-reset logic.

We leave some comments to remind us that a system_reset() should
be enough, where a full_reset() is called now (to retain current
behaviour) and looks suspicious.

Note, as no global_reset() is implemented for Denverton-NS, we halt
there now instead of issuing a non-global reset. This seems safer;
a non-global reset might result in a reset loop.

Change-Id: I5e7025c3c9ea6ded18e72037412b60a1df31bd53
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/29169
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-10-22 08:35:32 +00:00

69 lines
1.6 KiB
C

/*
* This file is part of the coreboot project.
*
* Copyright 2017 Google, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <arch/cache.h>
#include <console/console.h>
#include <halt.h>
#include <reset.h>
__noreturn void board_reset(void)
{
printk(BIOS_INFO, "%s() called!\n", __func__);
dcache_clean_all();
do_board_reset();
halt();
}
#if IS_ENABLED(CONFIG_MISSING_BOARD_RESET)
void do_board_reset(void)
{
printk(BIOS_CRIT, "No board_reset implementation, hanging...\n");
}
#else
/*
* Fall back to hard_reset() for a regression free transition.
* FIXME: Remove after everything is converted to board_reset().
*/
__weak void do_board_reset(void)
{
hard_reset();
}
#endif
__noreturn static void __hard_reset(void) {
if (IS_ENABLED(CONFIG_HAVE_HARD_RESET))
do_hard_reset();
else
printk(BIOS_CRIT, "No hard_reset implementation, hanging...\n");
halt();
}
/* Not all platforms implement all reset types. Fall back to hard_reset. */
__weak void do_soft_reset(void) { __hard_reset(); }
void hard_reset(void)
{
printk(BIOS_INFO, "%s() called!\n", __func__);
dcache_clean_all();
__hard_reset();
}
void soft_reset(void)
{
printk(BIOS_INFO, "%s() called!\n", __func__);
dcache_clean_all();
do_soft_reset();
halt();
}