[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH 16/22] hw/ssi/pl022: Set up reset function in clas
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-arm] [PATCH 16/22] hw/ssi/pl022: Set up reset function in class init |
Date: |
Tue, 21 Aug 2018 03:49:40 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 08/20/2018 11:11 AM, Peter Maydell wrote:
> Currently the PL022 calls pl022_reset() from its class init
> function. Make it register a DeviceState reset method instead,
> so that we reset the device on system reset.
>
> Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/ssi/pl022.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c
> index 379d3093987..0b5f90b857f 100644
> --- a/hw/ssi/pl022.c
> +++ b/hw/ssi/pl022.c
> @@ -203,8 +203,10 @@ static void pl022_write(void *opaque, hwaddr offset,
> }
> }
>
> -static void pl022_reset(PL022State *s)
> +static void pl022_reset(DeviceState *dev)
> {
> + PL022State *s = PL022(dev);
> +
> s->rx_fifo_len = 0;
> s->tx_fifo_len = 0;
> s->im = 0;
> @@ -277,7 +279,6 @@ static int pl022_init(SysBusDevice *sbd)
> sysbus_init_mmio(sbd, &s->iomem);
> sysbus_init_irq(sbd, &s->irq);
> s->ssi = ssi_create_bus(dev, "ssi");
> - pl022_reset(s);
> vmstate_register(dev, -1, &vmstate_pl022, s);
> return 0;
> }
> @@ -285,8 +286,10 @@ static int pl022_init(SysBusDevice *sbd)
> static void pl022_class_init(ObjectClass *klass, void *data)
> {
> SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> sdc->init = pl022_init;
> + dc->reset = pl022_reset;
> }
>
> static const TypeInfo pl022_info = {
>
- [Qemu-arm] [PATCH 15/22] hw/ssi/pl022: Allow use as embedded-struct device, (continued)
- [Qemu-arm] [PATCH 15/22] hw/ssi/pl022: Allow use as embedded-struct device, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 18/22] hw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 14/22] hw/arm/mps2-tz: Create PL081s and MSCs, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 16/22] hw/ssi/pl022: Set up reset function in class init, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 17/22] hw/ssi/pl022: Don't directly call vmstate_register(), Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 20/22] hw/ssi/pl022: Correct wrong DMACR and ICR handling, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 22/22] hw/arm/mps2-tz: Fix MPS2 SCC config register values, Peter Maydell, 2018/08/20
- [Qemu-arm] [PATCH 21/22] hw/arm/mps2-tz: Instantiate SPI controllers, Peter Maydell, 2018/08/20