summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2014-05-14 10:12:55 -0700
committerMarc Jones <marc.jones@se-eng.com>2014-12-30 19:17:47 +0100
commit8b143c5c8bb2825b8ea1a704066023307c49e21f (patch)
tree367d8a0cb023bf72698d5729d835a3f254b8aebb
parentc2537175ecf06d1834e8ce5f5b08816269ad3393 (diff)
cbmem: use a single id to name mapping table
CBMEM IDs are converted to symbolic names by both target and host code. Keep the conversion table in one place to avoid getting out of sync. BUG=none TEST=manual . the new firmware still displays proper CBMEM table entry descriptions: coreboot table: 276 bytes. CBMEM ROOT 0. 5ffff000 00001000 COREBOOT 1. 5fffd000 00002000 . running make in util/cbmem still succeeds Original-Change-Id: I0bd9d288f9e6432b531cea2ae011a6935a228c7a Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/199791 Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 5217446a536bb1ba874e162c6e2e16643caa592a) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Change-Id: I0d839316e9697bd3afa0b60490a840d39902dfb3 Reviewed-on: http://review.coreboot.org/7938 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--src/include/cbmem.h39
-rw-r--r--src/lib/cbmem_info.c36
-rw-r--r--util/cbmem/cbmem.c30
3 files changed, 40 insertions, 65 deletions
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 0b2eba7d54..7de6e56b05 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -73,12 +73,49 @@
#define CBMEM_ID_RAM_OOPS 0x05430095
#define CBMEM_ID_NONE 0x00000000
#define CBMEM_ID_AGESA_RUNTIME 0x41474553
-#define CBMEM_ID_HOB_POINTER 0x484f4221
+#define CBMEM_ID_HOB_POINTER 0x484f4221
#ifndef __ASSEMBLER__
#include <stddef.h>
#include <stdint.h>
+struct cbmem_id_to_name {
+ u32 id;
+ const char *name;
+};
+
+#define CBMEM_ID_TO_NAME_TABLE \
+ { CBMEM_ID_FREESPACE, "FREE SPACE " }, \
+ { CBMEM_ID_GDT, "GDT " }, \
+ { CBMEM_ID_ACPI, "ACPI " }, \
+ { CBMEM_ID_CBTABLE, "COREBOOT " }, \
+ { CBMEM_ID_PIRQ, "IRQ TABLE " }, \
+ { CBMEM_ID_MPTABLE, "SMP TABLE " }, \
+ { CBMEM_ID_RESUME, "ACPI RESUME" }, \
+ { CBMEM_ID_RESUME_SCRATCH, "ACPISCRATCH" }, \
+ { CBMEM_ID_ACPI_GNVS, "ACPI GNVS " }, \
+ { CBMEM_ID_ACPI_GNVS_PTR, "GNVS PTR " }, \
+ { CBMEM_ID_SMBIOS, "SMBIOS " }, \
+ { CBMEM_ID_TIMESTAMP, "TIME STAMP " }, \
+ { CBMEM_ID_MRCDATA, "MRC DATA " }, \
+ { CBMEM_ID_CONSOLE, "CONSOLE " }, \
+ { CBMEM_ID_ELOG, "ELOG " }, \
+ { CBMEM_ID_COVERAGE, "COVERAGE " }, \
+ { CBMEM_ID_ROMSTAGE_INFO, "ROMSTAGE " }, \
+ { CBMEM_ID_ROMSTAGE_RAM_STACK, "ROMSTG STCK" }, \
+ { CBMEM_ID_RAMSTAGE, "RAMSTAGE " }, \
+ { CBMEM_ID_RAMSTAGE_CACHE, "RAMSTAGE $ " }, \
+ { CBMEM_ID_ROOT, "CBMEM ROOT " }, \
+ { CBMEM_ID_VBOOT_HANDOFF, "VBOOT " }, \
+ { CBMEM_ID_CAR_GLOBALS, "CAR GLOBALS" }, \
+ { CBMEM_ID_AGESA_RUNTIME, "AGESA RSVD " }, \
+ { CBMEM_ID_EHCI_DEBUG, "USBDEBUG " }, \
+ { CBMEM_ID_REFCODE, "REFCODE " }, \
+ { CBMEM_ID_SMM_SAVE_SPACE, "SMM BACKUP " }, \
+ { CBMEM_ID_REFCODE_CACHE, "REFCODE $ " }, \
+ { CBMEM_ID_POWER_STATE, "POWER STATE" }, \
+ { CBMEM_ID_RAM_OOPS, "RAMOOPS " },
+
struct cbmem_entry;
#if CONFIG_DYNAMIC_CBMEM
diff --git a/src/lib/cbmem_info.c b/src/lib/cbmem_info.c
index 49724d6e28..7b1168dc4e 100644
--- a/src/lib/cbmem_info.c
+++ b/src/lib/cbmem_info.c
@@ -20,41 +20,7 @@
#include <cbmem.h>
#include <stdlib.h>
-static struct cbmem_id_to_name {
- u32 id;
- const char *name;
-} cbmem_ids[] = {
- { CBMEM_ID_FREESPACE, "FREE SPACE " },
- { CBMEM_ID_GDT, "GDT " },
- { CBMEM_ID_ACPI, "ACPI " },
- { CBMEM_ID_CBTABLE, "COREBOOT " },
- { CBMEM_ID_PIRQ, "IRQ TABLE " },
- { CBMEM_ID_MPTABLE, "SMP TABLE " },
- { CBMEM_ID_RESUME, "ACPI RESUME" },
- { CBMEM_ID_RESUME_SCRATCH, "ACPISCRATCH" },
- { CBMEM_ID_ACPI_GNVS, "ACPI GNVS " },
- { CBMEM_ID_ACPI_GNVS_PTR, "GNVS PTR " },
- { CBMEM_ID_SMBIOS, "SMBIOS " },
- { CBMEM_ID_TIMESTAMP, "TIME STAMP " },
- { CBMEM_ID_MRCDATA, "MRC DATA " },
- { CBMEM_ID_CONSOLE, "CONSOLE " },
- { CBMEM_ID_ELOG, "ELOG " },
- { CBMEM_ID_COVERAGE, "COVERAGE " },
- { CBMEM_ID_ROMSTAGE_INFO, "ROMSTAGE " },
- { CBMEM_ID_ROMSTAGE_RAM_STACK, "ROMSTG STCK" },
- { CBMEM_ID_RAMSTAGE, "RAMSTAGE " },
- { CBMEM_ID_RAMSTAGE_CACHE, "RAMSTAGE $ " },
- { CBMEM_ID_ROOT, "CBMEM ROOT " },
- { CBMEM_ID_VBOOT_HANDOFF, "VBOOT " },
- { CBMEM_ID_CAR_GLOBALS, "CAR GLOBALS" },
- { CBMEM_ID_AGESA_RUNTIME, "AGESA RSVD " },
- { CBMEM_ID_EHCI_DEBUG, "USBDEBUG " },
- { CBMEM_ID_REFCODE, "REFCODE " },
- { CBMEM_ID_SMM_SAVE_SPACE, "SMM BACKUP " },
- { CBMEM_ID_REFCODE_CACHE, "REFCODE $ " },
- { CBMEM_ID_POWER_STATE, "POWER STATE" },
- { CBMEM_ID_RAM_OOPS, "RAMOOPS " },
-};
+static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
{
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 999135f531..1117c664aa 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -587,35 +587,7 @@ struct cbmem_entry {
uint64_t size;
} __attribute__((packed));
-static const struct cbmem_id_to_name {
- u32 id;
- const char *name;
-} cbmem_ids[] = {
- { CBMEM_ID_FREESPACE, "FREE SPACE " },
- { CBMEM_ID_GDT, "GDT " },
- { CBMEM_ID_ACPI, "ACPI " },
- { CBMEM_ID_CBTABLE, "COREBOOT " },
- { CBMEM_ID_PIRQ, "IRQ TABLE " },
- { CBMEM_ID_MPTABLE, "SMP TABLE " },
- { CBMEM_ID_RESUME, "ACPI RESUME" },
- { CBMEM_ID_RESUME_SCRATCH, "ACPISCRATCH" },
- { CBMEM_ID_ACPI_GNVS, "ACPI GNVS " },
- { CBMEM_ID_ACPI_GNVS_PTR, "GNVS PTR " },
- { CBMEM_ID_SMBIOS, "SMBIOS " },
- { CBMEM_ID_TIMESTAMP, "TIME STAMP " },
- { CBMEM_ID_MRCDATA, "MRC DATA " },
- { CBMEM_ID_CONSOLE, "CONSOLE " },
- { CBMEM_ID_ELOG, "ELOG " },
- { CBMEM_ID_COVERAGE, "COVERAGE " },
- { CBMEM_ID_ROMSTAGE_INFO, "ROMSTAGE " },
- { CBMEM_ID_ROMSTAGE_RAM_STACK, "ROMSTG STCK" },
- { CBMEM_ID_RAMSTAGE, "RAMSTAGE " },
- { CBMEM_ID_RAMSTAGE_CACHE, "RAMSTAGE $ " },
- { CBMEM_ID_ROOT, "CBMEM ROOT " },
- { CBMEM_ID_VBOOT_HANDOFF, "VBOOT " },
- { CBMEM_ID_CAR_GLOBALS, "CAR GLOBALS" },
- { CBMEM_ID_SMM_SAVE_SPACE, "SMM BACKUP " },
-};
+static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE };
void cbmem_print_entry(int n, uint32_t id, uint64_t base, uint64_t size)
{