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

Function fix_vbios_header

util/intelvbttool/intelvbttool.c:981–1004  ·  view source on GitHub ↗

Fix VBIOS header and PCIR */

Source from the content-addressed store, hash-verified

979
980/* Fix VBIOS header and PCIR */
981static int fix_vbios_header(struct fileobject *fo)
982{
983 if (!fo || fo->size < sizeof(optionrom_header_t))
984 return 1;
985
986 optionrom_header_t *oh = (optionrom_header_t *)fo->data;
987
988 /* Fix size alignment */
989 if (fo->size % 512) {
990 print("Aligning size to 512\n");
991 fo = remalloc_fo(fo, (fo->size + 511) / 512 * 512);
992 if (!fo)
993 return 1;
994 oh = (optionrom_header_t *)fo->data;
995 }
996
997 /* Fix size field */
998 oh->size = fo->size / 512;
999
1000 /* Fix checksum field */
1001 oh->checksum = -(checksum_vbios(oh) - oh->checksum);
1002
1003 return 0;
1004}
1005
1006/* Return the VBT structure size in bytes */
1007static size_t vbt_size(const struct fileobject *fo)

Callers 1

mainFunction · 0.85

Calls 3

printFunction · 0.85
remalloc_foFunction · 0.85
checksum_vbiosFunction · 0.85

Tested by

no test coverage detected