mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
Read virtual switch current values correctly
As dev switch and recovery switch may be virtual, crossystem has to distinguish virtual switches from physical ones. Since to a virtual switch, its current value should always equal to its boot value, return a boot value when asked for a current value. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> BUG=chrome-os-partner:10007 TEST=crossystem devsw_cur|recoverysw_cur show correct value on Snow Change-Id: Ia73147ecd5528a3cc5276aff02a632ce4f52ea8b Reviewed-on: https://gerrit.chromium.org/gerrit/26568 Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
This commit is contained in:
@@ -213,14 +213,17 @@ static int VbGetVarGpio(const char* name) {
|
||||
|
||||
ret = ReadFdtBlock(name, &pp, &proplen);
|
||||
if (ret || !pp || proplen != 12) {
|
||||
ret = 2;
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
prop = pp;
|
||||
gpio_num = ntohl(prop[1]);
|
||||
polarity = ntohl(prop[2]);
|
||||
|
||||
ret = VbGetGpioStatus(gpio_num) ^ polarity ^ 1;
|
||||
if (gpio_num)
|
||||
ret = VbGetGpioStatus(gpio_num) ^ polarity ^ 1;
|
||||
else
|
||||
ret = -1;
|
||||
out:
|
||||
if (pp)
|
||||
free(pp);
|
||||
@@ -340,6 +343,8 @@ VbSharedDataHeader *VbSharedDataRead(void) {
|
||||
}
|
||||
|
||||
int VbGetArchPropertyInt(const char* name) {
|
||||
int value;
|
||||
|
||||
if (!strcasecmp(name, "fmap_base"))
|
||||
return ReadFdtInt("fmap-offset");
|
||||
else if (!strcasecmp(name, "devsw_boot"))
|
||||
@@ -349,15 +354,26 @@ int VbGetArchPropertyInt(const char* name) {
|
||||
else if (!strcasecmp(name, "wpsw_boot"))
|
||||
return ReadFdtBool("boot-write-protect-switch");
|
||||
else if (!strcasecmp(name, "devsw_cur"))
|
||||
return VbGetVarGpio("developer-switch");
|
||||
value = VbGetVarGpio("developer-switch");
|
||||
else if (!strcasecmp(name, "recoverysw_cur"))
|
||||
return VbGetVarGpio("recovery-switch");
|
||||
value = VbGetVarGpio("recovery-switch");
|
||||
else if (!strcasecmp(name, "wpsw_cur"))
|
||||
return VbGetVarGpio("write-protect-switch");
|
||||
return VbGetVarGpio("write-protect-switch");
|
||||
else if (!strcasecmp(name, "recoverysw_ec_boot"))
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
|
||||
if (value < 0) {
|
||||
if (!strcasecmp(name, "devsw_cur"))
|
||||
return ReadFdtBool("boot-developer-switch");
|
||||
else if (!strcasecmp(name, "recoverysw_cur"))
|
||||
return ReadFdtBool("boot-recovery-switch");
|
||||
else
|
||||
return -1;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
const char* VbGetArchPropertyString(const char* name, char* dest, int size) {
|
||||
|
||||
Reference in New Issue
Block a user