All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pckbd: support for commands 0xf0-0xff: Pulse output bit
@ 2010-05-05 14:58 Bernhard Kohl
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Kohl @ 2010-05-05 14:58 UTC (permalink / raw)
  To: qemu-devel

I use a legacy guest OS which sends the command 0xfd to the keyboard
controller during initialization. To get rid of the message
"qemu: unsupported keyboard cmd=0x%02x\n" I added support for
the pulse output bit commands.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
---
  hw/pckbd.c |   23 ++++++++++++++++++++---
  1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/pckbd.c b/hw/pckbd.c
index 7998aa6..554fbe4 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -50,7 +50,9 @@
  #define KBD_CCMD_WRITE_MOUSE    0xD4    /* Write the following byte to 
the mouse */
  #define KBD_CCMD_DISABLE_A20    0xDD    /* HP vectra only ? */
  #define KBD_CCMD_ENABLE_A20     0xDF    /* HP vectra only ? */
-#define KBD_CCMD_RESET            0xFE
+#define KBD_CCMD_PULSE_BITS_3_0 0xF0    /* Pulse bits 3-0 of the output 
port P2. */
+#define KBD_CCMD_RESET          0xFE    /* Pulse bit 0 of the output 
port P2 = CPU reset. */
+#define KBD_CCMD_NO_OP          0xFF    /* Pulse no bits of the output 
port P2. */

  /* Keyboard Commands */
  #define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
@@ -203,6 +205,21 @@ static void kbd_write_command(void *opaque, 
uint32_t addr, uint32_t val)
  #ifdef DEBUG_KBD
      printf("kbd: write cmd=0x%02x\n", val);
  #endif
