[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 60/72] dt: Add global option to set phandle start offs
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 60/72] dt: Add global option to set phandle start offset |
Date: |
Sun, 24 Jun 2012 01:07:24 +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 | 28 +++++++++++++++++++++++++++-
qemu-config.c | 4 ++++
2 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/device_tree.c b/device_tree.c
index cc83f0f..acae53e 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -22,6 +22,8 @@
#include "qemu-common.h"
#include "device_tree.h"
#include "hw/loader.h"
+#include "qemu-option.h"
+#include "qemu-config.h"
#include <libfdt.h>
@@ -200,7 +202,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 or 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 5bbebaf..2cd2726 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -587,6 +587,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
- [Qemu-ppc] [PATCH 37/72] dt: add helper for phandle allocation, (continued)
- [Qemu-ppc] [PATCH 37/72] dt: add helper for phandle allocation, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 38/72] dt: add helper for 64bit cell adds, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 41/72] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 26/72] ppc64: Rudimentary Support for extra page sizes on server CPUs, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 40/72] PPC: e500: dt: create memory node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 59/72] PPC: e500: Extend address/size of / to 64bit, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 67/72] PPC: BookE: Implement EPR SPR, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 64/72] uImage: increase the gzip load size, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 62/72] dt: make setprop argument static, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 69/72] PPC: Add e5500 CPU target, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 60/72] dt: Add global option to set phandle start offset,
Alexander Graf <=
- [Qemu-ppc] [PATCH 58/72] PPC: e500: Define addresses as always 64bit, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 39/72] PPC: e500: require libfdt, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 42/72] PPC: e500: dt: create /hypervisor node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 35/72] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 50/72] PPC: e500: dt: start with empty device tree, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 30/72] raw-posix: Fix build without is_allocated support, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 68/72] PPC: BookE: Make ivpr selectable by CPU type, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 47/72] PPC: e500: dt: create mpic node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 72/72] PPC: BookE206: Bump MAS2 to 64bit, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 71/72] PPC: BookE: Support 32 and 64 bit wide MAS2, Alexander Graf, 2012/06/23