From 9ab80a33a53ec294d89d9d37deb5d48ada2e1935 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 18 Feb 2019 14:35:54 +0100 Subject: cbfstool: Drop update-fit option The ifittool is used instead. Drop old code. Change-Id: I70fec5fef9ffd1ba3049badb398783f31aefb02f Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/31496 Tested-by: build bot (Jenkins) Reviewed-by: Philipp Deppenwiese --- util/cbfstool/fit.c | 96 ----------------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'util/cbfstool/fit.c') diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c index 86dde4d23d..4cd84f232d 100644 --- a/util/cbfstool/fit.c +++ b/util/cbfstool/fit.c @@ -737,99 +737,3 @@ int fit_delete_entry(struct fit_table *fit, return 0; } - -/* Legacy code. TODO: Remove once ifittool is merged. */ - -static void add_microcodde_entries(struct fit_table *fit, - const struct cbfs_image *image, - ssize_t num_mcus, - struct microcode_entry *mcus, - fit_offset_converter_t offset_helper, - uint32_t first_mcu_addr) -{ - int i = 0; - /* - * Check if an entry has to be forced into the FIT at index 0. - * first_mcu_addr is an address (in ROM) that will point to a - * microcode patch. - */ - if (first_mcu_addr) { - struct fit_entry *entry = &fit->entries[0]; - update_fit_ucode_entry(fit, entry, first_mcu_addr); - i = 1; - } - - struct microcode_entry *mcu = &mcus[0]; - for (; i < num_mcus; i++) { - struct fit_entry *entry = &fit->entries[i]; - update_fit_ucode_entry(fit, entry, offset_to_ptr(offset_helper, - &image->buffer, mcu->offset)); - mcu++; - } -} - -int fit_update_table(struct buffer *bootblock, struct cbfs_image *image, - const char *microcode_blob_name, - unsigned int empty_entries, - fit_offset_converter_t offset_fn, uint32_t topswap_size, - uint32_t first_mcu_addr) -{ - struct fit_table *fit, *fit2; - struct microcode_entry *mcus; - size_t mcus_found; - - int ret = 0; - - fit = fit_get_table(bootblock, offset_fn, 0); - if (!fit) { - ERROR("FIT not found.\n"); - return 1; - } - - mcus = malloc(sizeof(*mcus) * empty_entries); - if (!mcus) { - ERROR("Couldn't allocate memory for microcode entries.\n"); - return 1; - } - - if (parse_microcode_blob(image, microcode_blob_name, &mcus_found, - mcus, empty_entries)) { - ERROR("Couldn't parse microcode blob.\n"); - ret = 1; - goto out; - } - - add_microcodde_entries(fit, image, mcus_found, mcus, offset_fn, 0); - - update_fit_checksum(fit); - - /* A second fit is exactly topswap size away from the bottom one */ - if (topswap_size) { - - fit2 = fit_get_table(bootblock, offset_fn, topswap_size); - - if (!fit_table_verified(fit2)) { - ERROR("second FIT is invalid\n"); - ret = 1; - goto out; - } - /* Check if we have room for first entry */ - if (first_mcu_addr) { - if (mcus_found >= empty_entries) { - ERROR("No room, blob mcus = %zd, total entries" - " = %d\n", mcus_found, empty_entries); - ret = 1; - goto out; - } - /* Add 1 for the first entry */ - mcus_found++; - } - /* Add entries in the second FIT */ - add_microcodde_entries(fit2, image, mcus_found, mcus, - offset_fn, first_mcu_addr); - update_fit_checksum(fit2); - } -out: - free(mcus); - return ret; -} -- cgit v1.2.3