Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aboot: Fix A/B slot success logic #58

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/aboot/lk2nd-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ static void lk2nd_handle_multislot(void)

if (strcmp(lk2nd_dev.slot_suffix, "_a") == 0) {
dprintf(INFO, "Marking Slot A as successful.\n");
partition_reset_retry_count(SLOT_A);
partition_set_successful(SLOT_A);
} else if (strcmp(lk2nd_dev.slot_suffix, "_b") == 0) {
dprintf(INFO, "Marking Slot B as successful.\n");
partition_reset_retry_count(SLOT_B);
partition_set_successful(SLOT_B);
} else {
dprintf(CRITICAL, "ERROR: Couldn't determine slot suffix of %s\n", lk2nd_dev.slot_suffix);
}
Expand Down
12 changes: 8 additions & 4 deletions platform/msm_shared/ab_partition_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,19 @@ partition_activate_slot(int slot)
return;
}

void partition_reset_retry_count(int slot)
void partition_set_successful(int slot)
{
struct partition_entry *partition_entries =
partition_get_partition_entries();
int slt_index = boot_slot_index[slot];

/* Set Max retry count and priority value */
partition_entries[slt_index].attribute_flag |= (PART_ATT_PRIORITY_VAL |
PART_ATT_MAX_RETRY_COUNT_VAL);
/* Set Success bit */
SET_BIT(partition_entries[slt_index].attribute_flag, PART_ATT_SUCCESS_BIT);

attributes_updated = true;

/* Make attributes persistant */
partition_mark_active_slot(active_slot);

return;
}
Expand Down
2 changes: 1 addition & 1 deletion platform/msm_shared/include/ab_partition_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void partition_fill_slot_meta(); /* Fill slot meta infomation */
void partition_switch_slots(); /* Switching slots */
void partition_deactivate_slot(int slot); /* Mark slot unbootable and reset other attributes*/
void partition_activate_slot(int slot); /* Mark slot bootable and set other attributes*/
void partition_reset_retry_count(int slot); /* Reset retry count of slot */
void partition_set_successful(int slot); /* Mark slot successful */
int partition_find_boot_slot(); /* Find bootable partition */
int partition_find_active_slot(); /* Find current active partition*/
int partition_fill_partition_meta(); /* Fill partition slot info meta*/
Expand Down