[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 30/31] dt: Add global option to set phandle start offs
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 30/31] dt: Add global option to set phandle start offset |
Date: |
Wed, 6 Jun 2012 01:53:21 +0200 |
If anyone outside of QEMU wants to mess with a QEMU generated device tree,
he needs to know which range phandles are valid in. So let's expose a
machine option that an external program can use to set the start allocate
id for phandles in QEMU.
Signed-off-by: Alexander Graf <address@hidden>
---
device_tree.c | 27 ++++++++++++++++++++++++++-
qemu-config.c | 4 ++++
2 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index a2039e5..5bbe3cd 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -22,6 +22,7 @@
#include "qemu-common.h"
#include "device_tree.h"
#include "hw/loader.h"
+#include "sysemu.h"
#include <libfdt.h>
@@ -229,7 +230,31 @@ int qemu_devtree_setprop_phandle(void *fdt, const char
*node_path,
uint32_t qemu_devtree_alloc_phandle(void *fdt)
{
- static int phandle = 0x8000;
+ static int phandle = 0x0;
+
+ /*
+ * We need to find out if the user gave us special instruction at
+ * which phandle id to start allocting phandles.
+ */
+ if (!phandle) {
+ QemuOpts *machine_opts;
+ machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
+ if (machine_opts) {
+ const char *phandle_start;
+ phandle_start = qemu_opt_get(machine_opts, "phandle_start");
+ if (phandle_start) {
+ phandle = strtoul(phandle_start, NULL, 0);
+ }
+ }
+ }
+
+ if (!phandle) {
+ /*
+ * None of invalid phandle given on the command line, so fall back to
+ * default starting point.
+ */
+ phandle = 0x8000;
+ }
return phandle++;
}
diff --git a/qemu-config.c b/qemu-config.c
index ef4714e..a96b247 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -586,6 +586,10 @@ static QemuOptsList qemu_machine_opts = {
.name = "dumpdtb",
.type = QEMU_OPT_STRING,
.help = "Dump current dtb to a file and quit",
+ }, {
+ .name = "phandle_start",
+ .type = QEMU_OPT_STRING,
+ .help = "The first phandle ID we may generate dynamically",
},
{ /* End of list */ }
},
--
1.6.0.2
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, (continued)
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Peter Crosthwaite, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Peter Crosthwaite, 2012/06/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/19
[Qemu-ppc] [PATCH 03/31] dt: add helper for phandle references, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 14/31] PPC: e500: dt: create /chosen node dynamically, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 11/31] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 15/31] PPC: e500: dt: create /soc8544 node dynamically, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 30/31] dt: Add global option to set phandle start offset,
Alexander Graf <=
[Qemu-ppc] [PATCH 29/31] PPC: e500: Extend address/size of / to 64bit, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 01/31] dt: allow add_subnode to create root subnodes, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 16/31] PPC: e500: dt: create serial nodes dynamically, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 19/31] PPC: e500: dt: create pci node dynamically, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 28/31] PPC: e500: Define addresses as always 64bit, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 06/31] dt: add helper for empty dt creation, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 07/31] dt: add helper for phandle allocation, Alexander Graf, 2012/06/05