MCPcopy Create free account
hub / github.com/coreboot/coreboot / dump_vbt

Function dump_vbt

util/intelvbttool/intelvbttool.c:470–730  ·  view source on GitHub ↗

dump VBT contents in human readable form */

Source from the content-addressed store, hash-verified

468
469/* dump VBT contents in human readable form */
470static void dump_vbt(const struct fileobject *fo)
471{
472 if (fo->size < sizeof(struct vbt_header))
473 return;
474
475 const struct vbt_header *head = (const struct vbt_header *)fo->data;
476 const struct bdb_header *bdb;
477 const u8 *ptr;
478 int i;
479 int is_first_skip = 1;
480
481 printt("signature: <%20.20s>\n", head->signature);
482 printt("version: %d.%02d\n", head->version / 100,
483 head->version % 100);
484 if (head->header_size != sizeof(struct vbt_header))
485 printt("header size: 0x%x\n", head->header_size);
486 printt("VBT size: 0x%x\n", head->vbt_size);
487 printt("VBT checksum: 0x%x\n", head->vbt_checksum);
488 if (head->reserved0)
489 printt("header reserved0: 0x%x\n", head->reserved0);
490 if (head->bdb_offset != sizeof(struct vbt_header))
491 printt("BDB offset: 0x%x\n", head->bdb_offset);
492
493 for (i = 0; i < 4; i++)
494 if (head->aim_offset[i])
495 printt("AIM[%d] offset: 0x%x\n", i,
496 head->aim_offset[i]);
497 if (head->bdb_offset + sizeof(*bdb) > fo->size)
498 return;
499 bdb = (const void *) (fo->data + head->bdb_offset);
500
501 if (memcmp("BIOS_DATA_BLOCK ", bdb->signature, 16) != 0) {
502 printerr("invalid BDB signature:%s\n",
503 bdb->signature);
504 exit(1);
505 }
506 printt("BDB version: %d.%02d\n", bdb->version / 100,
507 bdb->version % 100);
508 if (bdb->header_size != sizeof(struct bdb_header))
509 printt("BDB header size: 0x%x\n", bdb->header_size);
510 if (bdb->bdb_size != head->vbt_size - head->bdb_offset)
511 printt("BDB size: 0x%x\n", bdb->bdb_size);
512 for (ptr = (const u8 *) bdb + bdb->header_size;
513 ptr < (const u8 *) bdb + bdb->bdb_size;) {
514 u16 secsz = (ptr[1] | (ptr[2] << 8));
515 u8 sectype = ptr[0];
516 const u8 *section = ptr + 3;
517
518 printt("section type %d, size 0x%x\n", sectype, secsz);
519 ptr += secsz + 3;
520 switch (sectype) {
521 case BDB_GENERAL_FEATURES:{
522 const struct bdb_general_features *sec =
523 (const void *) section;
524 printt("General features:\n");
525
526 if (sec->panel_fitting)
527 printt("\tpanel_fitting = 0x%x\n",

Callers 1

mainFunction · 0.85

Calls 4

printtFunction · 0.85
printerrFunction · 0.85
exitFunction · 0.85
memcmpFunction · 0.50

Tested by

no test coverage detected