Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: firmware/lib/vboot_nvstorage.c

Issue 6596081: Add crossystem support for nvram_cleared and kern_nv (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Fix try B count mask Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « firmware/lib/vboot_firmware.c ('k') | host/lib/crossystem.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/vboot_nvstorage.c
diff --git a/firmware/lib/vboot_nvstorage.c b/firmware/lib/vboot_nvstorage.c
index d91580419b7bf5a6c329f6e327012675ede08e4a..419a9fbc1bfa485eabc6b8bf185c9f3492a41656 100644
--- a/firmware/lib/vboot_nvstorage.c
+++ b/firmware/lib/vboot_nvstorage.c
@@ -21,7 +21,7 @@
#define BOOT_OFFSET 1
#define BOOT_DEBUG_RESET_MODE 0x80
-#define BOOT_TRY_B_COUNT 0x0F
+#define BOOT_TRY_B_COUNT_MASK 0x0F
#define RECOVERY_OFFSET 2
#define LOCALIZATION_OFFSET 3
@@ -107,7 +107,7 @@ int VbNvGet(VbNvContext* context, VbNvParam param, uint32_t* dest) {
return 0;
case VBNV_TRY_B_COUNT:
- *dest = raw[BOOT_OFFSET] & BOOT_TRY_B_COUNT;
+ *dest = raw[BOOT_OFFSET] & BOOT_TRY_B_COUNT_MASK;
return 0;
case VBNV_RECOVERY_REQUEST:
@@ -172,10 +172,10 @@ int VbNvSet(VbNvContext* context, VbNvParam param, uint32_t value) {
case VBNV_TRY_B_COUNT:
/* Clip to valid range. */
- if (value > BOOT_TRY_B_COUNT)
- value = BOOT_TRY_B_COUNT - 1;
+ if (value > BOOT_TRY_B_COUNT_MASK)
+ value = BOOT_TRY_B_COUNT_MASK;
- raw[BOOT_OFFSET] &= ~BOOT_TRY_B_COUNT;
+ raw[BOOT_OFFSET] &= ~BOOT_TRY_B_COUNT_MASK;
raw[BOOT_OFFSET] |= (uint8_t)value;
break;
« no previous file with comments | « firmware/lib/vboot_firmware.c ('k') | host/lib/crossystem.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698