summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2015-05-25 21:48:02 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-29 11:29:26 +0000
commitd08a3435f867700c90e33398bf104557d98bf791 (patch)
tree51ea35318cd6b29399930ee97beb05af0a0e53af /firmware
parentc180460febf4039c86b87ba708c8299749cbfdd6 (diff)
downloadvboot-d08a3435f867700c90e33398bf104557d98bf791.tar.gz
fastboot: Add fastboot related flags to vb2
BUG=chrome-os-partner:40196 BRANCH=None TEST=Compiles successfully. Change-Id: I4305436b2ae46254e4e8b12039ffed95634d62c2 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/273181 Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/2lib/2misc.c2
-rw-r--r--firmware/2lib/2nvstorage.c17
-rw-r--r--firmware/2lib/include/2nvstorage.h8
-rw-r--r--firmware/2lib/include/2nvstorage_fields.h9
4 files changed, 34 insertions, 2 deletions
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c
index 360365d8..5805093b 100644
--- a/firmware/2lib/2misc.c
+++ b/firmware/2lib/2misc.c
@@ -263,6 +263,8 @@ int vb2_check_dev_switch(struct vb2_context *ctx)
vb2_nv_set(ctx, VB2_NV_DEV_BOOT_USB, 0);
vb2_nv_set(ctx, VB2_NV_DEV_BOOT_LEGACY, 0);
vb2_nv_set(ctx, VB2_NV_DEV_BOOT_SIGNED_ONLY, 0);
+ vb2_nv_set(ctx, VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP, 0);
+ vb2_nv_set(ctx, VB2_NV_FASTBOOT_UNLOCK_IN_FW, 0);
}
if (ctx->flags & VB2_CONTEXT_FORCE_WIPEOUT_MODE)
diff --git a/firmware/2lib/2nvstorage.c b/firmware/2lib/2nvstorage.c
index 4d3c8bad..35cf6fcc 100644
--- a/firmware/2lib/2nvstorage.c
+++ b/firmware/2lib/2nvstorage.c
@@ -135,6 +135,10 @@ uint32_t vb2_nv_get(struct vb2_context *ctx, enum vb2_nv_param param)
case VB2_NV_DEV_BOOT_SIGNED_ONLY:
return GETBIT(VB2_NV_OFFS_DEV, VB2_NV_DEV_FLAG_SIGNED_ONLY);
+ case VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP:
+ return GETBIT(VB2_NV_OFFS_DEV,
+ VB2_NV_DEV_FLAG_FASTBOOT_FULL_CAP);
+
case VB2_NV_DISABLE_DEV_REQUEST:
return GETBIT(VB2_NV_OFFS_BOOT, VB2_NV_BOOT_DISABLE_DEV);
@@ -152,6 +156,10 @@ uint32_t vb2_nv_get(struct vb2_context *ctx, enum vb2_nv_param param)
case VB2_NV_REQ_WIPEOUT:
return GETBIT(VB2_NV_OFFS_HEADER , VB2_NV_HEADER_WIPEOUT);
+
+ case VB2_NV_FASTBOOT_UNLOCK_IN_FW:
+ return GETBIT(VB2_NV_OFFS_FASTBOOT,
+ VB2_NV_FASTBOOT_FLAG_UNLOCK_IN_FW);
}
/*
@@ -275,6 +283,10 @@ void vb2_nv_set(struct vb2_context *ctx,
SETBIT(VB2_NV_OFFS_DEV, VB2_NV_DEV_FLAG_SIGNED_ONLY);
break;
+ case VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP:
+ SETBIT(VB2_NV_OFFS_DEV, VB2_NV_DEV_FLAG_FASTBOOT_FULL_CAP);
+ break;
+
case VB2_NV_DISABLE_DEV_REQUEST:
SETBIT(VB2_NV_OFFS_BOOT, VB2_NV_BOOT_DISABLE_DEV);
break;
@@ -298,6 +310,11 @@ void vb2_nv_set(struct vb2_context *ctx,
case VB2_NV_REQ_WIPEOUT:
SETBIT(VB2_NV_OFFS_HEADER , VB2_NV_HEADER_WIPEOUT);
break;
+
+ case VB2_NV_FASTBOOT_UNLOCK_IN_FW:
+ SETBIT(VB2_NV_OFFS_FASTBOOT, VB2_NV_FASTBOOT_FLAG_UNLOCK_IN_FW);
+ break;
+
}
/*
diff --git a/firmware/2lib/include/2nvstorage.h b/firmware/2lib/include/2nvstorage.h
index 3b3f34c8..9ade3e78 100644
--- a/firmware/2lib/include/2nvstorage.h
+++ b/firmware/2lib/include/2nvstorage.h
@@ -51,6 +51,11 @@ enum vb2_nv_param {
/* Only boot Google-signed images in developer mode. 0=no, 1=yes. */
VB2_NV_DEV_BOOT_SIGNED_ONLY,
/*
+ * Allow full fastboot capability in firmware in developer mode.
+ * 0=no, 1=yes.
+ */
+ VB2_NV_DEV_BOOT_FASTBOOT_FULL_CAP,
+ /*
* Set by userspace to request that RO firmware disable dev-mode on the
* next boot. This is likely only possible if the dev-switch is
* virtual.
@@ -80,6 +85,9 @@ enum vb2_nv_param {
VB2_NV_FW_PREV_RESULT,
/* Request wipeout of the device by the app. */
VB2_NV_REQ_WIPEOUT,
+
+ /* Fastboot: Unlock in firmware, 0=disabled, 1=enabled. */
+ VB2_NV_FASTBOOT_UNLOCK_IN_FW,
};
/* Firmware result codes for VB2_NV_FW_RESULT and VB2_NV_FW_PREV_RESULT */
diff --git a/firmware/2lib/include/2nvstorage_fields.h b/firmware/2lib/include/2nvstorage_fields.h
index 1c4fdf41..0a6c5385 100644
--- a/firmware/2lib/include/2nvstorage_fields.h
+++ b/firmware/2lib/include/2nvstorage_fields.h
@@ -28,7 +28,8 @@ enum vb2_nv_offset {
VB2_NV_OFFS_TPM = 5,
VB2_NV_OFFS_RECOVERY_SUBCODE = 6,
VB2_NV_OFFS_BOOT2 = 7,
- /* Offsets 8-10 are currently unused */
+ VB2_NV_OFFS_FASTBOOT = 8,
+ /* Offsets 9-10 are currently unused */
VB2_NV_OFFS_KERNEL = 11, /* 11-14; field is 32 bits */
/* CRC must be last field */
VB2_NV_OFFS_CRC = 15
@@ -56,13 +57,17 @@ enum vb2_nv_offset {
#define VB2_NV_BOOT2_PREV_RESULT_SHIFT 4 /* Number of bits to shift result */
#define VB2_NV_BOOT2_PREV_TRIED 0x40
-/* Fields in VB2_NV_OFFS_DEV (unused = 0xf8) */
+/* Fields in VB2_NV_OFFS_DEV (unused = 0xf0) */
#define VB2_NV_DEV_FLAG_USB 0x01
#define VB2_NV_DEV_FLAG_SIGNED_ONLY 0x02
#define VB2_NV_DEV_FLAG_LEGACY 0x04
+#define VB2_NV_DEV_FLAG_FASTBOOT_FULL_CAP 0x08
/* Fields in VB2_NV_OFFS_TPM (unused = 0xfc) */
#define VB2_NV_TPM_CLEAR_OWNER_REQUEST 0x01
#define VB2_NV_TPM_CLEAR_OWNER_DONE 0x02
+/* Fields in VB2_NV_OFFS_FASTBOOT (unused = 0xfe) */
+#define VB2_NV_FASTBOOT_FLAG_UNLOCK_IN_FW 0x01
+
#endif /* VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_ */