[coreboot-gerrit] Change in coreboot[master]: mb/google/octopus: Check for invalid pin termination settings
Shamile Khan (Code Review)
gerrit at coreboot.org
Tue Oct 16 00:41:36 CEST 2018
Shamile Khan has uploaded this change for review. ( https://review.coreboot.org/29110
Change subject: mb/google/octopus: Check for invalid pin termination settings
......................................................................
mb/google/octopus: Check for invalid pin termination settings
BUG=b:79982669
TEST=None
Change-Id: I64317e75f27e4cc2faf88b640b1bf9401db59dec
Signed-off-by: Shamile Khan <shamile.khan at intel.com>
---
M src/soc/intel/common/block/include/intelblocks/gpio_defs.h
1 file changed, 21 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/29110/1
diff --git a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h
index a8d5ac9..1371a56 100644
--- a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h
+++ b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h
@@ -130,11 +130,31 @@
PAD_CFG0_TRIG_##trig | \
PAD_CFG0_RX_POL_##inv)
+#define PAD_CFG_CHECK_ENPD(value) \
+ !(((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPD) \
+ && (((value) & PAD_CFG1_PULL_MASK) > PAD_CFG1_PULL_DN_20K)) || \
+ ((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPD) && \
+ (((value) & PAD_CFG1_PULL_MASK) == PAD_CFG1_PULL_NONE)))
+
+#define PAD_CFG_CHECK_ENPU(value) \
+ !(((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPU) \
+ && (((value) & PAD_CFG1_PULL_MASK) < PAD_CFG1_PULL_UP_1K)) || \
+ ((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPU) && \
+ (((value) & PAD_CFG1_PULL_MASK) == PAD_CFG1_PULL_NATIVE)))
+
+/* Check for validity of Pad settings as per Doc# 572688. If the setting is
+ * invalid, assign a value greater than the max of a 32-bit integer. This will
+ * cause a compilation error and prevent the use of an invalid setting.
+ */
+#define _PAD_CFG_IS_VALID(__pad, __config0, __config1) \
+ (PAD_CFG_CHECK_ENPD(__config1) && PAD_CFG_CHECK_ENPU(__config1))
+
#define _PAD_CFG_STRUCT(__pad, __config0, __config1) \
{ \
.pad = __pad, \
.pad_config[0] = __config0, \
- .pad_config[1] = __config1, \
+ .pad_config[1] = _PAD_CFG_IS_VALID(__pad, __config0, \
+ __config1) ? __config1: 0xFFFFFFFFFF, \
}
/* Native function configuration */
--
To view, visit https://review.coreboot.org/29110
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64317e75f27e4cc2faf88b640b1bf9401db59dec
Gerrit-Change-Number: 29110
Gerrit-PatchSet: 1
Gerrit-Owner: Shamile Khan <shamile.khan at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181015/71973a24/attachment.html>
More information about the coreboot-gerrit
mailing list