From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LR9Vb-0003nm-AY for qemu-devel@nongnu.org; Sun, 25 Jan 2009 13:14:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LR9VZ-0003my-9W for qemu-devel@nongnu.org; Sun, 25 Jan 2009 13:14:58 -0500 Received: from [199.232.76.173] (port=47308 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LR9VZ-0003ms-4g for qemu-devel@nongnu.org; Sun, 25 Jan 2009 13:14:57 -0500 Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]:64264) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LR9VY-0007eS-8a for qemu-devel@nongnu.org; Sun, 25 Jan 2009 13:14:57 -0500 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090125181439.GGRC4080.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Sun, 25 Jan 2009 18:14:39 +0000 Received: from miranda.arrow ([213.107.23.205]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090125181439.HRXB21638.aamtaout02-winn.ispmail.ntl.com@miranda.arrow> for ; Sun, 25 Jan 2009 18:14:39 +0000 Received: from sdb by miranda.arrow with local (Exim 4.63) (envelope-from ) id 1LR9VC-0008Mp-9q for qemu-devel@nongnu.org; Sun, 25 Jan 2009 18:14:34 +0000 Date: Sun, 25 Jan 2009 18:14:34 +0000 From: Stuart Brady Message-ID: <20090125181434.GA32121@miranda.arrow> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] IO port emulation Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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