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

Function bpdt_reset

util/cbfstool/ifwitool.c:953–987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

951}
952
953static void bpdt_reset(void)
954{
955 size_t i;
956 size_t bpdt_count = 0, sbpdt_count = 0, dummy_bpdt_count = 0;
957
958 /* Count number of BPDT and S-BPDT entries. */
959 for (i = 0; i < MAX_SUBPARTS; i++) {
960 if (buffer_size(&ifwi_image.subpart_buf[i]) == 0) {
961 if (subparts[i].attr & MANDATORY_BPDT_ENTRY) {
962 bpdt_count++;
963 dummy_bpdt_count++;
964 }
965 continue;
966 }
967
968 if (subparts[i].attr & NON_CRITICAL_SUBPART)
969 sbpdt_count++;
970 else
971 bpdt_count++;
972 }
973
974 DEBUG("Count: BPDT = %zd, Dummy BPDT = %zd, S-BPDT = %zd\n", bpdt_count,
975 dummy_bpdt_count, sbpdt_count);
976
977 /* Update BPDT if required. */
978 size_t bpdt_size = MAX(BPDT_MIN_SIZE,
979 BPDT_HEADER_SIZE + bpdt_count * BPDT_ENTRY_SIZE);
980 __bpdt_reset(&ifwi_image.bpdt, bpdt_count, bpdt_size);
981
982 /* Update S-BPDT if required. */
983 bpdt_size = ALIGN_UP(BPDT_HEADER_SIZE + sbpdt_count * BPDT_ENTRY_SIZE,
984 4 * KiB);
985 __bpdt_reset(&ifwi_image.subpart_buf[S_BPDT_TYPE], sbpdt_count,
986 bpdt_size);
987}
988
989/* Initialize BPDT entries in header order. */
990static void bpdt_entries_init_header_order(void)

Callers 1

ifwi_repackFunction · 0.85

Calls 2

buffer_sizeFunction · 0.85
__bpdt_resetFunction · 0.85

Tested by

no test coverage detected