+
+    /* Bits 3-0 of the output port P2 of the keyboard controller may be 
pulsed
+     * low for approximately 6 micro seconds. Bits 3-0 of the 
KBD_CCMD_PULSE
+     * command specify the output port bits to be pulsed.
+     * 0: Bit should be pulsed. 1: Bit should not be modified.
+     * The only useful version of this command is pulsing bit 0,
+     * which does a CPU reset.
+     */
+    if((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) {
+        if(!(val & 1))
+            val = KBD_CCMD_RESET;
+        else
+            val = KBD_CCMD_NO_OP;
+    }
+
      switch(val) {
      case KBD_CCMD_READ_MODE:
          kbd_queue(s, s->mode, 0);
@@ -265,8 +282,8 @@ static void kbd_write_command(void *opaque, uint32_t 
addr, uint32_t val)
      case KBD_CCMD_RESET:
          qemu_system_reset_request();
          break;
-    case 0xff:
-        /* ignore that - I don't know what is its use */
+    case KBD_CCMD_NO_OP:
+        /* ignore that */
          break;
      default:
          fprintf(stderr, "qemu: unsupported keyboard cmd=0x%02x\n", val);
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH] pckbd: support for commands 0xf0-0xff: Pulse output bit
@ 2010-05-06 13:26 Bernhard Kohl
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Kohl @ 2010-05-06 13:26 UTC (permalink / raw)
  To: qemu-devel

I use a legacy guest OS which sends the command 0xfd to the keyboard
controller during initialization. To get rid of the message
"qemu: unsupported keyboard cmd=0x%02x\n" I added support for
the pulse output bit commands.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
---
  hw/pckbd.c |   23 ++++++++++++++++++++---
  1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/pckbd.c b/hw/pckbd.c
index 7998aa6..554fbe4 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -50,7 +50,9 @@
  #define KBD_CCMD_WRITE_MOUSE    0xD4    /* Write the following byte to 
the mouse */
  #define KBD_CCMD_DISABLE_A20    0xDD    /* HP vectra only ? */
  #define KBD_CCMD_ENABLE_A20     0xDF    /* HP vectra only ? */
-#define KBD_CCMD_RESET            0xFE
+#define KBD_CCMD_PULSE_BITS_3_0 0xF0    /* Pulse bits 3-0 of the output 
port P2. */
+#define KBD_CCMD_RESET          0xFE    /* Pulse bit 0 of the output 
port P2 = CPU reset. */
+#define KBD_CCMD_NO_OP          0xFF    /* Pulse no bits of the output 
port P2. */

  /* Keyboard Commands */
  #define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
@@ -203,6 +205,21 @@ static void kbd_write_command(void *opaque, 
uint32_t addr, uint32_t val)
  #ifdef DEBUG_KBD
      printf("kbd: write cmd=0x%02x\n", val);
  #endif
+
+    /* Bits 3-0 of the output port P2 of the keyboard controller may be 
pulsed
+     * low for approximately 6 micro seconds. Bits 3-0 of the 
KBD_CCMD_PULSE
+     * command specify the output port bits to be pulsed.
+     * 0: Bit should be pulsed. 1: Bit should not be modified.
+     * The only useful version of this command is pulsing bit 0,
+     * which does a CPU reset.
+     */
+    if((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) {
+        if(!(val & 1))
+            val = KBD_CCMD_RESET;
+        else
+            val = KBD_CCMD_NO_OP;
+    }
+
      switch(val) {
      case KBD_CCMD_READ_MODE:
          kbd_queue(s, s->mode, 0);
@@ -265,8 +282,8 @@ static void kbd_write_command(void *opaque, uint32_t 
addr, uint32_t val)
      case KBD_CCMD_RESET:
          qemu_system_reset_request();
          break;
-    case 0xff:
-        /* ignore that - I don't know what is its use */
+    case KBD_CCMD_NO_OP:
+        /* ignore that */
          break;
      default:
          fprintf(stderr, "qemu: unsupported keyboard cmd=0x%02x\n", val);
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH] pckbd: support for commands 0xf0-0xff: Pulse output bit
@ 2010-08-02 13:43 Bernhard Kohl
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Kohl @ 2010-08-02 13:43 UTC (permalink / raw)
  To: qemu-devel

I have a guest OS which sends the command 0xfd to the keyboard
controller during initialization. To get rid of the message
"qemu: unsupported keyboard cmd=0x%02x\n" I added support for
the pulse output bit commands.

I found the following explanation here:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes-11.html#ss11.3

Command 0xf0-0xff: Pulse output bit
Bits 3-0 of the output port P2 of the keyboard controller may
be pulsed low for approximately 6 µseconds. Bits 3-0 of this
command specify the output port bits to be pulsed. 0: Bit should
be pulsed. 1: Bit should not be modified. The only useful version
of this command is Command 0xfe.
(For MCA, replace 3-0 by 1-0 in the above.)

Command 0xfe: System reset
Pulse bit 0 of the output port P2 of the keyboard controller.
This will reset the CPU.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
---
  hw/pckbd.c |   23 ++++++++++++++++++++---
  1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/pckbd.c b/hw/pckbd.c
index 0533b1d..6e4e406 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -56,7 +56,9 @@
  #define KBD_CCMD_WRITE_MOUSE    0xD4    /* Write the following byte to 
the mouse */
  #define KBD_CCMD_DISABLE_A20    0xDD    /* HP vectra only ? */
  #define KBD_CCMD_ENABLE_A20     0xDF    /* HP vectra only ? */
-#define KBD_CCMD_RESET            0xFE
+#define KBD_CCMD_PULSE_BITS_3_0 0xF0    /* Pulse bits 3-0 of the output 
port P2. */
+#define KBD_CCMD_RESET          0xFE    /* Pulse bit 0 of the output 
port P2 = CPU reset. */
+#define KBD_CCMD_NO_OP          0xFF    /* Pulse no bits of the output 
port P2. */

  /* Keyboard Commands */
  #define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
@@ -238,6 +240,21 @@ static void kbd_write_command(void *opaque, 
uint32_t addr, uint32_t val)
      KBDState *s = opaque;

      DPRINTF("kbd: write cmd=0x%02x\n", val);
+
+    /* Bits 3-0 of the output port P2 of the keyboard controller may be 
pulsed
+     * low for approximately 6 micro seconds. Bits 3-0 of the 
KBD_CCMD_PULSE
+     * command specify the output port bits to be pulsed.
+     * 0: Bit should be pulsed. 1: Bit should not be modified.
+     * The only useful version of this command is pulsing bit 0,
+     * which does a CPU reset.
+     */
+    if((val & KBD_CCMD_PULSE_BITS_3_0) == KBD_CCMD_PULSE_BITS_3_0) {
+        if(!(val & 1))
+            val = KBD_CCMD_RESET;
+        else
+            val = KBD_CCMD_NO_OP;
+    }
+
      switch(val) {
      case KBD_CCMD_READ_MODE:
          kbd_queue(s, s->mode, 0);
@@ -294,8 +311,8 @@ static void kbd_write_command(void *opaque, uint32_t 
addr, uint32_t val)
      case KBD_CCMD_RESET:
          qemu_system_reset_request();
          break;
-    case 0xff:
-        /* ignore that - I don't know what is its use */
+    case KBD_CCMD_NO_OP:
+        /* ignore that */
          break;
      default:
          fprintf(stderr, "qemu: unsupported keyboard cmd=0x%02x\n", val);
-- 
1.7.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-02 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06 13:26 [Qemu-devel] [PATCH] pckbd: support for commands 0xf0-0xff: Pulse output bit Bernhard Kohl
  -- strict thread matches above, loose matches on Subject: below --
2010-08-02 13:43 Bernhard Kohl
2010-05-05 14:58 Bernhard Kohl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.