Lines Matching refs:bs

58         struct boot_loader_state *state, struct boot_status *bs)  in swap_read_status_bytes()  argument
117 bs->idx = (found_idx / BOOT_STATUS_STATE_COUNT) + 1; in swap_read_status_bytes()
118 bs->state = (found_idx % BOOT_STATUS_STATE_COUNT) + 1; in swap_read_status_bytes()
125 boot_status_internal_off(const struct boot_status *bs, int elem_sz) in boot_status_internal_off() argument
131 return (bs->idx - BOOT_STATUS_IDX_0) * idx_sz + in boot_status_internal_off()
132 (bs->state - BOOT_STATUS_STATE_0) * elem_sz; in boot_status_internal_off()
547 struct boot_status *bs) in boot_swap_sectors() argument
599 bs->use_scratch = (bs->idx == BOOT_STATUS_IDX_0 && copy_sz != 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()
624 rc = swap_status_init(state, fap_scratch, bs); in boot_swap_sectors()
627 if (!bs->use_scratch) { in boot_swap_sectors()
635 rc = swap_status_init(state, fap_primary_slot, bs); in boot_swap_sectors()
649 rc = boot_write_status(state, bs); in boot_swap_sectors()
650 bs->state = BOOT_STATUS_STATE_1; 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()
670 rc = boot_write_status(state, bs); in boot_swap_sectors()
671 bs->state = BOOT_STATUS_STATE_2; in boot_swap_sectors()
675 if (bs->state == BOOT_STATUS_STATE_2) { in boot_swap_sectors()
686 if (bs->use_scratch) { in boot_swap_sectors()
709 rc = boot_write_swap_size(fap_primary_slot, bs->swap_size); in boot_swap_sectors()
713 rc = boot_write_enc_key(fap_primary_slot, 0, bs); in boot_swap_sectors()
716 rc = boot_write_enc_key(fap_primary_slot, 1, bs); in boot_swap_sectors()
728 erase_scratch = bs->use_scratch; in boot_swap_sectors()
729 bs->use_scratch = 0; in boot_swap_sectors()
731 rc = boot_write_status(state, bs); in boot_swap_sectors()
732 bs->idx++; in boot_swap_sectors()
733 bs->state = BOOT_STATUS_STATE_0; in boot_swap_sectors()
748 swap_run(struct boot_loader_state *state, struct boot_status *bs, in swap_run() argument
763 if (swap_idx >= (bs->idx - BOOT_STATUS_IDX_0)) { in swap_run()
764 boot_swap_sectors(first_sector_idx, sz, state, bs); in swap_run()
890 struct image_header *out_hdr, struct boot_status *bs) in boot_read_image_header() argument
902 (void)bs; in boot_read_image_header()
915 if (bs && !boot_status_is_reset(bs)) { in boot_read_image_header()
933 if (bs->idx - BOOT_STATUS_IDX_0 >= swap_count) { in boot_read_image_header()
936 } else if (bs->idx - BOOT_STATUS_IDX_0 == swap_count - 1) { 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()