From nobody Sat Nov 8 10:41:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550150095666298.56807266692283; Thu, 14 Feb 2019 05:14:55 -0800 (PST) Received: from localhost ([127.0.0.1]:48426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guGqo-0004ZT-JQ for importer@patchew.org; Thu, 14 Feb 2019 08:14:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guGeS-0002tV-29 for qemu-devel@nongnu.org; Thu, 14 Feb 2019 08:02:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guGU0-0006Uj-KZ for qemu-devel@nongnu.org; Thu, 14 Feb 2019 07:51:18 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:38286) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guGU0-0006Tn-Aa for qemu-devel@nongnu.org; Thu, 14 Feb 2019 07:51:16 -0500 Received: by mail-wr1-x444.google.com with SMTP id v13so6343987wrw.5 for ; Thu, 14 Feb 2019 04:51:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j3sm1488073wmb.39.2019.02.14.04.51.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 04:51:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1OLWN1Os/7gGDPurXe5cQamlogPhIwB9LbNuZjXBuKI=; b=lJpNLusDpQh2PHjl/4+ywixCD1ZJT8eezUQkNViObLwuuvQBjT/L1xNnqIK8p1aGoa z+7NGf2bU7yJRRWYRlbo8peZ5jboTUY50DEzI9kU88JM24elAwrezjARbH40do8RhJse 6/DUxbhtEDHlTJyr7IQrexHv/2jvpEZqOlSOu/i5esjeFPq344SFFHWNPb8b7Zp5M200 i26uBp0ZhNTEULGWAHCVzPX05ObqhJ3xUN+KKRJm03j/kMmBNkjnziPLhRCdgOaDsPIG +hSXKcxPugQBvVevviu9h/K7kdjtCN3H/qSvdLPEe6f6JAufQsHyTz+nnumfEajcHULj WMpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1OLWN1Os/7gGDPurXe5cQamlogPhIwB9LbNuZjXBuKI=; b=dASPABz2ouDpYnoMY0s6VxXgizBJyUM6k3ur2e7SpAu8OMp1EBpsR9epagQjDS7XYH ZxLbL9yj3o49DWLlXq+1BWwsK2O3f+MvVEBLVY2L1rEfPHN9n2CowY/npJ6z5wHeS0oL gTN0PDUAIzh57u4fgg+cXMhajy6ArmLu3RmJI7JW4EgnJ9xzensHt1fIkarnFeJM1ZZs l3BsBJoW6wSPv76gIm4oOXJcReP8y5sinpERSNotzmsGy6cyfBBD1TJ6e5o9+4QgDykK 9zbeHmZvZOAsjyqn7j1r5YcbopyjOgy9BwylWM7AGAnckXel2mvvlvozUcGuWNO30mTY xhdw== X-Gm-Message-State: AHQUAuYldaGSwB4XjUd/sQDOM0Zwmr2UfWy+haDsG8AX+GWwXJSCviDP VTRxOZXyDt71us8kBS4vbzkzeA== X-Google-Smtp-Source: AHgI3Ian8aZkei2dU7yGnU6bv/Rr2iM818Ac5w+1BY9+4zno94j54x0kqkiGPAzSGFdsl5NpZxWVsQ== X-Received: by 2002:adf:fc87:: with SMTP id g7mr2710183wrr.136.1550148675171; Thu, 14 Feb 2019 04:51:15 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 14 Feb 2019 12:50:58 +0000 Message-Id: <20190214125107.22178-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214125107.22178-1-peter.maydell@linaro.org> References: <20190214125107.22178-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH 05/14] hw/char/pl011: Allow use as an embedded-struct device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- 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 =20 +#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 @@ */ =20 #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" =20 -#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 =20 @@ -357,7 +330,7 @@ static void pl011_luminary_init(Object *obj) } =20 static const TypeInfo pl011_luminary_info =3D { - .name =3D "pl011_luminary", + .name =3D TYPE_PL011_LUMINARY, .parent =3D TYPE_PL011, .instance_init =3D pl011_luminary_init, }; --=20 2.20.1