From 7804c353a9f93c3eeb3eb744ee4c962fd34bc760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Mon, 25 Jul 2016 16:24:41 +0200 Subject: hw/ppc: include fdt helper routine in a common file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: David Gibson --- include/hw/ppc/fdt.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/hw/ppc/fdt.h (limited to 'include') diff --git a/include/hw/ppc/fdt.h b/include/hw/ppc/fdt.h new file mode 100644 index 0000000..fff3e1b --- /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 */ -- cgit v1.1 From ce9863b7978976492efc2b57589516f3fcae79cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Tue, 2 Aug 2016 19:38:00 +0200 Subject: hw/ppc: use error_report instead of fprintf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédric Le Goater Signed-off-by: David Gibson --- include/hw/ppc/fdt.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/hw/ppc/fdt.h b/include/hw/ppc/fdt.h index fff3e1b..2e5c61a 100644 --- a/include/hw/ppc/fdt.h +++ b/include/hw/ppc/fdt.h @@ -10,11 +10,13 @@ #ifndef PPC_FDT_H #define PPC_FDT_H -#define _FDT(exp) \ - do { \ +#include "qemu/error-report.h" + +#define _FDT(exp) \ + do { \ int ret = (exp); \ if (ret < 0) { \ - fprintf(stderr, "qemu: error creating device tree: %s: %s\n", \ + error_report("error creating device tree: %s: %s", \ #exp, fdt_strerror(ret)); \ exit(1); \ } \ -- cgit v1.1 From 3654fa95bc29e72c2eef22f26eb621af1f86feec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Tue, 2 Aug 2016 19:38:01 +0200 Subject: hw/ppc: add a ppc_create_page_sizes_prop() helper routine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The exact same routine will be used in PowerNV. Signed-off-by: Cédric Le Goater Signed-off-by: David Gibson --- include/hw/ppc/fdt.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/hw/ppc/fdt.h b/include/hw/ppc/fdt.h index 2e5c61a..2c68d16 100644 --- a/include/hw/ppc/fdt.h +++ b/include/hw/ppc/fdt.h @@ -12,6 +12,8 @@ #include "qemu/error-report.h" +typedef struct CPUPPCState CPUPPCState; + #define _FDT(exp) \ do { \ int ret = (exp); \ @@ -22,4 +24,7 @@ } \ } while (0) +size_t ppc_create_page_sizes_prop(CPUPPCState *env, uint32_t *prop, + size_t maxsize); + #endif /* PPC_FDT_H */ -- cgit v1.1