From patchwork Tue Aug 16 16:45:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 110208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EE536B6F81 for ; Wed, 17 Aug 2011 03:39:43 +1000 (EST) Received: from localhost ([::1]:46094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtMpO-0007Sh-B0 for incoming@patchwork.ozlabs.org; Tue, 16 Aug 2011 12:49:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtMoK-0004cT-L7 for qemu-devel@nongnu.org; Tue, 16 Aug 2011 12:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtMoG-00029a-9f for qemu-devel@nongnu.org; Tue, 16 Aug 2011 12:48:16 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:57789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtMoF-00024p-EH for qemu-devel@nongnu.org; Tue, 16 Aug 2011 12:48:12 -0400 Received: by mail-vw0-f45.google.com with SMTP id 17so96031vws.4 for ; Tue, 16 Aug 2011 09:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ERrE4xu8g+tkvlwvWjXw5uIlBGDCL5Qv5yOhRF0mU38=; b=iGJghsBo4HHOtQSL0tDodJs9RNct2yqUp04GinIe0UHIxvPcz3NOLCjQPHpZCcA6HB dyg4R0u0amM3/bk1eNi90f9BtoSECeEBmxA6Kg1eRCZIRRL68WVu9BOVMFz2eyjHSNHO tzgohxMd9uGSKAi/mPXmqjWnc/AumCYbqVCsw= Received: by 10.52.73.97 with SMTP id k1mr5038863vdv.15.1313513291055; Tue, 16 Aug 2011 09:48:11 -0700 (PDT) Received: from localhost.localdomain (c-71-227-161-214.hsd1.wa.comcast.net [71.227.161.214]) by mx.google.com with ESMTPS id gw3sm246636vdb.44.2011.08.16.09.48.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Aug 2011 09:48:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 16 Aug 2011 09:45:42 -0700 Message-Id: <1313513145-5348-12-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1313513145-5348-1-git-send-email-rth@twiddle.net> References: <1313513145-5348-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.45 Cc: avi@redhat.com Subject: [Qemu-devel] [PATCH 11/14] pc: Convert port92 to isa_register_ioport. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Richard Henderson --- hw/pc.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index d752821..cd01b7a 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -428,6 +428,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, /* port 92 stuff: could be split off */ typedef struct Port92State { ISADevice dev; + MemoryRegion io; uint8_t outport; qemu_irq *a20_out; } Port92State; @@ -479,13 +480,22 @@ static void port92_reset(DeviceState *d) s->outport &= ~1; } +static const MemoryRegionPortio port92_portio[] = { + {0, 1, 1, .read = port92_read, .write = port92_write }, + PORTIO_END_OF_LIST(), +}; + +static const MemoryRegionOps port92_ops = { + .old_portio = port92_portio +}; + static int port92_initfn(ISADevice *dev) { Port92State *s = DO_UPCAST(Port92State, dev, dev); - register_ioport_read(0x92, 1, 1, port92_read, s); - register_ioport_write(0x92, 1, 1, port92_write, s); - isa_init_ioport(dev, 0x92); + memory_region_init_io(&s->io, &port92_ops, s, "port92", 1); + isa_register_ioport(dev, &s->io, 0x92); + s->outport = 0; return 0; }