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

Function alloc_bpdt_buffer

util/cbfstool/ifwitool.c:702–730  ·  view source on GitHub ↗

* Allocate buffer for bpdt header, entries and all sub-partition content. * Returns offset in data where BPDT ends. */

Source from the content-addressed store, hash-verified

700 * Returns offset in data where BPDT ends.
701 */
702static size_t alloc_bpdt_buffer(void *data, size_t size, size_t offset,
703 struct buffer *b, const char *name)
704{
705 struct bpdt_header bpdt_header;
706 assert((offset + BPDT_HEADER_SIZE) < size);
707 bpdt_read_header((uint8_t *)data + offset, &bpdt_header, name);
708
709 /* Buffer to read BPDT header and entries. */
710 alloc_buffer(b, get_bpdt_size(&bpdt_header), name);
711
712 struct bpdt *bpdt = buffer_get(b);
713 memcpy(&bpdt->h, &bpdt_header, BPDT_HEADER_SIZE);
714
715 /*
716 * If no entries are present, maximum offset occupied is (offset +
717 * BPDT_HEADER_SIZE).
718 */
719 if (bpdt->h.descriptor_count == 0)
720 return (offset + BPDT_HEADER_SIZE);
721
722 /* Read all entries. */
723 assert((offset + get_bpdt_size(&bpdt->h)) < size);
724 bpdt_read_entries((uint8_t *)data + offset + BPDT_HEADER_SIZE, bpdt,
725 name);
726
727 /* Read all sub-partition content in subpart_buf. */
728 return read_subpart_buf(data, size, &bpdt->e[0],
729 bpdt->h.descriptor_count);
730}
731
732static void parse_sbpdt(void *data, size_t size)
733{

Callers 2

parse_sbpdtFunction · 0.85
ifwi_parseFunction · 0.85

Calls 7

bpdt_read_headerFunction · 0.85
alloc_bufferFunction · 0.85
get_bpdt_sizeFunction · 0.85
buffer_getFunction · 0.85
bpdt_read_entriesFunction · 0.85
read_subpart_bufFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected