From patchwork Thu May 6 13:26:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Kohl X-Patchwork-Id: 51829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9B01DB7D52 for ; Thu, 6 May 2010 23:27:52 +1000 (EST) Received: from localhost ([127.0.0.1]:53764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OA17E-00077H-8X for incoming@patchwork.ozlabs.org; Thu, 06 May 2010 09:27:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OA16Z-00074V-MZ for qemu-devel@nongnu.org; Thu, 06 May 2010 09:27:07 -0400 Received: from [140.186.70.92] (port=33407 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OA16U-0006wC-G1 for qemu-devel@nongnu.org; Thu, 06 May 2010 09:27:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OA16O-0007Sy-Rq for qemu-devel@nongnu.org; Thu, 06 May 2010 09:27:02 -0400 Received: from demumfd002.nsn-inter.net ([93.183.12.31]:14147) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OA16O-0007Se-CQ for qemu-devel@nongnu.org; Thu, 06 May 2010 09:26:56 -0400 Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd002.nsn-inter.net (8.12.11.20060308/8.12.11) with ESMTP id o46DQsc9002669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 6 May 2010 15:26:54 +0200 Received: from [10.148.23.89] ([10.148.23.89]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id o46DQrsj024596 for ; Thu, 6 May 2010 15:26:53 +0200 Message-ID: <4BE2C397.8030006@nsn.com> Date: Thu, 06 May 2010 15:26:47 +0200 From: Bernhard Kohl User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4 MIME-Version: 1.0 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Subject: [Qemu-devel] [PATCH] pckbd: support for commands 0xf0-0xff: Pulse output bit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/pckbd.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) 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); 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