<p>Shamile Khan has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/29110">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mb/google/octopus: Check for invalid pin termination settings<br><br>BUG=b:79982669<br>TEST=None<br><br>Change-Id: I64317e75f27e4cc2faf88b640b1bf9401db59dec<br>Signed-off-by: Shamile Khan <shamile.khan@intel.com><br>---<br>M src/soc/intel/common/block/include/intelblocks/gpio_defs.h<br>1 file changed, 21 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/29110/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h</span><br><span>index a8d5ac9..1371a56 100644</span><br><span>--- a/src/soc/intel/common/block/include/intelblocks/gpio_defs.h</span><br><span>+++ b/src/soc/intel/common/block/include/intelblocks/gpio_defs.h</span><br><span>@@ -130,11 +130,31 @@</span><br><span>                                 PAD_CFG0_TRIG_##trig | \</span><br><span>                             PAD_CFG0_RX_POL_##inv)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define PAD_CFG_CHECK_ENPD(value) \</span><br><span style="color: hsl(120, 100%, 40%);">+       !(((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPD) \</span><br><span style="color: hsl(120, 100%, 40%);">+ && (((value) & PAD_CFG1_PULL_MASK) > PAD_CFG1_PULL_DN_20K)) || \</span><br><span style="color: hsl(120, 100%, 40%);">+       ((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPD) && \</span><br><span style="color: hsl(120, 100%, 40%);">+        (((value) & PAD_CFG1_PULL_MASK) == PAD_CFG1_PULL_NONE)))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define PAD_CFG_CHECK_ENPU(value) \</span><br><span style="color: hsl(120, 100%, 40%);">+   !(((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPU) \</span><br><span style="color: hsl(120, 100%, 40%);">+ && (((value) & PAD_CFG1_PULL_MASK) < PAD_CFG1_PULL_UP_1K)) || \</span><br><span style="color: hsl(120, 100%, 40%);">+        ((((value) & PAD_CFG1_IOSTERM_MASK) == PAD_CFG1_IOSTERM_ENPU) && \</span><br><span style="color: hsl(120, 100%, 40%);">+        (((value) & PAD_CFG1_PULL_MASK) == PAD_CFG1_PULL_NATIVE)))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Check for validity of Pad settings as per Doc# 572688. If the setting is</span><br><span style="color: hsl(120, 100%, 40%);">+ * invalid, assign a value greater than the max of a 32-bit integer. This will</span><br><span style="color: hsl(120, 100%, 40%);">+ * cause a compilation error and prevent the use of an invalid setting.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#define _PAD_CFG_IS_VALID(__pad, __config0, __config1) \</span><br><span style="color: hsl(120, 100%, 40%);">+ (PAD_CFG_CHECK_ENPD(__config1) && PAD_CFG_CHECK_ENPU(__config1))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define _PAD_CFG_STRUCT(__pad, __config0, __config1)      \</span><br><span>    {                                       \</span><br><span>            .pad = __pad,                   \</span><br><span>            .pad_config[0] = __config0,     \</span><br><span style="color: hsl(0, 100%, 40%);">-               .pad_config[1] = __config1,     \</span><br><span style="color: hsl(120, 100%, 40%);">+             .pad_config[1] = _PAD_CFG_IS_VALID(__pad, __config0, \</span><br><span style="color: hsl(120, 100%, 40%);">+                        __config1) ? __config1: 0xFFFFFFFFFF, \</span><br><span>      }</span><br><span> </span><br><span> /* Native function configuration */</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/29110">change 29110</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/29110"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I64317e75f27e4cc2faf88b640b1bf9401db59dec </div>
<div style="display:none"> Gerrit-Change-Number: 29110 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Shamile Khan <shamile.khan@intel.com> </div>