blob: 33f16b587246f04703aa516c83c784c8fab0c850 [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,
11 * but WITHOUT ANY WARRANTY; without even the implied wacbmem_entryanty of
12 * 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>
21#include <stdlib.h>
22
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020023/* FIXME: Remove after CBMEM_INIT_HOOKS. */
24#include <console/cbmem_console.h>
Kyösti Mälkki4d107502014-12-19 10:17:46 +020025#include <timestamp.h>
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020026
Kyösti Mälkkide53bdf2014-12-31 19:13:12 +020027#ifndef __PRE_RAM__
28
Vadim Bendebury8b143c52014-05-14 10:12:55 -070029static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
Aaron Durbindf3a1092013-03-13 12:41:44 -050030
31void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
32{
33 int i;
34 const char *name;
35
36 name = NULL;
37 for (i = 0; i < ARRAY_SIZE(cbmem_ids); i++) {
38 if (cbmem_ids[i].id == id) {
39 name = cbmem_ids[i].name;
40 break;
41 }
42 }
43
44 if (name == NULL)
45 printk(BIOS_DEBUG, "%08x ", id);
46 else
47 printk(BIOS_DEBUG, "%s", name);
48 printk(BIOS_DEBUG, "%2d. ", n);
49 printk(BIOS_DEBUG, "%08llx ", base);
50 printk(BIOS_DEBUG, "%08llx\n", size);
51}
Kyösti Mälkkide53bdf2014-12-31 19:13:12 +020052
53#endif /* !__PRE_RAM__ */
Kyösti Mälkki823edda2014-12-18 18:30:29 +020054
55/* FIXME: Replace with CBMEM_INIT_HOOKS API. */
56#if !IS_ENABLED(CONFIG_ARCH_X86)
57void cbmem_run_init_hooks(void)
58{
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020059 /* Relocate CBMEM console. */
60 cbmemc_reinit();
Kyösti Mälkki4d107502014-12-19 10:17:46 +020061
62 /* Relocate timestamps stash. */
63 timestamp_reinit();
Kyösti Mälkki823edda2014-12-18 18:30:29 +020064}
65
66void __attribute__((weak)) cbmem_fail_resume(void)
67{
68}
69#endif