summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-10-03 12:16:06 -0700
committerJay Kim <yongjaek@chromium.org>2012-10-08 23:54:46 -0700
commit6619d9edab173ec980c079c888d24f5684271890 (patch)
tree115397a1fd7e4c96c14fc80232232d54b20c561f
parent40d8651bb36048c9b5f07be97ff17b2cf503015e (diff)
downloadvboot-stabilize-daisy.tar.gz
(release-R23)crossystem devsw_cur returns devsw_boot if virtual dev switchstabilize-linkstabilize-daisystabilize
devsw_cur is really a meaningless concept on systems with virtual dev switches; it exists primarily to support factory test of physical developer switches. However, some plugins use this instead of the preferred devsw_boot, and it's easier to modify crossystem than the plugins at this point in time. BUG=chrome-os-partner:12928 BRANCH=none (affects all current products, but is an OS-level change, not FW) TEST=manual - On link, 'crossystem devsw_cur devsw_boot' with dev switch on -> '1 1' - On link, 'crossystem devsw_cur devsw_boot' with dev switch off -> '0 0' - On lumpy or earlier, 'crossystem devsw_cur' should return current dev switch position; check this by toggling the physical switch without rebooting and see that the reported value follows the switch value. Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/34531 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> (cherry picked from commit 09a8447862c7d111d6abdd7891508df1a8f1cc5b) Change-Id: I6d07d905b250d762553d44d8b441f04b9ad25bc5 Reviewed-on: https://gerrit.chromium.org/gerrit/34967 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Jay Kim <yongjaek@chromium.org>
-rw-r--r--host/arch/arm/lib/crossystem_arch.c14
-rw-r--r--host/arch/x86/lib/crossystem_arch.c7
2 files changed, 16 insertions, 5 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index 7120afe4..9025c8b8 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -19,6 +19,7 @@
#include "vboot_common.h"
#include "vboot_nvstorage.h"
#include "host_common.h"
+#include "crossystem.h"
#include "crossystem_arch.h"
#define MOSYS_PATH "/usr/sbin/mosys"
@@ -480,13 +481,18 @@ VbSharedDataHeader *VbSharedDataRead(void) {
}
int VbGetArchPropertyInt(const char* name) {
- if (!strcasecmp(name, "fmap_base"))
+ if (!strcasecmp(name, "fmap_base")) {
return ReadFdtInt("fmap-offset");
- else if (!strcasecmp(name, "devsw_cur"))
+ } else if (!strcasecmp(name, "devsw_cur")) {
+ /* Systems with virtual developer switches return at-boot value */
+ int flags = VbGetSystemPropertyInt("vdat_flags");
+ if ((flags != -1) && (flags & VBSD_HONOR_VIRT_DEV_SWITCH))
+ return VbGetSystemPropertyInt("devsw_boot");
+
return VbGetVarGpio("developer-switch");
- else if (!strcasecmp(name, "recoverysw_cur"))
+ } else if (!strcasecmp(name, "recoverysw_cur")) {
return VbGetVarGpio("recovery-switch");
- else if (!strcasecmp(name, "wpsw_cur")) {
+ } else if (!strcasecmp(name, "wpsw_cur")) {
int value;
/* Try finding the GPIO through the chromeos_arm platform device first. */
value = VbGetPlatformGpioStatus("write-protect");
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index 448a8ffa..23a3bcec 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -595,7 +595,12 @@ int VbGetArchPropertyInt(const char* name) {
/* Switch positions */
if (!strcasecmp(name,"devsw_cur")) {
- value = ReadGpio(GPIO_SIGNAL_TYPE_DEV);
+ /* Systems with virtual developer switches return at-boot value */
+ int flags = VbGetSystemPropertyInt("vdat_flags");
+ if ((flags != -1) && (flags & VBSD_HONOR_VIRT_DEV_SWITCH))
+ value = VbGetSystemPropertyInt("devsw_boot");
+ else
+ value = ReadGpio(GPIO_SIGNAL_TYPE_DEV);
} else if (!strcasecmp(name,"recoverysw_cur")) {
value = ReadGpio(GPIO_SIGNAL_TYPE_RECOVERY);
} else if (!strcasecmp(name,"wpsw_cur")) {