qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 05/14] hw/char/pl011: Allow use as an embedded-struct device
Date: Mon, 18 Feb 2019 22:59:51 +0100	[thread overview]
Message-ID: <2dc24df3-80d4-99ca-891f-31e2f96e5e85@redhat.com> (raw)
In-Reply-To: <20190214125107.22178-6-peter.maydell@linaro.org>

On 2/14/19 1:50 PM, Peter Maydell wrote:
> Create a new include file for the pl011's device struct,
> type macros, etc, so that it can be instantiated using
> the "embedded struct" coding style.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  include/hw/char/pl011.h | 34 ++++++++++++++++++++++++++++++++++
>  hw/char/pl011.c         | 31 ++-----------------------------
>  2 files changed, 36 insertions(+), 29 deletions(-)
> 
> diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
> index 83649324b6a..1b52bfd5c90 100644
> --- a/include/hw/char/pl011.h
> +++ b/include/hw/char/pl011.h
> @@ -15,6 +15,40 @@
>  #ifndef HW_PL011_H
>  #define HW_PL011_H
>  
> +#include "hw/sysbus.h"
> +#include "chardev/char-fe.h"
> +
> +#define TYPE_PL011 "pl011"
> +#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
> +
> +/* This shares the same struct (and cast macro) as the base pl011 device */
> +#define TYPE_PL011_LUMINARY "pl011_luminary"
> +
> +typedef struct PL011State {
> +    SysBusDevice parent_obj;
> +
> +    MemoryRegion iomem;
> +    uint32_t readbuff;
> +    uint32_t flags;
> +    uint32_t lcr;
> +    uint32_t rsr;
> +    uint32_t cr;
> +    uint32_t dmacr;
> +    uint32_t int_enabled;
> +    uint32_t int_level;
> +    uint32_t read_fifo[16];
> +    uint32_t ilpr;
> +    uint32_t ibrd;
> +    uint32_t fbrd;
> +    uint32_t ifl;
> +    int read_pos;
> +    int read_count;
> +    int read_trigger;
> +    CharBackend chr;
> +    qemu_irq irq;
> +    const unsigned char *id;
> +} PL011State;
> +
>  static inline DeviceState *pl011_create(hwaddr addr,
>                                          qemu_irq irq,
>                                          Chardev *chr)
> diff --git a/hw/char/pl011.c b/hw/char/pl011.c
> index 2aa277fc4f2..0c4711e4027 100644
> --- a/hw/char/pl011.c
> +++ b/hw/char/pl011.c
> @@ -8,39 +8,12 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "hw/char/pl011.h"
>  #include "hw/sysbus.h"
>  #include "chardev/char-fe.h"
>  #include "qemu/log.h"
>  #include "trace.h"
>  
> -#define TYPE_PL011 "pl011"
> -#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
> -
> -typedef struct PL011State {
> -    SysBusDevice parent_obj;
> -
> -    MemoryRegion iomem;
> -    uint32_t readbuff;
> -    uint32_t flags;
> -    uint32_t lcr;
> -    uint32_t rsr;
> -    uint32_t cr;
> -    uint32_t dmacr;
> -    uint32_t int_enabled;
> -    uint32_t int_level;
> -    uint32_t read_fifo[16];
> -    uint32_t ilpr;
> -    uint32_t ibrd;
> -    uint32_t fbrd;
> -    uint32_t ifl;
> -    int read_pos;
> -    int read_count;
> -    int read_trigger;
> -    CharBackend chr;
> -    qemu_irq irq;
> -    const unsigned char *id;
> -} PL011State;
> -
>  #define PL011_INT_TX 0x20
>  #define PL011_INT_RX 0x10
>  
> @@ -357,7 +330,7 @@ static void pl011_luminary_init(Object *obj)
>  }
>  
>  static const TypeInfo pl011_luminary_info = {
> -    .name          = "pl011_luminary",
> +    .name          = TYPE_PL011_LUMINARY,
>      .parent        = TYPE_PL011,
>      .instance_init = pl011_luminary_init,
>  };
> 

  parent reply	other threads:[~2019-02-18 22:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 12:50 [Qemu-devel] [PATCH 00/14] Add model of the Arm Musca devboards Peter Maydell
2019-02-14 12:50 ` [Qemu-devel] [PATCH 01/14] hw/arm/armsse: Fix miswiring of expansion IRQs Peter Maydell
2019-02-17 17:49   ` Richard Henderson
2019-02-14 12:50 ` [Qemu-devel] [PATCH 02/14] hw/misc/tz-ppc: Support having unused ports in the middle of the range Peter Maydell
2019-02-17 17:51   ` Richard Henderson
2019-02-14 12:50 ` [Qemu-devel] [PATCH 03/14] hw/timer/pl031: Allow use as an embedded-struct device Peter Maydell
2019-02-17 17:55   ` Richard Henderson
2019-02-18 21:54   ` Philippe Mathieu-Daudé
2019-02-14 12:50 ` [Qemu-devel] [PATCH 04/14] hw/timer/pl031: Convert to using trace events Peter Maydell
2019-02-17 17:56   ` Richard Henderson
2019-02-18 21:58   ` Philippe Mathieu-Daudé
2019-02-14 12:50 ` [Qemu-devel] [PATCH 05/14] hw/char/pl011: Allow use as an embedded-struct device Peter Maydell
2019-02-17 17:57   ` Richard Henderson
2019-02-18 21:59   ` Philippe Mathieu-Daudé [this message]
2019-02-14 12:50 ` [Qemu-devel] [PATCH 06/14] hw/char/pl011: Support all interrupt lines Peter Maydell
2019-02-17 18:00   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 07/14] hw/char/pl011: Use '0x' prefix when logging hex numbers Peter Maydell
2019-02-17 18:00   ` Richard Henderson
2019-02-18 22:00   ` Philippe Mathieu-Daudé
2019-02-14 12:51 ` [Qemu-devel] [PATCH 08/14] hw/arm/armsse: Document SRAM_ADDR_WIDTH property in header comment Peter Maydell
2019-02-17 18:01   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 09/14] hw/arm/armsse: Allow boards to specify init-svtor Peter Maydell
2019-02-17 18:03   ` Richard Henderson
2019-02-18 22:01   ` Philippe Mathieu-Daudé
2019-02-14 12:51 ` [Qemu-devel] [PATCH 10/14] hw/arm/musca.c: Implement models of the Musca-A and -B1 boards Peter Maydell
2019-02-17 18:09   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 11/14] hw/arm/musca: Add PPCs Peter Maydell
2019-02-17 18:14   ` Richard Henderson
2019-02-17 18:19     ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 12/14] hw/arm/musca: Add MPCs Peter Maydell
2019-02-17 18:17   ` Richard Henderson
2019-02-19 12:29   ` Peter Maydell
2019-02-14 12:51 ` [Qemu-devel] [PATCH 13/14] hw/arm/musca: Wire up PL031 RTC Peter Maydell
2019-02-17 18:20   ` Richard Henderson
2019-02-14 12:51 ` [Qemu-devel] [PATCH 14/14] hw/arm/musca: Wire up PL011 UARTs Peter Maydell
2019-02-17 18:20   ` Richard Henderson

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=2dc24df3-80d4-99ca-891f-31e2f96e5e85@redhat.com \
    --to=philmd@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).