Lines Matching full:if

33 #if !defined(MCUBOOT_SWAP_USING_MOVE)
35 #if defined(MCUBOOT_VALIDATE_PRIMARY_SLOT)
42 if (!(x)) { \
50 #if !defined(MCUBOOT_DIRECT_XIP) && !defined(MCUBOOT_RAM_LOAD)
52 * Reads the status of a partially-completed swap, if any. This is necessary
71 if (max_entries < 0) { in swap_read_status_bytes()
81 if (rc < 0) { in swap_read_status_bytes()
85 if (bootutil_buffer_is_erased(fap, &status, 1)) { in swap_read_status_bytes()
86 if (found && !found_idx) { in swap_read_status_bytes()
89 } else if (!found) { in swap_read_status_bytes()
91 } else if (found_idx) { in swap_read_status_bytes()
97 if (invalid) { in swap_read_status_bytes()
101 #if !defined(__BOOTSIM__) in swap_read_status_bytes()
105 #if !defined(MCUBOOT_VALIDATE_PRIMARY_SLOT) in swap_read_status_bytes()
113 if (found) { in swap_read_status_bytes()
114 if (!found_idx) { in swap_read_status_bytes()
156 if ((num_sectors_primary > BOOT_MAX_IMG_SECTORS) || in boot_slots_compatible()
177 if (sz0 == sz1) { in boot_slots_compatible()
182 } else if (sz0 < sz1) { in boot_slots_compatible()
187 if (smaller == 2) { in boot_slots_compatible()
197 if (sector_size == 0) { in boot_slots_compatible()
198 /* Since this supports decompressed images, we can safely exit if slot1 is in boot_slots_compatible()
208 if (smaller == 1) { in boot_slots_compatible()
216 if (sz0 == sz1) { in boot_slots_compatible()
222 if (sz0 > scratch_sz || sz1 > scratch_sz) { in boot_slots_compatible()
232 if ((i != num_sectors_primary) || in boot_slots_compatible()
345 #if MCUBOOT_SWAP_USING_SCRATCH in swap_status_source()
354 #if (BOOT_IMAGE_NUMBER == 1) in swap_status_source()
363 #if MCUBOOT_SWAP_USING_SCRATCH in swap_status_source()
369 #if MCUBOOT_SWAP_USING_SCRATCH in swap_status_source()
375 if (boot_magic_compatible_check(table->bst_magic_primary_slot, in swap_status_source()
377 #if MCUBOOT_SWAP_USING_SCRATCH in swap_status_source()
386 #if (BOOT_IMAGE_NUMBER > 1) && MCUBOOT_SWAP_USING_SCRATCH in swap_status_source()
387 /* In case of multi-image boot it can happen that if boot status in swap_status_source()
391 if (source == BOOT_STATUS_SOURCE_SCRATCH && in swap_status_source()
443 if (new_sz > scratch_sz) { in boot_copy_sz()
482 if ((primary_slot_size < copy_size) || in find_last_sector_idx()
488 if ((secondary_slot_size < copy_size) || in find_last_sector_idx()
494 if (primary_slot_size >= copy_size && in find_last_sector_idx()
571 * is to determine if we're swapping the last sector. The last sector in boot_swap_sectors()
572 * needs special handling because it's where the trailer lives. If we're in boot_swap_sectors()
576 * controls if special handling is needed (swapping last sector). in boot_swap_sectors()
581 if (sector_sz < trailer_sz) { in boot_swap_sectors()
594 if ((img_off + sz) > in boot_swap_sectors()
614 if (bs->state == BOOT_STATUS_STATE_0) { in boot_swap_sectors()
619 if (bs->idx == BOOT_STATUS_IDX_0) { in boot_swap_sectors()
620 /* Write a trailer to the scratch area, even if we don't need the in boot_swap_sectors()
627 if (!bs->use_scratch) { in boot_swap_sectors()
654 if (bs->state == BOOT_STATUS_STATE_1) { in boot_swap_sectors()
662 if (bs->idx == BOOT_STATUS_IDX_0 && !bs->use_scratch) { in boot_swap_sectors()
663 /* If not all sectors of the slot are being swapped, in boot_swap_sectors()
675 if (bs->state == BOOT_STATUS_STATE_2) { in boot_swap_sectors()
679 /* NOTE: If this is the final sector, we exclude the image trailer from in boot_swap_sectors()
686 if (bs->use_scratch) { in boot_swap_sectors()
698 if (swap_state.image_ok == BOOT_FLAG_SET) { in boot_swap_sectors()
703 if (swap_state.swap_type != BOOT_SWAP_TYPE_NONE) { in boot_swap_sectors()
723 /* If we wrote a trailer to the scratch area, erase it after we persist in boot_swap_sectors()
736 if (erase_scratch) { in boot_swap_sectors()
763 if (swap_idx >= (bs->idx - BOOT_STATUS_IDX_0)) { in swap_run()
804 if (sz0 == sz1) { in app_max_size()
809 } else if (sz0 < sz1) { in app_max_size()
814 if (smaller == 2) { in app_max_size()
825 if (smaller == 1) { in app_max_size()
833 if (sz0 == sz1) { in app_max_size()
839 if (sz0 > scratch_sz || sz1 > scratch_sz) { in app_max_size()
871 if (active_slot == BOOT_PRIMARY_SLOT) { in app_max_size()
905 #if (BOOT_IMAGE_NUMBER == 1) in boot_read_image_header()
912 /* If the slots are being swapped, the headers might have been moved to scratch area or to the in boot_read_image_header()
915 if (bs && !boot_status_is_reset(bs)) { in boot_read_image_header()
918 if (rc != 0) { in boot_read_image_header()
926 if (rc != 0) { in boot_read_image_header()
933 if (bs->idx - BOOT_STATUS_IDX_0 >= swap_count) { in boot_read_image_header()
934 /* If all segments have been swapped, the header is located in the other slot */ in boot_read_image_header()
936 } else if (bs->idx - BOOT_STATUS_IDX_0 == swap_count - 1) { in boot_read_image_header()
937 /* If the last swap operation is in progress, the headers are currently being swapped in boot_read_image_header()
941 if (slot == BOOT_SECONDARY_SLOT && bs->state >= BOOT_STATUS_STATE_1) { in boot_read_image_header()
946 } else if (slot == BOOT_PRIMARY_SLOT && bs->state >= BOOT_STATUS_STATE_2) { in boot_read_image_header()
955 if (hdr_slot == BOOT_NUM_SLOTS) { in boot_read_image_header()
965 if (rc == 0) { in boot_read_image_header()
970 if (rc != 0) { in boot_read_image_header()