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

Function fit_add_entry

util/cbfstool/fit.c:714–776  ·  view source on GitHub ↗

* Adds an known entry to the FIT. * len is optional for same types and might be zero. * offset is an absolute address in 32-bit protected mode address space. */

Source from the content-addressed store, hash-verified

712 * offset is an absolute address in 32-bit protected mode address space.
713 */
714int fit_add_entry(struct fit_table *fit,
715 const uint32_t offset,
716 const uint32_t len,
717 const enum fit_type type,
718 const size_t max_fit_entries)
719{
720 struct fit_entry *entry;
721
722 if (!fit) {
723 ERROR("Internal error.\n");
724 return 1;
725 }
726
727 if (fit_free_space(fit, max_fit_entries) < 1) {
728 ERROR("No space left in FIT.\n");
729 return 1;
730 }
731
732 if (!fit_is_supported_type(type)) {
733 ERROR("Unsupported FIT type %u\n", type);
734 return 1;
735 }
736
737 DEBUG("Adding new entry type %u at offset %zd\n", type,
738 fit_table_entries(fit));
739
740 entry = get_next_free_entry(fit);
741
742 switch (type) {
743 case FIT_TYPE_MICROCODE:
744 update_fit_ucode_entry(fit, entry, offset);
745 break;
746 case FIT_TYPE_BIOS_ACM:
747 update_fit_bios_acm_entry(fit, entry, offset);
748 break;
749 case FIT_TYPE_PLATFORM_BOOT_POLICY:
750 update_fit_pbp_entry(fit, entry, offset);
751 break;
752 case FIT_TYPE_BIOS_STARTUP:
753 update_fit_bios_startup_entry(fit, entry, offset, len);
754 break;
755 case FIT_TYPE_BIOS_POLICY:
756 update_fit_bios_policy_entry(fit, entry, offset, len);
757 break;
758 case FIT_TYPE_TXT_POLICY:
759 update_fit_txt_policy_entry(fit, entry, offset);
760 break;
761 case FIT_TYPE_KEY_MANIFEST:
762 update_fit_key_manifest_entry(fit, entry, offset, len);
763 break;
764 case FIT_TYPE_BOOT_POLICY:
765 update_fit_boot_policy_entry(fit, entry, offset, len);
766 break;
767 default:
768 return 1;
769 }
770
771 sort_fit_table(fit);

Callers 2

fit_add_microcode_fileFunction · 0.85
mainFunction · 0.85

Calls 14

fit_free_spaceFunction · 0.85
fit_is_supported_typeFunction · 0.85
fit_table_entriesFunction · 0.85
get_next_free_entryFunction · 0.85
update_fit_ucode_entryFunction · 0.85
update_fit_pbp_entryFunction · 0.85

Tested by

no test coverage detected