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

Function parse_vbios

util/intelvbttool/intelvbttool.c:880–921  ·  view source on GitHub ↗

* Parse Option ROM and return a valid VBT fileobject. * Caller has to make sure that it is a valid VBIOS. * Return a NULL fileobject on error. */

Source from the content-addressed store, hash-verified

878 * Return a NULL fileobject on error.
879 */
880static void parse_vbios(const struct fileobject *fo,
881 struct fileobject **vbt)
882{
883 const optionrom_header_t *oh = (const optionrom_header_t *)fo->data;
884 size_t i;
885
886 *vbt = NULL;
887
888 if (!oh->vbt_offset) {
889 printerr("no VBT found\n");
890 return;
891 }
892
893 if (oh->vbt_offset > (fo->size - sizeof(struct vbt_header))) {
894 printerr("invalid VBT offset\n");
895 return;
896 }
897
898 struct fileobject *fo_vbt = malloc_fo_sub(fo, oh->vbt_offset);
899 if (fo_vbt) {
900 parse_vbt(fo_vbt, vbt);
901 free_fo(fo_vbt);
902 if (*vbt)
903 return;
904 }
905 printwarn("VBT wasn't found at specified offset of %04x\n",
906 oh->vbt_offset);
907
908 for (i = sizeof(optionrom_header_t);
909 i <= fo->size - sizeof(struct vbt_header); i++) {
910 struct fileobject *fo_vbt = malloc_fo_sub(fo, i);
911 if (!fo_vbt)
912 break;
913
914 parse_vbt(fo_vbt, vbt);
915
916 free_fo(fo_vbt);
917
918 if (*vbt)
919 return;
920 }
921}
922
923/* Short VBT summary in human readable form */
924static void print_vbt(const struct fileobject *fo)

Callers 2

patch_vbiosFunction · 0.85
mainFunction · 0.85

Calls 5

printerrFunction · 0.85
malloc_fo_subFunction · 0.85
parse_vbtFunction · 0.85
free_foFunction · 0.85
printwarnFunction · 0.85

Tested by

no test coverage detected