From patchwork Mon Jul 12 18:40:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 58649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CC9E3B6F01 for ; Tue, 13 Jul 2010 04:49:33 +1000 (EST) Received: from localhost ([127.0.0.1]:56607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYO4I-00061d-TM for incoming@patchwork.ozlabs.org; Mon, 12 Jul 2010 14:49:30 -0400 Received: from [140.186.70.92] (port=47384 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYNvl-0000L6-8T for qemu-devel@nongnu.org; Mon, 12 Jul 2010 14:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYNvk-00068v-0B for qemu-devel@nongnu.org; Mon, 12 Jul 2010 14:40:41 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:50876) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYNvj-00065a-Pm for qemu-devel@nongnu.org; Mon, 12 Jul 2010 14:40:39 -0400 Received: by mail-pz0-f45.google.com with SMTP id 10so1294765pzk.4 for ; Mon, 12 Jul 2010 11:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=Im4QIKz8XAJs0/ZtHMTnpwb7IktdUY/1m//P62n25/w=; b=umltGCWQj4S7lEKma+RT9gdb/n7Nq1cbPsP6mqEy1i/LzW35U0zpYp4NxWstKdttON M+y/XREdIQMQyOM5oP+ejxjehBJT03aXzXaC0ah6x54kOcBIeT2b3rTrP0NrZBF+9TrV bpP42884XU7PCp330Clbew21oMeW4Vlw9u3dM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=LosF6vIOgOOan4vQmqMiQsFuJ1u3HSCz/hUJ9ahKw6AMEl31jUSgje9y2MuJpCSdWG dt7tpa9DFHk3n3vgsFEJj7zvODG6xDxXg2I+aLo5vSolp7qwY0McyzJEYQjAcIrgOATT mMBQ82hgiKvwlw3HjXAl1X4soKWo3jy8xU4q8= Received: by 10.142.177.21 with SMTP id z21mr13820648wfe.73.1278960039224; Mon, 12 Jul 2010 11:40:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.212.14 with HTTP; Mon, 12 Jul 2010 11:40:19 -0700 (PDT) From: Blue Swirl Date: Mon, 12 Jul 2010 18:40:19 +0000 Message-ID: To: qemu-devel , Anthony Liguori , "Michael S. Tsirkin" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [PATCH 03/15] es1370: convert to pci_bar_map X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use pci_bar_map() instead of a mapping function. Signed-off-by: Blue Swirl --- hw/es1370.c | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-) diff --git a/hw/es1370.c b/hw/es1370.c index 40cb48c..df6b4d1 100644 --- a/hw/es1370.c +++ b/hw/es1370.c @@ -906,23 +906,17 @@ static void es1370_adc_callback (void *opaque, int avail) es1370_run_channel (s, ADC_CHANNEL, avail); } -static void es1370_map (PCIDevice *pci_dev, int region_num, - pcibus_t addr, pcibus_t size, int type) -{ - ES1370State *s = DO_UPCAST (ES1370State, dev, pci_dev); - - (void) region_num; - (void) size; - (void) type; - - register_ioport_write (addr, 0x40 * 4, 1, es1370_writeb, s); - register_ioport_write (addr, 0x40 * 2, 2, es1370_writew, s); - register_ioport_write (addr, 0x40, 4, es1370_writel, s); +static IOPortWriteFunc * const es1370_writes[] = { + es1370_writeb, + es1370_writew, + es1370_writel, +}; - register_ioport_read (addr, 0x40 * 4, 1, es1370_readb, s); - register_ioport_read (addr, 0x40 * 2, 2, es1370_readw, s); - register_ioport_read (addr, 0x40, 4, es1370_readl, s); -} +static IOPortReadFunc * const es1370_reads[] = { + es1370_readb, + es1370_readw, + es1370_readl, +}; static const VMStateDescription vmstate_es1370_channel = { .name = "es1370_channel", @@ -997,6 +991,7 @@ static int es1370_initfn (PCIDevice *dev) { ES1370State *s = DO_UPCAST (ES1370State, dev, dev); uint8_t *c = s->dev.config; + int io_index; pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ); pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370); @@ -1023,7 +1018,10 @@ static int es1370_initfn (PCIDevice *dev) c[PCI_MIN_GNT] = 0x0c; c[PCI_MAX_LAT] = 0x80; - pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, es1370_map); + pci_register_bar(&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, NULL); + io_index = cpu_register_io(es1370_reads, es1370_writes, 256, s); + pci_bar_map(&s->dev, 0, 0, 0, 256, io_index); + qemu_register_reset (es1370_on_reset, s); AUD_register_card ("es1370", &s->card);