qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Brady <sdbrady@ntlworld.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] IO port emulation
Date: Sun, 25 Jan 2009 18:14:34 +0000	[thread overview]
Message-ID: <20090125181434.GA32121@miranda.arrow> (raw)

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

                 reply	other threads:[~2009-01-25 18:14 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=20090125181434.GA32121@miranda.arrow \
    --to=sdbrady@ntlworld.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).