Merge "platform: msm_shared: Do not reset success bit for alternate slot"
diff --git a/platform/msm_shared/ab_partition_parser.c b/platform/msm_shared/ab_partition_parser.c
index 7cee1a8..53a671c 100644
--- a/platform/msm_shared/ab_partition_parser.c
+++ b/platform/msm_shared/ab_partition_parser.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -236,7 +236,7 @@
/*
Function: Switch active partitions.
*/
-void partition_switch_slots(int old_slot, int new_slot)
+void partition_switch_slots(int old_slot, int new_slot, boolean reset_success_bit)
{
#ifdef AB_DEBUG
dprintf(INFO, "Switching slots %s to %s\n",
@@ -255,9 +255,15 @@
((PART_ATT_PRIORITY_VAL |
PART_ATT_ACTIVE_VAL |
PART_ATT_MAX_RETRY_COUNT_VAL));
+
partition_entries[new_slot_index].attribute_flag &=
- (~PART_ATT_SUCCESSFUL_VAL
- & ~PART_ATT_UNBOOTABLE_VAL);
+ (~PART_ATT_UNBOOTABLE_VAL);
+ if (reset_success_bit &&
+ (partition_entries[new_slot_index].attribute_flag &
+ PART_ATT_SUCCESSFUL_VAL)) {
+ partition_entries[new_slot_index].attribute_flag &=
+ (~PART_ATT_SUCCESSFUL_VAL);
+ }
if (!attributes_updated)
attributes_updated = true;
@@ -395,7 +401,7 @@
next_slot = next_active_bootable_slot(partition_entries);
if (next_slot != INVALID)
{
- partition_switch_slots(boot_slot, next_slot);
+ partition_switch_slots(boot_slot, next_slot, false);
reboot_device(0);
}
else
diff --git a/platform/msm_shared/include/ab_partition_parser.h b/platform/msm_shared/include/ab_partition_parser.h
index 607a412..2001b7f 100644
--- a/platform/msm_shared/include/ab_partition_parser.h
+++ b/platform/msm_shared/include/ab_partition_parser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -69,7 +69,7 @@
void partition_mark_active_slot(); /* Marking slot active */
void partition_reset_attributes(); /* Resetting slot attr. */
void partition_fill_slot_meta(); /* Fill slot meta infomation */
-void partition_switch_slots(); /* Switching slots */
+void partition_switch_slots(int old_slot, int new_slot, boolean reset_success_bit); /* 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*/
int partition_find_boot_slot(); /* Find bootable partition */