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

Unified Diff: host/arch/x86/lib/crossystem_arch.c

Issue 6825047: Add Mario support for fwupdate_tries (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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: host/arch/x86/lib/crossystem_arch.c
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index b8e6add597e9be5d70bc9cd1357c45a21dbff8ec..c3bd4df21260d8bc1ce5fa685d26a95c74ba0997 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -84,6 +84,9 @@
/* Filename for NVRAM file */
#define NVRAM_PATH "/dev/nvram"
+/* Filename for legace firmware update tries */
Stefan Reinauer 2011/04/11 20:32:55 typo: legacy
+#define NEED_FWUPDATE_PATH "/mnt/stateful_partition/.need_firmware_update"
+
int VbReadNvStorage(VbNvContext* vnc) {
FILE* f;
@@ -522,6 +525,19 @@ int VbGetArchPropertyInt(const char* name) {
if (-1 == value)
value = VbGetCmosRebootField(CMOSRF_TRY_B);
}
+ /* Firmwate update tries is now stored in the kernel field. On
Stefan Reinauer 2011/04/11 20:32:55 Typo: Firmware
+ * older systems where it's not, it was stored in a file in the
+ * stateful partition. */
+ else if (!strcasecmp(name,"fwupdate_tries")) {
+ if (-1 != VbGetNvStorage(VBNV_KERNEL_FIELD))
+ return -1; /* NvStorage supported; fail through arch-specific
+ * implementation to normal implementation. */
+
+ /* Read value from file; missing file means value=0. */
+ value = ReadFileInt(NEED_FWUPDATE_PATH);
+ if (-1 == value)
+ value = 0;
+ }
return value;
}
@@ -581,6 +597,24 @@ int VbSetArchPropertyInt(const char* name, int value) {
return 0;
return VbSetCmosRebootField(CMOSRF_TRY_B, value);
}
+ /* Firmwate update tries is now stored in the kernel field. On
Stefan Reinauer 2011/04/11 20:32:55 ditto
+ * older systems where it's not, it was stored in a file in the
+ * stateful partition. */
+ else if (!strcasecmp(name,"fwupdate_tries")) {
+ if (-1 != VbGetNvStorage(VBNV_KERNEL_FIELD))
+ return -1; /* NvStorage supported; fail through arch-specific
+ * implementation to normal implementation */
+
+ if (value) {
+ char buf[32];
+ snprintf(buf, sizeof(buf), "%d", value);
+ return WriteFile(NEED_FWUPDATE_PATH, buf, sizeof(buf));
Stefan Reinauer 2011/04/11 20:32:55 strlen()
+ } else {
+ /* No update tries, so remove file if it exists. */
+ unlink(NEED_FWUPDATE_PATH);
+ return 0;
+ }
+ }
return -1;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698