diff options
author | Tom Rini <trini@konsulko.com> | 2024-11-03 17:23:29 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-03 21:27:13 -0600 |
commit | bf066dc3ebfe79ed24f889a41abe43d48d26c454 (patch) | |
tree | 7a967c47cb8d2bc242b241f35d3dcdaee257a883 /cmd/x86/cbsysinfo.c | |
parent | 93cfcb026a124b133e85a025c51fcc6c85bc385e (diff) | |
parent | dc24948a457e2f5cb7c518a9458be851b8b7e9ea (diff) |
Merge tag 'dm-pull-2nov24' of https://source.denx.de/u-boot/custodians/u-boot-dm
CI: https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/23152
CI: https://dev.azure.com/simon0972/u-boot/_build/results?buildId=71&view=results
- alist enhancements and fixes
- minor test and sandbox fixes
- some more x86/coreboot patches
Diffstat (limited to 'cmd/x86/cbsysinfo.c')
-rw-r--r-- | cmd/x86/cbsysinfo.c | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/cmd/x86/cbsysinfo.c b/cmd/x86/cbsysinfo.c index 7ca2e13ae2f..ea4d89616f6 100644 --- a/cmd/x86/cbsysinfo.c +++ b/cmd/x86/cbsysinfo.c @@ -184,6 +184,77 @@ static const char *timestamp_name(uint32_t id) return "<unknown>"; } +static void show_option_vals(const struct cb_cmos_option_table *tab, + uint id) +{ + const void *ptr, *end; + bool found = false; + + end = (void *)tab + tab->size; + for (ptr = (void *)tab + tab->header_length; ptr < end;) { + const struct cb_record *rec = ptr; + + switch (rec->tag) { + case CB_TAG_OPTION_ENUM: { + const struct cb_cmos_enums *enums = ptr; + + if (enums->config_id == id) { + if (!found) + printf(" "); + printf(" %d:%s", enums->value, enums->text); + found = true; + } + break; + } + break; + case CB_TAG_OPTION_DEFAULTS: + case CB_TAG_OPTION_CHECKSUM: + case CB_TAG_OPTION: + break; + default: + printf("tag %x\n", rec->tag); + break; + } + ptr += rec->size; + } +} + +static void show_option_table(const struct cb_cmos_option_table *tab) +{ + const void *ptr, *end; + + print_ptr("option_table", tab); + if (!tab->size) + return; + + printf(" Bit Len Cfg ID Name\n"); + end = (void *)tab + tab->size; + for (ptr = (void *)tab + tab->header_length; ptr < end;) { + const struct cb_record *rec = ptr; + + switch (rec->tag) { + case CB_TAG_OPTION: { + const struct cb_cmos_entries *entry = ptr; + + printf("%4x %4x %3c %3x %-20s", entry->bit, + entry->length, entry->config, entry->config_id, + entry->name); + show_option_vals(tab, entry->config_id); + printf("\n"); + break; + } + case CB_TAG_OPTION_ENUM: + case CB_TAG_OPTION_DEFAULTS: + case CB_TAG_OPTION_CHECKSUM: + break; + default: + printf("tag %x\n", rec->tag); + break; + } + ptr += rec->size; + } +} + static void show_table(struct sysinfo_t *info, bool verbose) { struct cb_serial *ser = info->serial; @@ -218,7 +289,7 @@ static void show_table(struct sysinfo_t *info, bool verbose) printf("%12d: %02x:%-8s %016llx %016llx\n", i, mr->type, get_mem_name(mr->type), mr->base, mr->size); } - print_ptr("option_table", info->option_table); + show_option_table(info->option_table); print_hex("CMOS start", info->cmos_range_start); if (info->cmos_range_start) { |