qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] IO port emulation
@ 2009-01-25 18:14 Stuart Brady
  0 siblings, 0 replies; only message in thread
From: Stuart Brady @ 2009-01-25 18:14 UTC (permalink / raw)
  To: qemu-devel

Hi,

I'm having some difficulty with QEMU's IO port handling.

The problem affects RTC (MC146818) emulation for the MIPS Magnum machine
under NetBSD 1.6.

There are two ports that are used to control the RTC.  These are the 
address port (#70 under ISA) and the data port (#71).  The Magnum makes
the address port available at physical address 0x90000070 and the data 
port available at physical address 0x90000071.  It also makes the data
port available at physical address 0x80004000.

When reading/updating an RTC register, NetBSD first sets the address by
performing a 32-bit write to 0x90000070.  It then performs the actual
read/write to the RTC register at 0x80004000.

Unfortunately, QEMU registers the RTC ioports for 8-bit access only:

    register_ioport_write(base, 2, 1, cmos_ioport_write, s);
    register_ioport_read(base, 2, 1, cmos_ioport_read, s);

This means that the 32-bit write is handled by default_ioport_writel(),
which throws the write away entirely.  (default_ioport_writew(), 
curiously, would split a 16-bit write into two separate 8-bit writes.)

Even if default_ioport_writel() did something with the write, I'm not
sure that it should also write to the data port as well as the address
port.  What does real hardware (e.g. real ISA on PCs) do in this case?

BTW, I notice that if I do this:

    register_ioport_write(base, 2, 4, cmos_ioport_write, s);

... then I'm actually requesting 32-bit ports at addresses #70 and #74,
and writes to port #71 (and #72/#73) would be discarded.

What's the correct fix?
-- 
Stuart Brady

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-25 18:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-25 18:14 [Qemu-devel] IO port emulation Stuart Brady

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).