From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42713 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oc3xA-00031d-Lt for qemu-devel@nongnu.org; Thu, 22 Jul 2010 18:09:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oc3mj-0002jQ-2u for qemu-devel@nongnu.org; Thu, 22 Jul 2010 17:58:34 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:52030) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oc3mi-0002jK-Vh for qemu-devel@nongnu.org; Thu, 22 Jul 2010 17:58:33 -0400 Received: by yxn35 with SMTP id 35so3120262yxn.4 for ; Thu, 22 Jul 2010 14:58:32 -0700 (PDT) MIME-Version: 1.0 From: Blue Swirl Date: Thu, 22 Jul 2010 21:58:12 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [PATCH 15/34] wdt_i6300esb: convert to pci_bar_map List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Use pci_bar_map() instead of a mapping function. Signed-off-by: Blue Swirl --- hw/wdt_i6300esb.c | 38 ++++++++++++++------------------------ 1 files changed, 14 insertions(+), 24 deletions(-) diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c index 46e1df8..24409ec 100644 --- a/hw/wdt_i6300esb.c +++ b/hw/wdt_i6300esb.c @@ -342,29 +342,17 @@ static void i6300esb_mem_writel(void *vp, target_phys_addr_t addr, uint32_t val) } } -static void i6300esb_map(PCIDevice *dev, int region_num, - pcibus_t addr, pcibus_t size, int type) -{ - static CPUReadMemoryFunc * const mem_read[3] = { - i6300esb_mem_readb, - i6300esb_mem_readw, - i6300esb_mem_readl, - }; - static CPUWriteMemoryFunc * const mem_write[3] = { - i6300esb_mem_writeb, - i6300esb_mem_writew, - i6300esb_mem_writel, - }; - I6300State *d = DO_UPCAST(I6300State, dev, dev); - int io_mem; - - i6300esb_debug("addr = %"FMT_PCIBUS", size = %"FMT_PCIBUS", type = %d\n", - addr, size, type); +static CPUReadMemoryFunc * const mem_read[3] = { + i6300esb_mem_readb, + i6300esb_mem_readw, + i6300esb_mem_readl, +}; - io_mem = cpu_register_io_memory(mem_read, mem_write, d); - cpu_register_physical_memory (addr, 0x10, io_mem); - /* qemu_register_coalesced_mmio (addr, 0x10); ? */ -} +static CPUWriteMemoryFunc * const mem_write[3] = { + i6300esb_mem_writeb, + i6300esb_mem_writew, + i6300esb_mem_writel, +}; static const VMStateDescription vmstate_i6300esb = { .name = "i6300esb_wdt", @@ -393,6 +381,7 @@ static int i6300esb_init(PCIDevice *dev) { I6300State *d = DO_UPCAST(I6300State, dev, dev); uint8_t *pci_conf; + int io_mem; d->reboot_enabled = 1; d->clock_scale = CLOCK_SCALE_1KHZ; @@ -412,8 +401,9 @@ static int i6300esb_init(PCIDevice *dev) pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9); pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER); - pci_register_bar(&d->dev, 0, 0x10, - PCI_BASE_ADDRESS_SPACE_MEMORY, i6300esb_map); + pci_register_bar(&d->dev, 0, 0x10, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL); + io_mem = cpu_register_io_memory(mem_read, mem_write, d); + pci_bar_map(&d->dev, 0, 0, 0, 0x10, io_mem); return 0; } -- 1.6.2.4