From: Isaku Yamahata Subject: Re: [Qemu-devel] [PATCH RFC V3 04/12] xen: Add the Xen platform pci device Date: Fri, 24 Sep 2010 14:52:13 +0900 Message-ID: <20100924055213.GG4701@valinux.co.jp> References: <1284722107-28550-1-git-send-email-anthony.perard@citrix.com> <1284722107-28550-5-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1284722107-28550-5-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: anthony.perard@citrix.com Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, Sep 17, 2010 at 12:14:59PM +0100, anthony.perard@citrix.com wrote: > +static uint32_t platform_mmio_read(void *opaque, target_phys_addr_t addr) > +{ > + static int warnings = 0; > + > + if (warnings < 5) { > + DPRINTF("Warning: attempted read from physical address " > + "0x" TARGET_FMT_plx " in xen platform mmio space\n", addr); > + warnings++; > + } > + return 0; > +} > + > +static void platform_mmio_write(void *opaque, target_phys_addr_t addr, > + uint32_t val) > +{ > + static int warnings = 0; > + > + if (warnings < 5) { > + DPRINTF("Warning: attempted write of 0x%x to physical " > + "address 0x" TARGET_FMT_plx " in xen platform mmio space\n", > + val, addr); > + warnings++; > + } > +} > + > +static CPUReadMemoryFunc * const platform_mmio_read_funcs[3] = { > + platform_mmio_read, > + platform_mmio_read, > + platform_mmio_read, > +}; > + > +static CPUWriteMemoryFunc * const platform_mmio_write_funcs[3] = { > + platform_mmio_write, > + platform_mmio_write, > + platform_mmio_write, > +}; > + > +static void platform_mmio_map(PCIDevice *d, int region_num, > + pcibus_t addr, pcibus_t size, int type) > +{ > + int mmio_io_addr; > + > + mmio_io_addr = cpu_register_io_memory(platform_mmio_read_funcs, > + platform_mmio_write_funcs, NULL); > + > + cpu_register_physical_memory(addr, size, mmio_io_addr); > +} Please use cpu_register_io_memory_simple(). -- yamahata