diff options
author | Randall Spangler <rspangler@chromium.org> | 2017-10-20 12:38:40 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-17 20:18:19 -0800 |
commit | 4aaaeca130a701a06cb898d9a17eddf67daa3617 (patch) | |
tree | 1f656152480b06b1c62589282249058d58702f88 /host | |
parent | 6014de9844835472b821d8ca61909a0ed6930dfe (diff) | |
download | vboot-4aaaeca130a701a06cb898d9a17eddf67daa3617.tar.gz |
nvstorage: Add kernel max rollforward NV storage field
This just adds the kernel_max_rollforward field to the nvstorage
libraries and crossystem. The firmware does not use it yet; that's
coming in a subsequent CL.
16 of the fields's 32 bits are taken from unused bytes of the kernel
field. This has no effect on existing usage.
BUG=chromium:783997
BRANCH=none
TEST=make runtests
Also manual testing. In a root shell:
crossystem kernel_max_rollforward --> Should default to 0
crossystem kernel_max_rollforward=0xfffffffe
crossystem kernel_max_rollforward --> Should be 0xfffffffe
(Note that setting it to 0xffffffff is indistinguishable from the
-1 value that the crossystem library uses to indicate error, so
0xffffffff isn't actually usable as a max rollforward limit. But
0xfffffffe is, and if we ever get so close to the limit that we
need to use 0xffffffff, something has already gone horribly wrong
with our versioning strategy...)
Change-Id: I008f412e6ed3c0b59beb9881268585af69d1ff2e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/765572
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/crossystem.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c index 16ba2116..216ff32c 100644 --- a/host/lib/crossystem.c +++ b/host/lib/crossystem.c @@ -72,14 +72,14 @@ static const char *fw_results[] = {"unknown", "trying", "success", "failure"}; static const char *default_boot[] = {"disk", "usb", "legacy"}; /* Masks for kern_nv usage by kernel. */ -#define KERN_NV_FWUPDATE_TRIES_MASK 0x0000000F -#define KERN_NV_BLOCK_DEVMODE_FLAG 0x00000010 -#define KERN_NV_TPM_ATTACK_FLAG 0x00000020 +#define KERN_NV_FWUPDATE_TRIES_MASK 0x000F +#define KERN_NV_BLOCK_DEVMODE_FLAG 0x0010 +#define KERN_NV_TPM_ATTACK_FLAG 0x0020 /* If you want to use the remaining currently-unused bits in kern_nv * for something kernel-y, define a new field (the way we did for * fwupdate_tries). Don't just modify kern_nv directly, because that * makes it too easy to accidentally corrupt other sub-fields. */ -#define KERN_NV_CURRENTLY_UNUSED 0xFFFFFFC0 +#define KERN_NV_CURRENTLY_UNUSED 0xFFC0 /* Return true if the FWID starts with the specified string. */ int FwidStartsWith(const char *start) @@ -523,6 +523,8 @@ int VbGetSystemPropertyInt(const char *name) value = VbGetNvStorage(VBNV_RECOVERY_SUBCODE); } else if (!strcasecmp(name,"wipeout_request")) { value = VbGetNvStorage(VBNV_FW_REQ_WIPEOUT); + } else if (!strcasecmp(name,"kernel_max_rollforward")) { + value = VbGetNvStorage(VBNV_KERNEL_MAX_ROLLFORWARD); } /* Other parameters */ else if (!strcasecmp(name,"cros_debug")) { @@ -716,6 +718,8 @@ int VbSetSystemPropertyInt(const char *name, int value) return VbSetNvStorage_WithBackup(VBNV_TRY_RO_SYNC, value); } else if (!strcasecmp(name, "battery_cutoff_request")) { return VbSetNvStorage(VBNV_BATTERY_CUTOFF_REQUEST, value); + } else if (!strcasecmp(name,"kernel_max_rollforward")) { + return VbSetNvStorage(VBNV_KERNEL_MAX_ROLLFORWARD, value); } return -1; |