blob: 7b1168dc4e5ab0af553581d7c1f8845d3b28123c [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
Vadim Bendebury8b143c52014-05-14 10:12:55 -070023static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
Aaron Durbindf3a1092013-03-13 12:41:44 -050024
25void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
26{
27 int i;
28 const char *name;
29
30 name = NULL;
31 for (i = 0; i < ARRAY_SIZE(cbmem_ids); i++) {
32 if (cbmem_ids[i].id == id) {
33 name = cbmem_ids[i].name;
34 break;
35 }
36 }
37
38 if (name == NULL)
39 printk(BIOS_DEBUG, "%08x ", id);
40 else
41 printk(BIOS_DEBUG, "%s", name);
42 printk(BIOS_DEBUG, "%2d. ", n);
43 printk(BIOS_DEBUG, "%08llx ", base);
44 printk(BIOS_DEBUG, "%08llx\n", size);
45}