Lines Matching refs:fit
107 static void update_cleanup(void *fit, struct update_header *hdr) in update_cleanup() argument
119 if (fit) in update_cleanup()
120 free(fit); in update_cleanup()
131 static int update_populate_image(void *fit, struct update_header *hdr) in update_populate_image() argument
144 images = fdt_path_offset(fit, FIT_IMAGES_PATH); in update_populate_image()
152 fdt_for_each_subnode(noffset, fit, images) { in update_populate_image()
153 name = fit_get_name(fit, noffset, NULL); in update_populate_image()
165 e->size = fdtdec_get_uint(fit, noffset, "data-size", -ENODATA); in update_populate_image()
196 e->hash_noffset = fdt_subnode_offset(fit, noffset, "hash"); in update_populate_image()
221 void *fit; in update_download_hdr() local
223 fit = memalign(ARCH_DMA_MINALIGN, MAX_UPDATE_HEADER_SIZE); in update_download_hdr()
224 if (!fit) in update_download_hdr()
227 if (tftp_download(fit, UPDATE_HDR_FILE)) { in update_download_hdr()
228 free(fit); in update_download_hdr()
232 if (fdt_check_header(fit)) { in update_download_hdr()
234 free(fit); in update_download_hdr()
240 if ((fdt_totalsize(fit) + SHA256_HASH_SIZE) != filesz) { in update_download_hdr()
245 return fit; in update_download_hdr()
271 static int hdr_checksum_verify(void *fit, struct update_header *hdr) in hdr_checksum_verify() argument
276 hash = (u8 *)fit + fdt_totalsize(fit); in hdr_checksum_verify()
277 sha256_checksum(fit, fdt_totalsize(fit), csum); in hdr_checksum_verify()
315 static int hdr_param_verify(void *fit, struct update_header *hdr, in hdr_param_verify() argument
322 hdr->version = fdtdec_get_uint(fit, 0, "version", 0); in hdr_param_verify()
323 hdr->rollback_idx = fdtdec_get_uint(fit, conf, "rollback-index", 0); in hdr_param_verify()
324 hdr->force_update = fdtdec_get_uint(fit, conf, "force_update", 0); in hdr_param_verify()
325 hdr->mb = fdtdec_get_uint(fit, conf, "image-size-MB", 0); in hdr_param_verify()
343 ret = fit_rollback_index_verify(fit, FIT_ROLLBACK_INDEX, in hdr_param_verify()
385 static int update_verify_hdr(void *fit, struct update_header *hdr, in update_verify_hdr() argument
393 noffset = fdt_path_offset(fit, FIT_CONFS_PATH); in update_verify_hdr()
394 name = fdt_getprop(fit, noffset, "default", NULL); in update_verify_hdr()
395 conf = fdt_subnode_offset(fit, noffset, name); in update_verify_hdr()
401 ret = fit_config_verify(fit, conf); in update_verify_hdr()
408 ret = hdr_checksum_verify(fit, hdr); in update_verify_hdr()
415 ret = hdr_param_verify(fit, hdr, local, conf); in update_verify_hdr()
424 static int update_local_info(void *fit, struct update_header *hdr) in update_local_info() argument
448 static int update_ignore_image(void *fit, struct update_header *hdr, in update_ignore_image() argument
466 static int download_image(void *fit, struct image_element *e) in download_image() argument
495 ret = fit_image_check_hash(fit, e->hash_noffset, e->buf, e->size, &msg); in download_image()
534 static int update_download_image(void *fit, struct image_element *e) in update_download_image() argument
539 ret = download_image(fit, e); in update_download_image()
550 static int update_write_gpt(void *fit, struct update_header *hdr) in update_write_gpt() argument
559 images = fdt_path_offset(fit, FIT_IMAGES_PATH); in update_write_gpt()
563 noffset = fdt_first_subnode(fit, images); in update_write_gpt()
568 name = fit_get_name(fit, noffset, NULL); in update_write_gpt()
578 e->size = fdtdec_get_uint(fit, noffset, "data-size", -ENODATA); in update_write_gpt()
585 e->hash_noffset = fdt_subnode_offset(fit, noffset, "hash"); in update_write_gpt()
596 ret = update_download_image(fit, e); in update_write_gpt()
646 void *fit; in do_tftp_full_update() local
683 fit = update_download_hdr(hdr); in do_tftp_full_update()
684 if (!fit) { in do_tftp_full_update()
690 ret = update_verify_hdr(fit, hdr, local); in do_tftp_full_update()
697 ret = update_write_gpt(fit, hdr); in do_tftp_full_update()
703 ret = update_populate_image(fit, hdr); in do_tftp_full_update()
714 if (update_ignore_image(fit, hdr, e)) in do_tftp_full_update()
717 ret = update_download_image(fit, e); in do_tftp_full_update()
744 update_local_info(fit, hdr); in do_tftp_full_update()
746 update_cleanup(fit, hdr); in do_tftp_full_update()