Add crossystem support for nvram_cleared and kern_nv
Fix try_b processing
And move key block flags check up in LoadFirmware(), which speeds up
boot when the dev switch is off because it doesn't do a signature
check and then throw it out.
BUG=12282
TEST=build firmware, try by hand
Review URL: http://codereview.chromium.org/6596081
Change-Id: I10474e9e0ae324906dfe02a351347d04ce847f67
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 8e482d3..5951e10 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -489,6 +489,8 @@
value = VbGetNvStorage(VBNV_TRIED_FIRMWARE_B);
} else if (!strcasecmp(name,"kern_nv")) {
value = VbGetNvStorage(VBNV_KERNEL_FIELD);
+ } else if (!strcasecmp(name,"nvram_cleared")) {
+ value = VbGetNvStorage(VBNV_KERNEL_SETTINGS_RESET);
}
/* NV storage values. If unable to get from NV storage, fall back to the
* CMOS reboot field used by older BIOS. */
@@ -512,10 +514,6 @@
value = ReadFileInt(ACPI_FMAP_PATH);
}
- /* TODO: implement the following properties:
- * nvram_cleared
- */
-
return value;
}
@@ -574,7 +572,10 @@
int VbSetSystemPropertyInt(const char* name, int value) {
/* NV storage values with no defaults for older BIOS. */
- if (!strcasecmp(name,"kern_nv")) {
+ if (!strcasecmp(name,"nvram_cleared")) {
+ /* Can only clear this flag; it's set inside the NV storage library. */
+ return VbSetNvStorage(VBNV_KERNEL_SETTINGS_RESET, 0);
+ } else if (!strcasecmp(name,"kern_nv")) {
return VbSetNvStorage(VBNV_KERNEL_FIELD, value);
}
/* NV storage values. If unable to get from NV storage, fall back to the
@@ -593,10 +594,6 @@
return VbSetCmosRebootField(CMOSRF_TRY_B, value);
}
- /* TODO: implement the following:
- * nvram_cleared
- */
-
return -1;
}