summaryrefslogtreecommitdiff
path: root/common/bloblist.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-12 19:26:19 -0700
committerSimon Glass <sjg@chromium.org>2022-01-13 09:13:41 -0700
commitf16ec77784b4a2ffdba82bc4044581131aea44e4 (patch)
tree7bbf6a2e323f2684e74b2d54bfb1a679a45a758a /common/bloblist.c
parentf9abc1cac1130279b486c51056b2e6fba99633b1 (diff)
bloblist: Use explicit numbering for the tags
At present if someone adds a tag in the middle of the list it works well enough within a U-Boot build. But if these tags are used in another project, or with an older version of SPL, the numbers make become inconsistent. Use explicit tag numbers that never change, to resolve this problem. Allocate areas for existing U-Boot tags and set up an area for use by projects and vendors, as well as for private use. Keep tags above 0x10000 unallocated for now. Update bloblist_tag_name() and the tests to work with this new setup. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/bloblist.c')
-rw-r--r--common/bloblist.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/common/bloblist.c b/common/bloblist.c
index 784eff61de..baf1d371b7 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -29,24 +29,39 @@
DECLARE_GLOBAL_DATA_PTR;
-static const char *const tag_name[] = {
- [BLOBLISTT_NONE] = "(none)",
- [BLOBLISTT_U_BOOT_SPL_HANDOFF] = "SPL hand-off",
- [BLOBLISTT_VBOOT_CTX] = "Chrome OS vboot context",
- [BLOBLISTT_ACPI_GNVS] = "ACPI GNVS",
- [BLOBLISTT_INTEL_VBT] = "Intel Video-BIOS table",
- [BLOBLISTT_TPM2_TCG_LOG] = "TPM v2 log space",
- [BLOBLISTT_TCPA_LOG] = "TPM log space",
- [BLOBLISTT_ACPI_TABLES] = "ACPI tables for x86",
- [BLOBLISTT_SMBIOS_TABLES] = "SMBIOS tables for x86",
+static struct tag_name {
+ enum bloblist_tag_t tag;
+ const char *name;
+} tag_name[] = {
+ { BLOBLISTT_NONE, "(none)" },
+
+ /* BLOBLISTT_AREA_FIRMWARE_TOP */
+
+ /* BLOBLISTT_AREA_FIRMWARE */
+ { BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
+ { BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" },
+ { BLOBLISTT_TPM2_TCG_LOG, "TPM v2 log space" },
+ { BLOBLISTT_TCPA_LOG, "TPM log space" },
+ { BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
+ { BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" },
+ { BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
+
+ /* BLOBLISTT_PROJECT_AREA */
+ { BLOBLISTT_U_BOOT_SPL_HANDOFF, "SPL hand-off" },
+
+ /* BLOBLISTT_VENDOR_AREA */
};
const char *bloblist_tag_name(enum bloblist_tag_t tag)
{
- if (tag < 0 || tag >= BLOBLISTT_COUNT)
- return "invalid";
+ int i;
- return tag_name[tag];
+ for (i = 0; i < ARRAY_SIZE(tag_name); i++) {
+ if (tag_name[i].tag == tag)
+ return tag_name[i].name;
+ }
+
+ return "invalid";
}
static struct bloblist_rec *bloblist_first_blob(struct bloblist_hdr *hdr)
@@ -381,10 +396,10 @@ void bloblist_show_list(void)
struct bloblist_hdr *hdr = gd->bloblist;
struct bloblist_rec *rec;
- printf("%-8s %8s Tag Name\n", "Address", "Size");
+ printf("%-8s %8s Tag Name\n", "Address", "Size");
for (rec = bloblist_first_blob(hdr); rec;
rec = bloblist_next_blob(hdr, rec)) {
- printf("%08lx %8x %3d %s\n",
+ printf("%08lx %8x %4x %s\n",
(ulong)map_to_sysmem((void *)rec + rec->hdr_size),
rec->size, rec->tag, bloblist_tag_name(rec->tag));
}