@@ -194,7 +194,7 @@ boot_add_shared_data(struct boot_loader_state *state,
194
194
static void
195
195
fill_rsp (struct boot_loader_state * state , struct boot_rsp * rsp )
196
196
{
197
- uint32_t active_slot ;
197
+ enum boot_slot active_slot ;
198
198
199
199
#if (BOOT_IMAGE_NUMBER > 1 )
200
200
/* Always boot from the first enabled image. */
@@ -451,7 +451,7 @@ static int
451
451
boot_verify_dependencies (struct boot_loader_state * state )
452
452
{
453
453
int rc = -1 ;
454
- uint32_t active_slot ;
454
+ enum boot_slot active_slot ;
455
455
456
456
IMAGES_ITER (BOOT_CURR_IMG (state )) {
457
457
if (state -> img_mask [BOOT_CURR_IMG (state )]) {
@@ -467,7 +467,7 @@ boot_verify_dependencies(struct boot_loader_state *state)
467
467
#endif /* MCUBOOT_RAM_LOAD */
468
468
469
469
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
470
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
470
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
471
471
472
472
return rc ;
473
473
}
@@ -849,7 +849,7 @@ boot_check_header_erased(struct boot_loader_state *state, int slot)
849
849
static bool
850
850
boot_rom_address_check (struct boot_loader_state * state )
851
851
{
852
- uint32_t active_slot ;
852
+ enum boot_slot active_slot ;
853
853
const struct image_header * hdr ;
854
854
uint32_t f_off ;
855
855
@@ -2584,7 +2584,7 @@ boot_get_slot_usage(struct boot_loader_state *state)
2584
2584
}
2585
2585
}
2586
2586
2587
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2587
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2588
2588
}
2589
2589
2590
2590
return 0 ;
@@ -2596,19 +2596,19 @@ boot_get_slot_usage(struct boot_loader_state *state)
2596
2596
*
2597
2597
* @param state Boot loader status information.
2598
2598
*
2599
- * @return NO_ACTIVE_SLOT if no available slot found, number of
2599
+ * @return BOOT_SLOT_NONE if no available slot found, number of
2600
2600
* the found slot otherwise.
2601
2601
*/
2602
2602
static uint32_t
2603
2603
find_slot_with_highest_version (struct boot_loader_state * state )
2604
2604
{
2605
2605
uint32_t slot ;
2606
- uint32_t candidate_slot = NO_ACTIVE_SLOT ;
2606
+ uint32_t candidate_slot = BOOT_SLOT_NONE ;
2607
2607
int rc ;
2608
2608
2609
2609
for (slot = 0 ; slot < BOOT_NUM_SLOTS ; slot ++ ) {
2610
2610
if (state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [slot ]) {
2611
- if (candidate_slot == NO_ACTIVE_SLOT ) {
2611
+ if (candidate_slot == BOOT_SLOT_NONE ) {
2612
2612
candidate_slot = slot ;
2613
2613
} else {
2614
2614
rc = boot_version_cmp (
@@ -2636,7 +2636,7 @@ find_slot_with_highest_version(struct boot_loader_state *state)
2636
2636
static void
2637
2637
print_loaded_images (struct boot_loader_state * state )
2638
2638
{
2639
- uint32_t active_slot ;
2639
+ enum boot_slot active_slot ;
2640
2640
2641
2641
(void )state ;
2642
2642
@@ -2672,7 +2672,7 @@ boot_select_or_erase(struct boot_loader_state *state)
2672
2672
{
2673
2673
const struct flash_area * fap = NULL ;
2674
2674
int rc ;
2675
- uint32_t active_slot ;
2675
+ enum boot_slot active_slot ;
2676
2676
struct boot_swap_state * active_swap_state ;
2677
2677
2678
2678
active_slot = state -> slot_usage [BOOT_CURR_IMG (state )].active_slot ;
@@ -2736,7 +2736,7 @@ boot_select_or_erase(struct boot_loader_state *state)
2736
2736
fih_ret
2737
2737
boot_load_and_validate_images (struct boot_loader_state * state )
2738
2738
{
2739
- uint32_t active_slot ;
2739
+ enum boot_slot active_slot ;
2740
2740
int rc ;
2741
2741
fih_ret fih_rc ;
2742
2742
uint32_t slot ;
@@ -2758,7 +2758,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2758
2758
if (rc != 0 ) {
2759
2759
/* The image is placed in an unsuitable slot. */
2760
2760
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [slot ] = false;
2761
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2761
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2762
2762
continue ;
2763
2763
}
2764
2764
@@ -2767,7 +2767,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2767
2767
if (rc != 0 ) {
2768
2768
/* The selected image slot has been erased. */
2769
2769
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [slot ] = false;
2770
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2770
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2771
2771
continue ;
2772
2772
}
2773
2773
#endif /* MCUBOOT_DIRECT_XIP_REVERT */
@@ -2784,7 +2784,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2784
2784
/* Image cannot be ramloaded. */
2785
2785
boot_remove_image_from_flash (state , slot );
2786
2786
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [slot ] = false;
2787
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2787
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2788
2788
continue ;
2789
2789
}
2790
2790
#endif /* MCUBOOT_RAM_LOAD */
@@ -2796,12 +2796,12 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2796
2796
boot_remove_image_from_sram (state );
2797
2797
#endif /* MCUBOOT_RAM_LOAD */
2798
2798
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [slot ] = false;
2799
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2799
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2800
2800
continue ;
2801
2801
}
2802
2802
2803
2803
/* Valid image loaded from a slot, go to the next slot. */
2804
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2804
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2805
2805
}
2806
2806
}
2807
2807
@@ -2813,7 +2813,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2813
2813
while (true) {
2814
2814
/* Go over all the slots and try to load one */
2815
2815
active_slot = state -> slot_usage [BOOT_CURR_IMG (state )].active_slot ;
2816
- if (active_slot != NO_ACTIVE_SLOT ){
2816
+ if (active_slot != BOOT_SLOT_NONE ){
2817
2817
/* A slot is already active, go to next image. */
2818
2818
break ;
2819
2819
}
@@ -2824,7 +2824,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2824
2824
active_slot = find_slot_with_highest_version (state );
2825
2825
}
2826
2826
2827
- if (active_slot == NO_ACTIVE_SLOT ) {
2827
+ if (active_slot == BOOT_SLOT_NONE ) {
2828
2828
BOOT_LOG_INF ("No slot to load for image %d" ,
2829
2829
BOOT_CURR_IMG (state ));
2830
2830
FIH_RET (FIH_FAILURE );
@@ -2853,7 +2853,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2853
2853
fih_ret
2854
2854
boot_load_and_validate_images (struct boot_loader_state * state )
2855
2855
{
2856
- uint32_t active_slot ;
2856
+ enum boot_slot active_slot ;
2857
2857
int rc ;
2858
2858
fih_ret fih_rc ;
2859
2859
@@ -2865,7 +2865,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2865
2865
while (true) {
2866
2866
/* Go over all the slots and try to load one */
2867
2867
active_slot = state -> slot_usage [BOOT_CURR_IMG (state )].active_slot ;
2868
- if (active_slot != NO_ACTIVE_SLOT ){
2868
+ if (active_slot != BOOT_SLOT_NONE ){
2869
2869
/* A slot is already active, go to next image. */
2870
2870
break ;
2871
2871
}
@@ -2876,7 +2876,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2876
2876
active_slot = find_slot_with_highest_version (state );
2877
2877
}
2878
2878
2879
- if (active_slot == NO_ACTIVE_SLOT ) {
2879
+ if (active_slot == BOOT_SLOT_NONE ) {
2880
2880
BOOT_LOG_INF ("No slot to load for image %d" ,
2881
2881
BOOT_CURR_IMG (state ));
2882
2882
FIH_RET (FIH_FAILURE );
@@ -2896,7 +2896,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2896
2896
if (rc != 0 ) {
2897
2897
/* The image is placed in an unsuitable slot. */
2898
2898
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2899
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2899
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2900
2900
continue ;
2901
2901
}
2902
2902
#endif /* MCUBOOT_DIRECT_XIP */
@@ -2906,7 +2906,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2906
2906
if (rc != 0 ) {
2907
2907
/* The selected image slot has been erased. */
2908
2908
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2909
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2909
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2910
2910
continue ;
2911
2911
}
2912
2912
#endif /* MCUBOOT_DIRECT_XIP_REVERT || MCUBOOT_RAM_LOAD_REVERT */
@@ -2922,7 +2922,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2922
2922
/* Image cannot be ramloaded. */
2923
2923
boot_remove_image_from_flash (state , active_slot );
2924
2924
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2925
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2925
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2926
2926
continue ;
2927
2927
}
2928
2928
#endif /* MCUBOOT_RAM_LOAD */
@@ -2934,7 +2934,7 @@ boot_load_and_validate_images(struct boot_loader_state *state)
2934
2934
boot_remove_image_from_sram (state );
2935
2935
#endif /* MCUBOOT_RAM_LOAD */
2936
2936
state -> slot_usage [BOOT_CURR_IMG (state )].slot_available [active_slot ] = false;
2937
- state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2937
+ state -> slot_usage [BOOT_CURR_IMG (state )].active_slot = BOOT_SLOT_NONE ;
2938
2938
continue ;
2939
2939
}
2940
2940
0 commit comments