summaryrefslogtreecommitdiff
path: root/firmware/2lib/2nvstorage.c
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@google.com>2015-10-06 10:42:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-13 14:02:26 -0700
commit12a55f255aaea2f12362e4f832a0bd48eb29f5dd (patch)
treef235ebf2cd846c852371a96cf76e3282ff0c26be /firmware/2lib/2nvstorage.c
parent73a6372d22f74d0396253f6e5080442edec55d7f (diff)
downloadvboot-12a55f255aaea2f12362e4f832a0bd48eb29f5dd.tar.gz
Add NV flag to default boot legacy OS
In developer mode, this option will make the system try to boot into a legacy OS first after the 30 second timeout. This removes the need to press a key during boot to try legacy mode and the need to remove the write protect screw to boot legacy as default. BUG=chromium:310697 BRANCH=none TEST=make runtests Change-Id: I9a9f64c14ad015e21d08eec36e8fc187189cd2f2 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/304077 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware/2lib/2nvstorage.c')
-rw-r--r--firmware/2lib/2nvstorage.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/2lib/2nvstorage.c b/firmware/2lib/2nvstorage.c
index 55f1d0dd..851c3872 100644
--- a/firmware/2lib/2nvstorage.c
+++ b/firmware/2lib/2nvstorage.c
@@ -139,6 +139,10 @@ uint32_t vb2_nv_get(struct vb2_context *ctx, enum vb2_nv_param param)
return GETBIT(VB2_NV_OFFS_DEV,
VB2_NV_DEV_FLAG_FASTBOOT_FULL_CAP);
+ case VB2_NV_DEV_DEFAULT_BOOT:
+ return (p[VB2_NV_OFFS_DEV] & VB2_NV_DEV_FLAG_DEFAULT_BOOT)
+ >> VB2_NV_DEV_DEFAULT_BOOT_SHIFT;
+
case VB2_NV_DISABLE_DEV_REQUEST:
return GETBIT(VB2_NV_OFFS_BOOT, VB2_NV_BOOT_DISABLE_DEV);
@@ -292,6 +296,17 @@ void vb2_nv_set(struct vb2_context *ctx,
SETBIT(VB2_NV_OFFS_DEV, VB2_NV_DEV_FLAG_FASTBOOT_FULL_CAP);
break;
+ case VB2_NV_DEV_DEFAULT_BOOT:
+ /* Map out of range values to disk */
+ if (value > (VB2_NV_DEV_FLAG_DEFAULT_BOOT >>
+ VB2_NV_DEV_DEFAULT_BOOT_SHIFT))
+ value = VB2_DEV_DEFAULT_BOOT_DISK;
+
+ p[VB2_NV_OFFS_DEV] &= ~VB2_NV_DEV_FLAG_DEFAULT_BOOT;
+ p[VB2_NV_OFFS_DEV] |=
+ (uint8_t)(value << VB2_NV_DEV_DEFAULT_BOOT_SHIFT);
+ break;
+
case VB2_NV_DISABLE_DEV_REQUEST:
SETBIT(VB2_NV_OFFS_BOOT, VB2_NV_BOOT_DISABLE_DEV);
break;