From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uhc7K-0007uk-6k for qemu-devel@nongnu.org; Wed, 29 May 2013 04:52:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uhc7D-0005nY-Dy for qemu-devel@nongnu.org; Wed, 29 May 2013 04:52:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uhc7D-0005nO-5w for qemu-devel@nongnu.org; Wed, 29 May 2013 04:52:15 -0400 Message-ID: <51A5C1AE.6070909@redhat.com> Date: Wed, 29 May 2013 10:51:58 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 4/5] xilinx_devcfg: Zynq devcfg device model List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.crosthwaite@xilinx.com Cc: blauwirbel@gmail.com, peter.maydell@linaro.org, edgar.iglesias@gmail.com, qemu-devel@nongnu.org, kraxel@redhat.com Il 24/05/2013 07:49, peter.crosthwaite@xilinx.com ha scritto: > +static const MemoryRegionOps devcfg_reg_ops = { > + .read = register_read_memory_le, > + .write = register_write_memory_le, > + .endianness = DEVICE_LITTLE_ENDIAN, > + .valid = { > + .min_access_size = 4, > + .max_access_size = 4, What happens if you have registers of mixed size within the same "bank"? > + } > +}; > + > +static void xilinx_devcfg_realize(DeviceState *dev, Error **errp) > +{ > + XilinxDevcfg *s = XILINX_DEVCFG(dev); > + const char *prefix = object_get_canonical_path(OBJECT(dev)); > + int i; > + > + for (i = 0; i < R_MAX; ++i) { > + RegisterInfo *r = &s->regs_info[i]; > + > + *r = (RegisterInfo) { > + .data = &s->regs[i], > + .data_size = sizeof(uint32_t), > + .access = &xilinx_devcfg_regs_info[i], > + .debug = XILINX_DEVCFG_ERR_DEBUG, > + .prefix = prefix, > + .opaque = s, > + }; > + memory_region_init_io(&r->mem, &devcfg_reg_ops, r, "devcfg-regs", 4); Could you add a register_init function that does register_reset + memory_region_init_io? > + memory_region_add_subregion(&s->iomem, i * 4, &r->mem); Paolo