From: Baptiste Reynal <b.reynal@virtualopensystems.com>
To: kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org,
eric.auger@linaro.org
Cc: a.motakis@virtualopensystems.com, tech@virtualopensystems.com,
Baptiste Reynal <b.reynal@virtualopensystems.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [RFC PATCH 1/3] hw/vfio/sysbus-fdt: generic add_generic_fdt_node
Date: Wed, 17 Dec 2014 11:09:39 +0100 [thread overview]
Message-ID: <1418810981-9193-2-git-send-email-b.reynal@virtualopensystems.com> (raw)
In-Reply-To: <1418810981-9193-1-git-send-email-b.reynal@virtualopensystems.com>
Modify add_calxeda_midway_xgmac_fdt_node to make it more generic.
Add multiple compatible strings support.
Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
---
hw/arm/sysbus-fdt.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
index 15bb50c..125ba37 100644
--- a/hw/arm/sysbus-fdt.c
+++ b/hw/arm/sysbus-fdt.c
@@ -58,12 +58,12 @@ typedef struct NodeCreationPair {
/* Device Specific Code */
/**
- * add_calxeda_midway_xgmac_fdt_node
+ * add_device_fdt_node
*
* Generates a very simple node with following properties:
* compatible string, regs, interrupts
*/
-static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
+static int add_generic_fdt_node(SysBusDevice *sbdev, void *opaque)
{
PlatformBusFdtData *data = opaque;
PlatformBusDevice *pbus = data->pbus;
@@ -80,6 +80,18 @@ static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
VFIODevice *vbasedev = &vdev->vbasedev;
Object *obj = OBJECT(sbdev);
+ /*
+ * Process compatible string to deal with multiple strings
+ * (; is replaced by \0)
+ */
+ char *compat = g_strdup(vdev->compat);
+ compat_str_len = strlen(compat) + 1;
+
+ char *semicolon = compat;
+ while ((semicolon = strchr(semicolon, ';')) != NULL) {
+ *semicolon = '\0';
+ }
+
mmio_base = object_property_get_int(obj, "mmio[0]", NULL);
nodename = g_strdup_printf("%s/%s@%" PRIx64, parent_node,
@@ -88,9 +100,8 @@ static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
qemu_fdt_add_subnode(fdt, nodename);
- compat_str_len = strlen(vdev->compat) + 1;
qemu_fdt_setprop(fdt, nodename, "compatible",
- vdev->compat, compat_str_len);
+ compat, compat_str_len);
reg_attr = g_new(uint64_t, vbasedev->num_regions*4);
@@ -140,7 +151,7 @@ fail:
/* list of supported dynamic sysbus devices */
static const NodeCreationPair add_fdt_node_functions[] = {
-{TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_node},
+{TYPE_VFIO_CALXEDA_XGMAC, add_generic_fdt_node},
{"", NULL}, /*last element*/
};
--
2.1.3
next prev parent reply other threads:[~2014-12-17 10:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 10:09 [Qemu-devel] [RFC PATCH 0/3] VFIO support for AMBA devices Baptiste Reynal
2014-12-17 10:09 ` Baptiste Reynal [this message]
2014-12-17 13:32 ` [Qemu-devel] [RFC PATCH 1/3] hw/vfio/sysbus-fdt: generic add_generic_fdt_node Eric Auger
2014-12-17 14:55 ` Baptiste Reynal
2014-12-17 17:15 ` Eric Auger
2014-12-17 10:09 ` [Qemu-devel] [RFC PATCH 2/3] hw/vfio: amba device support Baptiste Reynal
2014-12-17 13:57 ` Eric Auger
2014-12-17 10:09 ` [Qemu-devel] [RFC PATCH 3/3] hw/vfio: add pl330 " Baptiste Reynal
2014-12-17 13:04 ` [Qemu-devel] [RFC PATCH 0/3] VFIO support for AMBA devices Eric Auger
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=1418810981-9193-2-git-send-email-b.reynal@virtualopensystems.com \
--to=b.reynal@virtualopensystems.com \
--cc=a.motakis@virtualopensystems.com \
--cc=eric.auger@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=tech@virtualopensystems.com \
/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).