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

Function ifwi_parse

util/cbfstool/cse_serger.c:340–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340static int ifwi_parse(const char *image_name)
341{
342 struct buffer *input_buff = &ifwi.input_buff;
343 struct buffer bpdt_buff;
344
345 if (buffer_from_file(input_buff, image_name)) {
346 ERROR("Failed to read input file %s\n", image_name);
347 return -1;
348 }
349
350 buffer_clone(&bpdt_buff, input_buff);
351
352 ifwi.bpdt_ops = get_bpdt_ops(&bpdt_buff);
353 if (!ifwi.bpdt_ops) {
354 ERROR("No matching bpdt_ops!\n");
355 return -1;
356 }
357
358 ifwi.bpdt_hdr = ifwi.bpdt_ops->read_hdr(&bpdt_buff);
359 if (ifwi.bpdt_hdr == NULL)
360 return -1;
361
362 read_bpdt_entries(&bpdt_buff);
363 set_file_end_offset(&bpdt_buff);
364
365 if (!ifwi.bpdt_ops->validate_checksum(ifwi.bpdt_hdr, &ifwi.bpdt_entries[0])) {
366 ERROR("Checksum failed!\n");
367 return -1;
368 }
369
370 ifwi.subpart_hdr_ops = get_subpart_hdr_ops();
371 if (ifwi.subpart_hdr_ops == NULL) {
372 ERROR("No matching subpart_hdr_ops for given BPDT!\n");
373 return -1;
374 }
375
376 ifwi.subpart_entry_ops = get_subpart_entry_ops();
377 if (ifwi.subpart_entry_ops == NULL) {
378 ERROR("No matching subpart_entry_ops for given BPDT!\n");
379 return -1;
380 }
381
382 return subpart_read(&ifwi.input_buff);
383}
384
385static int subpart_write(struct buffer *buff)
386{

Callers 1

mainFunction · 0.70

Calls 8

buffer_from_fileFunction · 0.85
buffer_cloneFunction · 0.85
get_bpdt_opsFunction · 0.85
read_bpdt_entriesFunction · 0.85
set_file_end_offsetFunction · 0.85
get_subpart_hdr_opsFunction · 0.85
get_subpart_entry_opsFunction · 0.85
subpart_readFunction · 0.85

Tested by

no test coverage detected