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

Unified Diff: host/lib/crossystem.c

Issue 6813056: Add crossystem fwupdate_tries and fix nv storage writes (Closed) Base URL: ssh://gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 8 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 | « no previous file | utility/crossystem_main.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: host/lib/crossystem.c
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 2e29d04dd1a229d7b9dfa1c020c272ffd817565f..1c3fcc256a115827a375fa1bb1ccbcb368e9628e 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -41,6 +41,10 @@ typedef enum VdatIntField {
} VdatIntField;
+/* Masks for kern_nv usage by kernel */
+#define KERN_NV_FWUPDATE_TRIES_MASK 0x0000000F
+
+
/* Return true if the FWID starts with the specified string. */
int FwidStartsWith(const char *start) {
char fwid[128];
@@ -93,7 +97,7 @@ int VbSetNvStorage(VbNvParam param, int value) {
goto VbSetNvCleanup;
if (vnc.raw_changed) {
- if (0 != VbReadNvStorage(&vnc))
+ if (0 != VbWriteNvStorage(&vnc))
goto VbSetNvCleanup;
}
@@ -351,6 +355,10 @@ int VbGetSystemPropertyInt(const char* name) {
value = VbGetNvStorage(VBNV_DEBUG_RESET_MODE);
} else if (!strcasecmp(name,"fwb_tries")) {
value = VbGetNvStorage(VBNV_TRY_B_COUNT);
+ } else if (!strcasecmp(name,"fwupdate_tries")) {
+ value = VbGetNvStorage(VBNV_KERNEL_FIELD);
+ if (value != -1)
+ value &= KERN_NV_FWUPDATE_TRIES_MASK;
}
/* Other parameters */
else if (!strcasecmp(name,"cros_debug")) {
@@ -397,6 +405,7 @@ const char* VbGetSystemPropertyString(const char* name, char* dest, int size) {
int VbSetSystemPropertyInt(const char* name, int value) {
/* Check architecture-dependent properties first */
+
if (0 == VbSetArchPropertyInt(name, value))
return 0;
@@ -416,6 +425,13 @@ int VbSetSystemPropertyInt(const char* name, int value) {
return VbSetNvStorage(VBNV_DEBUG_RESET_MODE, value);
} else if (!strcasecmp(name,"fwb_tries")) {
return VbSetNvStorage(VBNV_TRY_B_COUNT, value);
+ } else if (!strcasecmp(name,"fwupdate_tries")) {
+ int kern_nv = VbGetNvStorage(VBNV_KERNEL_FIELD);
+ if (kern_nv == -1)
+ return -1;
+ kern_nv &= ~KERN_NV_FWUPDATE_TRIES_MASK;
+ kern_nv |= (value & KERN_NV_FWUPDATE_TRIES_MASK);
+ return VbSetNvStorage(VBNV_KERNEL_FIELD, kern_nv);
}
return -1;
« no previous file with comments | « no previous file | utility/crossystem_main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698