blob: 6d581c40b21e3c0e4f3ceb56f190cac46b223e55 [file] [log] [blame]
Aaron Durbindf3a1092013-03-13 12:41:44 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
Aaron Durbin2c4aab32015-03-06 23:26:06 -060011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Aaron Durbindf3a1092013-03-13 12:41:44 -050012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <console/console.h>
20#include <cbmem.h>
Aaron Durbin0dff57d2015-03-05 21:18:33 -060021#include <bootstate.h>
22#include <rules.h>
23#if IS_ENABLED(CONFIG_ARCH_X86) && !IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
24#include <arch/acpi.h>
25#endif
Aaron Durbindf3a1092013-03-13 12:41:44 -050026
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020027/* FIXME: Remove after CBMEM_INIT_HOOKS. */
28#include <console/cbmem_console.h>
Kyösti Mälkki4d107502014-12-19 10:17:46 +020029#include <timestamp.h>
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020030
Kyösti Mälkki823edda2014-12-18 18:30:29 +020031
32/* FIXME: Replace with CBMEM_INIT_HOOKS API. */
33#if !IS_ENABLED(CONFIG_ARCH_X86)
34void cbmem_run_init_hooks(void)
35{
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020036 /* Relocate CBMEM console. */
37 cbmemc_reinit();
Kyösti Mälkki4d107502014-12-19 10:17:46 +020038
39 /* Relocate timestamps stash. */
40 timestamp_reinit();
Kyösti Mälkki823edda2014-12-18 18:30:29 +020041}
42
43void __attribute__((weak)) cbmem_fail_resume(void)
44{
45}
46#endif
Aaron Durbin0dff57d2015-03-05 21:18:33 -060047
48#if ENV_RAMSTAGE && !IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
49static void init_cbmem_post_device(void *unused)
50{
51 if (acpi_is_wakeup())
52 cbmem_initialize();
53 else
54 cbmem_initialize_empty();
55}
56
57BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY,
58 init_cbmem_post_device, NULL);
59#endif