From patchwork Mon Mar 1 14:07:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 82932 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o21E82xB008922 for ; Mon, 1 Mar 2010 14:08:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750854Ab0CAOHw (ORCPT ); Mon, 1 Mar 2010 09:07:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750767Ab0CAOHv (ORCPT ); Mon, 1 Mar 2010 09:07:51 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o21E7pnM018678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Mar 2010 09:07:51 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o21E7ovf017791; Mon, 1 Mar 2010 09:07:50 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id E43AC18D450; Mon, 1 Mar 2010 16:07:49 +0200 (IST) Date: Mon, 1 Mar 2010 16:07:49 +0200 From: Gleb Natapov To: mtosatti@redhat.com, avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] Add io port to test device. Message-ID: <20100301140749.GL16909@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Mar 2010 14:08:02 +0000 (UTC) diff --git a/hw/testdev.c b/hw/testdev.c index ad34e43..a8c49a3 100644 --- a/hw/testdev.c +++ b/hw/testdev.c @@ -34,6 +34,18 @@ static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data) qemu_set_irq(ioapic_irq_hack[addr - 0x2000], !!data); } +static uint32 test_device_ioport_data; + +static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t data) +{ + test_device_ioport_data = data; +} + +static uint32_t test_device_ioport_read(void *opaque, uint32_t addr) +{ + return test_device_ioport_data; +} + static char *iomem_buf; static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr) @@ -86,6 +98,12 @@ static int init_test_device(ISADevice *isa) register_ioport_write(0xf1, 1, 1, test_device_serial_write, dev); register_ioport_write(0xf4, 1, 4, test_device_exit, dev); register_ioport_read(0xd1, 1, 4, test_device_memsize_read, dev); + register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev); + register_ioport_write(0xe0, 1, 1, test_device_ioport_write, dev); + register_ioport_read(0xe0, 1, 2, test_device_ioport_read, dev); + register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev); + register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev); + register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev); register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL); iomem_buf = qemu_mallocz(0x10000); iomem = cpu_register_io_memory(test_iomem_read, test_iomem_write, NULL);