Aaron Durbin | df3a109 | 2013-03-13 12:41:44 -0500 | [diff] [blame] | 1 | /* |
| 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älkki | 0a11a61 | 2014-12-31 19:29:02 +0200 | [diff] [blame^] | 23 | /* FIXME: Remove after CBMEM_INIT_HOOKS. */ |
| 24 | #include <console/cbmem_console.h> |
| 25 | |
Kyösti Mälkki | de53bdf | 2014-12-31 19:13:12 +0200 | [diff] [blame] | 26 | #ifndef __PRE_RAM__ |
| 27 | |
Vadim Bendebury | 8b143c5 | 2014-05-14 10:12:55 -0700 | [diff] [blame] | 28 | static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE }; |
Aaron Durbin | df3a109 | 2013-03-13 12:41:44 -0500 | [diff] [blame] | 29 | |
| 30 | void 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älkki | de53bdf | 2014-12-31 19:13:12 +0200 | [diff] [blame] | 51 | |
| 52 | #endif /* !__PRE_RAM__ */ |
Kyösti Mälkki | 823edda | 2014-12-18 18:30:29 +0200 | [diff] [blame] | 53 | |
| 54 | /* FIXME: Replace with CBMEM_INIT_HOOKS API. */ |
| 55 | #if !IS_ENABLED(CONFIG_ARCH_X86) |
| 56 | void cbmem_run_init_hooks(void) |
| 57 | { |
Kyösti Mälkki | 0a11a61 | 2014-12-31 19:29:02 +0200 | [diff] [blame^] | 58 | /* Relocate CBMEM console. */ |
| 59 | cbmemc_reinit(); |
Kyösti Mälkki | 823edda | 2014-12-18 18:30:29 +0200 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | void __attribute__((weak)) cbmem_fail_resume(void) |
| 63 | { |
| 64 | } |
| 65 | #endif |