[haiku-commits] r42820 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2

  • From: zharik@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 11 Oct 2011 16:00:32 +0200 (CEST)

Author: siarzhuk
Date: 2011-10-11 16:00:32 +0200 (Tue, 11 Oct 2011)
New Revision: 42820
Changeset: https://dev.haiku-os.org/changeset/42820
Ticket: https://dev.haiku-os.org/ticket/6313
Ticket: https://dev.haiku-os.org/ticket/7973

Modified:
   haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp
   haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp
Log:
* Check the KBC command byte for kbd disable bit during keyboard probe and clean
  it in case it was set "on".
* Tracing added for the case of ignoring interrupt with not active OBF status 
bit.

Fixes #7973 #6313



Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp      
2011-10-10 18:07:53 UTC (rev 42819)
+++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.cpp      
2011-10-11 14:00:32 UTC (rev 42820)
@@ -278,8 +278,11 @@
        ps2_dev *dev;
 
        ctrl = ps2_read_ctrl();
-       if (!(ctrl & PS2_STATUS_OUTPUT_BUFFER_FULL))
+       if (!(ctrl & PS2_STATUS_OUTPUT_BUFFER_FULL)) {
+               TRACE("ps2: ps2_interrupt unhandled, OBF bit unset, ctrl 0x%02x 
(%s)\n",
+                               ctrl, (ctrl & PS2_STATUS_AUX_DATA) ? "aux" : 
"keyb");
                return B_UNHANDLED_INTERRUPT;
+       }
 
        if (atomic_get(&sIgnoreInterrupts)) {
                TRACE("ps2: ps2_interrupt ignoring, ctrl 0x%02x (%s)\n", ctrl,

Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp    
2011-10-10 18:07:53 UTC (rev 42819)
+++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp    
2011-10-11 14:00:32 UTC (rev 42820)
@@ -289,6 +289,24 @@
 //             return B_ERROR;
 //     }
 
+// Some controllers set the disble keyboard command bit to "on" after resetting
+// the keyboard device. Read #7973 #6313 for more details.
+// So check the command byte now and re-enable the keyboard if it is the case.
+       uint8 cmdbyte = 0;
+       status = ps2_command(PS2_CTRL_READ_CMD, NULL, 0, &cmdbyte, 1);
+
+       if (status != B_OK) {
+               INFO("ps2: cannot read CMD byte on kbd probe:0x%#08lx\n", 
status);
+       } else
+       if ((cmdbyte & PS2_BITS_KEYBOARD_DISABLED) == 
PS2_BITS_KEYBOARD_DISABLED) {
+               cmdbyte &= ~PS2_BITS_KEYBOARD_DISABLED;
+               status = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0);
+               if (status != B_OK) {
+                       INFO("ps2: cannot write 0x%02x to CMD byte on kbd 
probe:0x%08lx\n",
+                                       cmdbyte, status);
+               }
+       }
+
        return B_OK;
 }
 


Other related posts:

  • » [haiku-commits] r42820 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 - zharik