qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] IO port emulation


From: Stuart Brady
Subject: [Qemu-devel] IO port emulation
Date: Sun, 25 Jan 2009 18:14:34 +0000
User-agent: Mutt/1.5.13 (2006-08-11)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]