This patch changes several cache-related pieces to be cleaner, faster or more correct. The largest point is removing the old arm_invalidate_caches() function and surrounding bootblock code to initialize SCTLR and replace it with an all-assembly function that takes care of cache and SCTLR initialization to bring the system to a known state. It runs without stack and before coreboot makes any write accesses to be as compatible as possible with whatever state the system was left in by preceeding code. This also finally fixes the dreaded icache bug that wasted hundreds of milliseconds during boot. Old-Change-Id: I7bb4995af8184f6383f8e3b1b870b0662bde8bd4 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183890 (cherry picked from commit 07a35925dc957919bf88dfc90515971a36e81b97) nyan_big: apply cache-related changes from nyan This applies the same changes from 07a3592 that were applied to nyan. Old-Change-Id: Idcbe85436d7a2f65fcd751954012eb5f4bec0b6c Reviewed-on: https://chromium-review.googlesource.com/184551 Commit-Queue: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> (cherry picked from commit 4af27f02614da41c611aee2c6d175b1b948428ea) Squashed the followup patch for nyan_big into the original patch. Change-Id: Id14aef7846355ea2da496e55da227b635aca409e Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> (cherry picked from commit 4cbf25f8eca3a12bbfec5b015953c0fc2b69c877) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Reviewed-on: http://review.coreboot.org/6993 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright 2013 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.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <arch/cache.h>
|
|
#include <console/console.h>
|
|
#include "power.h"
|
|
#include "wakeup.h"
|
|
|
|
void wakeup(void)
|
|
{
|
|
if (wakeup_need_reset())
|
|
power_reset();
|
|
|
|
power_init(); /* Ensure ps_hold_setup() for early wakeup. */
|
|
dcache_mmu_disable();
|
|
power_exit_wakeup();
|
|
/* Should never return. If we do, reset. */
|
|
power_reset();
|
|
}
|
|
|
|
int get_wakeup_state(void)
|
|
{
|
|
uint32_t status = power_read_reset_status();
|
|
|
|
/* DIDLE/LPA can be resumed without clock reset (ex, bootblock),
|
|
* and SLEEP requires resetting clock (should be done in ROM stage).
|
|
*/
|
|
|
|
if (status == S5P_CHECK_DIDLE || status == S5P_CHECK_LPA)
|
|
return WAKEUP_DIRECT;
|
|
|
|
if (status == S5P_CHECK_SLEEP)
|
|
return WAKEUP_NEED_CLOCK_RESET;
|
|
|
|
return IS_NOT_WAKEUP;
|
|
}
|
|
|
|
void wakeup_enable_uart(void)
|
|
{
|
|
power_release_uart_retention();
|
|
}
|