<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20488">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ec/lenovo/h8: Fix keyboard init on first boot<br><br>On first boot after power failure the keyboard does not initialize.<br>After Linux has been booted and the power is kept the keyboard controller<br>can be initialized.<br><br>Disable keyboard and mouse port and issue a self test.<br><br>Tested on Lenovo T430. The keyboard is initialized on every boot, even<br>after power failure (no AC and removed battery).<br><br>Needs tests on other Lenovos.<br><br>Change-Id: I1ba7e5cb67f3dfeb2bc3d50b28757efa63c84391<br>Signed-off-by: Patrick Rudolph <siro@das-labor.org><br>---<br>M src/ec/lenovo/h8/h8.c<br>1 file changed, 26 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/20488/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c<br>index b259d9a..9b569a5 100644<br>--- a/src/ec/lenovo/h8/h8.c<br>+++ b/src/ec/lenovo/h8/h8.c<br>@@ -193,8 +193,34 @@<br> }<br> #endif<br> <br>+#define KBD_DATA       0x60<br>+#define KBD_COMMAND      0x64<br>+#define KBD_STATUS       0x64<br>+<br>+static bool h8_wait_kb_ready(void)<br>+{<br>+     size_t timeout = 1000;<br>+       while ((inb(KBD_STATUS) & 2) && timeout)<br>+         timeout--;<br>+   return timeout > 0;<br>+}<br>+<br> static void h8_init(device_t dev)<br> {<br>+        /* Lenovo early keyboard controller init sequence */<br>+ /* Disable keyboard */<br>+       if (h8_wait_kb_ready())<br>+              outb(0xad, KBD_COMMAND);<br>+     /* Disable mouse */<br>+  if (h8_wait_kb_ready())<br>+              outb(0xa7, KBD_COMMAND);<br>+     /* Clear input buffer */<br>+     if (inb(KBD_STATUS) & 1)<br>+         inb(KBD_DATA);<br>+       /* Self test, don't read result ... */<br>+   if (h8_wait_kb_ready())<br>+              outb(0xaa, KBD_COMMAND);<br>+<br>   pc_keyboard_init(NO_AUX_DEVICE);<br> }<br> <br></pre><p>To view, visit <a href="https://review.coreboot.org/20488">change 20488</a>. To unsubscribe, 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/20488"/><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: I1ba7e5cb67f3dfeb2bc3d50b28757efa63c84391 </div>
<div style="display:none"> Gerrit-Change-Number: 20488 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <siro@das-labor.org> </div>