blob: 1630628969ff441ef1082fb3fd8a07637a3a48e3 [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>
25
Kyösti Mälkkide53bdf2014-12-31 19:13:12 +020026#ifndef __PRE_RAM__
27
Vadim Bendebury8b143c52014-05-14 10:12:55 -070028static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
Aaron Durbindf3a1092013-03-13 12:41:44 -050029
30void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
31{
32 int i;
33 const char *name;
34
35 name = NULL;
36 for (i = 0; i < ARRAY_SIZE(cbmem_ids); i++) {
37 if (cbmem_ids[i].id == id) {
38 name = cbmem_ids[i].name;
39 break;
40 }
41 }
42
43 if (name == NULL)
44 printk(BIOS_DEBUG, "%08x ", id);
45 else
46 printk(BIOS_DEBUG, "%s", name);
47 printk(BIOS_DEBUG, "%2d. ", n);
48 printk(BIOS_DEBUG, "%08llx ", base);
49 printk(BIOS_DEBUG, "%08llx\n", size);
50}
Kyösti Mälkkide53bdf2014-12-31 19:13:12 +020051
52#endif /* !__PRE_RAM__ */
Kyösti Mälkki823edda2014-12-18 18:30:29 +020053
54/* FIXME: Replace with CBMEM_INIT_HOOKS API. */
55#if !IS_ENABLED(CONFIG_ARCH_X86)
56void cbmem_run_init_hooks(void)
57{
Kyösti Mälkki0a11a612014-12-31 19:29:02 +020058 /* Relocate CBMEM console. */
59 cbmemc_reinit();
Kyösti Mälkki823edda2014-12-18 18:30:29 +020060}
61
62void __attribute__((weak)) cbmem_fail_resume(void)
63{
64}
65#endif