From: Gleb Natapov <gleb@redhat.com>
To: mtosatti@redhat.com, avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH] Add io port to test device.
Date: Mon, 1 Mar 2010 16:07:49 +0200 [thread overview]
Message-ID: <20100301140749.GL16909@redhat.com> (raw)
Needed by emulator test.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
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);
--
Gleb.
reply other threads:[~2010-03-01 14:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100301140749.GL16909@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox