aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2016-07-25 16:24:41 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-09-07 09:52:14 +1000
commit7804c353a9f93c3eeb3eb744ee4c962fd34bc760 (patch)
treedc102592eeb9fe223a8e6c889a57b78b5e02168e /include
parent1b1746a4368c960652ca7e4a36aea8a65fa9f319 (diff)
hw/ppc: include fdt helper routine in a common file
spapr_pci would also be a good candidate but the macro _FDT is slightly different. It returns and does not exit. Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'include')
-rw-r--r--include/hw/ppc/fdt.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/hw/ppc/fdt.h b/include/hw/ppc/fdt.h
new file mode 100644
index 0000000000..fff3e1b577
--- /dev/null
+++ b/include/hw/ppc/fdt.h
@@ -0,0 +1,23 @@
+/*
+ * QEMU PowerPC helper routines for the device tree.
+ *
+ * Copyright (C) 2016 IBM Corp.
+ *
+ * This code is licensed under the GPL version 2 or later. See the
+ * COPYING file in the top-level directory.
+ */
+
+#ifndef PPC_FDT_H
+#define PPC_FDT_H
+
+#define _FDT(exp) \
+ do { \
+ int ret = (exp); \
+ if (ret < 0) { \
+ fprintf(stderr, "qemu: error creating device tree: %s: %s\n", \
+ #exp, fdt_strerror(ret)); \
+ exit(1); \
+ } \
+ } while (0)
+
+#endif /* PPC_FDT_H */