mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
vboot2: Add try RO software sync flag
This flag will be used by the firmware updater to indicate that RO software sync should be attempted. BUG=chrome-os-partner:48703 BRANCH=None TEST=make runtests Change-Id: I42090ac47da45c724e66334648ab447ad3c21178 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/320621 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -169,6 +169,9 @@ uint32_t vb2_nv_get(struct vb2_context *ctx, enum vb2_nv_param param)
|
||||
|
||||
case VB2_NV_BOOT_ON_AC_DETECT:
|
||||
return GETBIT(VB2_NV_OFFS_MISC, VB2_NV_MISC_BOOT_ON_AC_DETECT);
|
||||
|
||||
case VB2_NV_TRY_RO_SYNC:
|
||||
return GETBIT(VB2_NV_OFFS_MISC, VB2_NV_MISC_TRY_RO_SYNC);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -343,6 +346,10 @@ void vb2_nv_set(struct vb2_context *ctx,
|
||||
SETBIT(VB2_NV_OFFS_MISC, VB2_NV_MISC_BOOT_ON_AC_DETECT);
|
||||
break;
|
||||
|
||||
case VB2_NV_TRY_RO_SYNC:
|
||||
SETBIT(VB2_NV_OFFS_MISC, VB2_NV_MISC_TRY_RO_SYNC);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -94,6 +94,8 @@ enum vb2_nv_param {
|
||||
VB2_NV_FASTBOOT_UNLOCK_IN_FW,
|
||||
/* Boot system when AC detected (0=no, 1=yes). */
|
||||
VB2_NV_BOOT_ON_AC_DETECT,
|
||||
/* Try to update the EC-RO image after updating the EC-RW image(0=no, 1=yes). */
|
||||
VB2_NV_TRY_RO_SYNC,
|
||||
};
|
||||
|
||||
/* Set default boot in developer mode */
|
||||
|
||||
@@ -70,8 +70,9 @@ enum vb2_nv_offset {
|
||||
#define VB2_NV_TPM_CLEAR_OWNER_DONE 0x02
|
||||
#define VB2_NV_TPM_REBOOTED 0x04
|
||||
|
||||
/* Fields in VB2_NV_OFFS_MISC (unused = 0xfc) */
|
||||
/* Fields in VB2_NV_OFFS_MISC (unused = 0xf8) */
|
||||
#define VB2_NV_MISC_UNLOCK_FASTBOOT 0x01
|
||||
#define VB2_NV_MISC_BOOT_ON_AC_DETECT 0x02
|
||||
#define VB2_NV_MISC_TRY_RO_SYNC 0x04
|
||||
|
||||
#endif /* VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_ */
|
||||
|
||||
@@ -118,6 +118,8 @@ typedef enum VbNvParam {
|
||||
VBNV_FASTBOOT_UNLOCK_IN_FW,
|
||||
/* Boot system when AC detected (0=no, 1=yes). */
|
||||
VBNV_BOOT_ON_AC_DETECT,
|
||||
/* Try to update the EC-RO image (0=no, 1=yes). */
|
||||
VBNV_TRY_RO_SYNC,
|
||||
|
||||
} VbNvParam;
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#define MISC_OFFSET 8
|
||||
#define MISC_UNLOCK_FASTBOOT 0x01
|
||||
#define MISC_BOOT_ON_AC_DETECT 0x02
|
||||
#define MISC_TRY_RO_SYNC 0x04
|
||||
|
||||
#define KERNEL_FIELD_OFFSET 11
|
||||
#define CRC_OFFSET 15
|
||||
@@ -226,6 +227,10 @@ int VbNvGet(VbNvContext *context, VbNvParam param, uint32_t *dest)
|
||||
*dest = (raw[MISC_OFFSET] & MISC_BOOT_ON_AC_DETECT) ? 1 : 0;
|
||||
return 0;
|
||||
|
||||
case VBNV_TRY_RO_SYNC:
|
||||
*dest = (raw[MISC_OFFSET] & MISC_TRY_RO_SYNC) ? 1 : 0;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
@@ -444,6 +449,13 @@ int VbNvSet(VbNvContext *context, VbNvParam param, uint32_t value)
|
||||
raw[MISC_OFFSET] &= ~MISC_BOOT_ON_AC_DETECT;
|
||||
break;
|
||||
|
||||
case VBNV_TRY_RO_SYNC:
|
||||
if (value)
|
||||
raw[MISC_OFFSET] |= MISC_TRY_RO_SYNC;
|
||||
else
|
||||
raw[MISC_OFFSET] &= ~MISC_TRY_RO_SYNC;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -540,6 +540,8 @@ int VbGetSystemPropertyInt(const char* name) {
|
||||
value = VbGetNvStorage(VBNV_FASTBOOT_UNLOCK_IN_FW);
|
||||
} else if (!strcasecmp(name, "boot_on_ac_detect")) {
|
||||
value = VbGetNvStorage(VBNV_BOOT_ON_AC_DETECT);
|
||||
} else if (!strcasecmp(name, "try_ro_sync")) {
|
||||
value = VbGetNvStorage(VBNV_TRY_RO_SYNC);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -674,6 +676,8 @@ int VbSetSystemPropertyInt(const char* name, int value) {
|
||||
return VbSetNvStorage_WithBackup(VBNV_FASTBOOT_UNLOCK_IN_FW, value);
|
||||
} else if (!strcasecmp(name, "boot_on_ac_detect")) {
|
||||
return VbSetNvStorage_WithBackup(VBNV_BOOT_ON_AC_DETECT, value);
|
||||
} else if (!strcasecmp(name, "try_ro_sync")) {
|
||||
return VbSetNvStorage_WithBackup(VBNV_TRY_RO_SYNC, value);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -53,6 +53,7 @@ static struct nv_field nvfields[] = {
|
||||
{VB2_NV_BACKUP_NVRAM_REQUEST, 0, 1, 0, "backup nvram request"},
|
||||
{VB2_NV_FASTBOOT_UNLOCK_IN_FW, 0, 1, 0, "fastboot unlock in fw"},
|
||||
{VB2_NV_BOOT_ON_AC_DETECT, 0, 1, 0, "boot on ac detect"},
|
||||
{VB2_NV_TRY_RO_SYNC, 0, 1, 0, "try read only software sync"},
|
||||
{0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ static VbNvField nvfields[] = {
|
||||
{VBNV_FW_PREV_RESULT, VBNV_FW_RESULT_UNKNOWN, 1, 3, "firmware prev result"},
|
||||
{VBNV_FASTBOOT_UNLOCK_IN_FW, 0, 1, 0, "fastboot unlock in firmware"},
|
||||
{VBNV_BOOT_ON_AC_DETECT, 0, 1, 0, "boot on ac detect"},
|
||||
{VBNV_TRY_RO_SYNC, 0, 1, 0, "try read only software sync"},
|
||||
{0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ const Param sys_param_list[] = {
|
||||
{"tpm_fwver", 0, "Firmware version stored in TPM", "0x%08x"},
|
||||
{"tpm_kernver", 0, "Kernel version stored in TPM", "0x%08x"},
|
||||
{"tpm_rebooted", 0, "TPM requesting repeated reboot (vboot2)"},
|
||||
{"try_ro_sync", 0, "try read only software sync"},
|
||||
{"tried_fwb", 0, "Tried firmware B before A this boot"},
|
||||
{"vdat_flags", 0, "Flags from VbSharedData", "0x%08x"},
|
||||
{"vdat_lfdebug", IS_STRING|NO_PRINT_ALL,
|
||||
|
||||
Reference in New Issue
Block a user