From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Patch Tracking <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 2/5] hw/arm/pxa2xx: Convert pxa2xx-fir to QOM and VMState
Date: Fri, 5 Jun 2015 18:07:46 -0700 [thread overview]
Message-ID: <CAEgOgz7Lyq_mcUp28RYgXLxCsJFFqj85KYdAC60sCZpyh_Mo6w@mail.gmail.com> (raw)
In-Reply-To: <1432814996-13464-3-git-send-email-peter.maydell@linaro.org>
On Thu, May 28, 2015 at 5:09 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Convert the pxa2xx-fir device to QOM, including using a
> VMState for its migration info.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> hw/arm/pxa2xx.c | 137 +++++++++++++++++++++++++++++++++-----------------------
> 1 file changed, 82 insertions(+), 55 deletions(-)
>
> diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
> index 8123f05..fc77b44 100644
> --- a/hw/arm/pxa2xx.c
> +++ b/hw/arm/pxa2xx.c
> @@ -1759,24 +1759,33 @@ static PXA2xxI2SState *pxa2xx_i2s_init(MemoryRegion *sysmem,
> }
>
> /* PXA Fast Infra-red Communications Port */
> +#define TYPE_PXA2XX_FIR "pxa2xx-fir"
> +#define PXA2XX_FIR(obj) OBJECT_CHECK(PXA2xxFIrState, (obj), TYPE_PXA2XX_FIR)
> +
> struct PXA2xxFIrState {
> + /*< private >*/
> + SysBusDevice parent_obj;
> + /*< public >*/
> +
> MemoryRegion iomem;
> qemu_irq irq;
> qemu_irq rx_dma;
> qemu_irq tx_dma;
> - int enable;
> + uint32_t enable;
> CharDriverState *chr;
>
> uint8_t control[3];
> uint8_t status[2];
>
> - int rx_len;
> - int rx_start;
> + uint32_t rx_len;
> + uint32_t rx_start;
> uint8_t rx_fifo[64];
> };
>
> -static void pxa2xx_fir_reset(PXA2xxFIrState *s)
> +static void pxa2xx_fir_reset(DeviceState *d)
> {
> + PXA2xxFIrState *s = PXA2XX_FIR(d);
> +
> s->control[0] = 0x00;
> s->control[1] = 0x00;
> s->control[2] = 0x00;
> @@ -1953,73 +1962,91 @@ static void pxa2xx_fir_event(void *opaque, int event)
> {
> }
>
> -static void pxa2xx_fir_save(QEMUFile *f, void *opaque)
> +static void pxa2xx_fir_instance_init(Object *obj)
> {
> - PXA2xxFIrState *s = (PXA2xxFIrState *) opaque;
> - int i;
> -
> - qemu_put_be32(f, s->enable);
> -
> - qemu_put_8s(f, &s->control[0]);
> - qemu_put_8s(f, &s->control[1]);
> - qemu_put_8s(f, &s->control[2]);
> - qemu_put_8s(f, &s->status[0]);
> - qemu_put_8s(f, &s->status[1]);
> + PXA2xxFIrState *s = PXA2XX_FIR(obj);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>
> - qemu_put_byte(f, s->rx_len);
> - for (i = 0; i < s->rx_len; i ++)
> - qemu_put_byte(f, s->rx_fifo[(s->rx_start + i) & 63]);
> + memory_region_init_io(&s->iomem, NULL, &pxa2xx_fir_ops, s,
> + "pxa2xx-fir", 0x1000);
> + sysbus_init_mmio(sbd, &s->iomem);
Should there be some sysbus_init_irq's?
Regards,
Peter
> }
>
> -static int pxa2xx_fir_load(QEMUFile *f, void *opaque, int version_id)
> +static void pxa2xx_fir_realize(DeviceState *dev, Error **errp)
> {
> - PXA2xxFIrState *s = (PXA2xxFIrState *) opaque;
> - int i;
> + PXA2xxFIrState *s = PXA2XX_FIR(dev);
next prev parent reply other threads:[~2015-06-06 1:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 12:09 [Qemu-devel] [PATCH 0/5] pxa2xx: minor bugfixes, updates to QOM, etc Peter Maydell
2015-05-28 12:09 ` [Qemu-devel] [PATCH 1/5] hw/arm/pxa2xx: Mark coprocessor registers as ARM_CP_IO Peter Maydell
2015-06-05 22:46 ` Peter Crosthwaite
2015-05-28 12:09 ` [Qemu-devel] [PATCH 2/5] hw/arm/pxa2xx: Convert pxa2xx-fir to QOM and VMState Peter Maydell
2015-06-06 1:07 ` Peter Crosthwaite [this message]
2015-06-06 10:14 ` Peter Maydell
2015-05-28 12:09 ` [Qemu-devel] [PATCH 3/5] hw/arm/pxa2xx: Add reset method for pxa2xx_ssp Peter Maydell
2015-06-05 22:57 ` Peter Crosthwaite
2015-06-05 23:00 ` Peter Maydell
2015-06-05 23:06 ` Peter Crosthwaite
2015-06-05 23:18 ` Peter Maydell
2015-06-06 1:37 ` Peter Crosthwaite
2015-06-06 10:23 ` Peter Maydell
2015-05-28 12:09 ` [Qemu-devel] [PATCH 4/5] hw/arm/pxa2xx: Convert pxa2xx-ssp to VMState Peter Maydell
2015-06-05 23:18 ` Peter Crosthwaite
2015-06-05 23:32 ` Peter Maydell
2015-06-06 0:49 ` Peter Crosthwaite
2015-06-06 10:11 ` Peter Maydell
2015-05-28 12:09 ` [Qemu-devel] [PATCH 5/5] hw/sd/pxa2xx_mmci: Stop using old_mmio in MemoryRegionOps Peter Maydell
2015-06-06 1:11 ` Peter Crosthwaite
2015-06-05 15:04 ` [Qemu-devel] [PATCH 0/5] pxa2xx: minor bugfixes, updates to QOM, etc Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAEgOgz7Lyq_mcUp28RYgXLxCsJFFqj85KYdAC60sCZpyh_Mo6w@mail.gmail.com \
--to=peter.crosthwaite@xilinx.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).