[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/28] serial: factor out serial_mm_connect
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 13/28] serial: factor out serial_mm_connect |
Date: |
Tue, 22 Oct 2019 17:34:14 +0100 |
On Tue, 22 Oct 2019 at 17:23, Marc-André Lureau
<address@hidden> wrote:
>
> Split IRQ and memory region initialization in a different function to
> be reused by callers that realize the serial device themself, and
> connect irq/mem after.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> hw/char/serial.c | 20 +++++++++++++-------
> include/hw/char/serial.h | 3 +++
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 72d48b5cd8..41548e159c 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -1078,27 +1078,33 @@ static const MemoryRegionOps serial_mm_ops[3] = {
> },
> };
>
> +void serial_mm_connect(SerialMMState *self, enum device_endian end,
> + MemoryRegion *address_space, qemu_irq irq)
> +{
> + SerialState *s = SERIAL(self);
> +
> + qdev_connect_gpio_out_named(DEVICE(self), "serial-irq", 0, irq);
> + memory_region_init_io(&s->io, NULL, &serial_mm_ops[end], self,
> + "serial", 8 << self->regshift);
> + memory_region_add_subregion(address_space, s->base, &s->io);
> +}
This function isn't needed if you make SerialMMState a sysbus
device which provides the MMIO region and the IRQ in the
usual way.
thanks
-- PMM
- [PATCH v2 07/28] serial: add and set "regshift" property, (continued)
- [PATCH v2 09/28] serial: add "baudbase" property, Marc-André Lureau, 2019/10/22
- [PATCH v2 11/28] serial: realize the serial device, Marc-André Lureau, 2019/10/22
- [PATCH v2 12/28] serial: replace serial_exit_core() with unrealize, Marc-André Lureau, 2019/10/22
- [PATCH v2 13/28] serial: factor out serial_mm_connect, Marc-André Lureau, 2019/10/22
- Re: [PATCH v2 13/28] serial: factor out serial_mm_connect,
Peter Maydell <=
- [PATCH v2 14/28] sm501: embed the serial device, Marc-André Lureau, 2019/10/22
- [PATCH v2 15/28] vmmouse: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/22
- [PATCH v2 18/28] dp8393x: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/22
- [PATCH v2 16/28] lance: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/22
- [PATCH v2 17/28] etraxfs: remove PROP_PTR usage, Marc-André Lureau, 2019/10/22
- [PATCH v2 19/28] leon3: use qemu_irq framework instead of callback as property, Marc-André Lureau, 2019/10/22
- [PATCH v2 20/28] sparc: move PIL irq handling to cpu.c, Marc-André Lureau, 2019/10/22
- [PATCH v2 21/28] RFC: mips/cps: fix setting saar property, Marc-André Lureau, 2019/10/22
- [PATCH v2 22/28] cris: improve passing PIC interrupt vector to the CPU, Marc-André Lureau, 2019/10/22
- [PATCH v2 24/28] omap-intc: remove PROP_PTR, Marc-André Lureau, 2019/10/22