summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2020-02-25 11:11:52 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-26 11:05:48 +0000
commit91300814d66aaa78f9b85295957d0a28dad7c4c7 (patch)
treeb86a7f660be9df6a05d71b1674ae3e4d0d8eb035
parent3354deef704a272e7c0e0a68173313dbd0e0ab67 (diff)
downloadvboot-91300814d66aaa78f9b85295957d0a28dad7c4c7.tar.gz
crossystem: use wpsw_boot as fallback for wpsw_cur
In preparation for deprecating wpsw_boot, update wpsw_cur to use wpsw_boot as a fallback value. The source of wpsw_boot will still be deprecated on devices using new firmware, but in those cases, we are absolutely certain that wpsw_cur will work. BUG=b:124141368, chromium:950723 TEST=make clean && make runtests BRANCH=none Change-Id: I77ab9c6b827ef2c033ae46b7b01b12465101c0a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2071633 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
-rw-r--r--host/arch/x86/lib/crossystem_arch.c3
-rw-r--r--host/lib/crossystem.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index 2fd2f530..1e51cb0b 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -803,6 +803,9 @@ int VbGetArchPropertyInt(const char* name)
value = ReadGpio(GPIO_SIGNAL_TYPE_RECOVERY);
} else if (!strcasecmp(name,"wpsw_cur")) {
value = ReadGpio(GPIO_SIGNAL_TYPE_WP);
+ /* Use "write-protect at boot" as a fallback value. */
+ if (-1 == value)
+ value = ReadFileBit(ACPI_CHSW_PATH, CHSW_WP_BOOT);
if (-1 != value && FwidStartsWith("Mario."))
value = 1 - value; /* Mario reports this backwards */
} else if (!strcasecmp(name,"recoverysw_ec_boot")) {
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 33cf332f..50de4cb0 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -428,6 +428,9 @@ int VbGetSystemPropertyInt(const char *name)
value = GetVdatInt(VDAT_INT_DEVSW_BOOT);
} else if (!strcasecmp(name, "recoverysw_boot")) {
value = GetVdatInt(VDAT_INT_RECSW_BOOT);
+ } else if (!strcasecmp(name, "wpsw_cur")) {
+ /* Use "write-protect at boot" as a fallback value. */
+ value = GetVdatInt(VDAT_INT_HW_WPSW_BOOT);
} else if (!strcasecmp(name, "wpsw_boot")) {
value = GetVdatInt(VDAT_INT_HW_WPSW_BOOT);
} else if (!strcasecmp(name,"vdat_flags")) {