From patchwork Mon Jul 25 14:24:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 652302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ryk8n6Rprz9t1X for ; Tue, 26 Jul 2016 00:26:49 +1000 (AEST) Received: from localhost ([::1]:60963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRgqF-0003Fu-AB for incoming@patchwork.ozlabs.org; Mon, 25 Jul 2016 10:26:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRgox-0002Mz-CO for qemu-devel@nongnu.org; Mon, 25 Jul 2016 10:25:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRgou-00025W-S0 for qemu-devel@nongnu.org; Mon, 25 Jul 2016 10:25:26 -0400 Received: from 18.mo1.mail-out.ovh.net ([46.105.35.72]:52362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRgou-00025C-HC for qemu-devel@nongnu.org; Mon, 25 Jul 2016 10:25:24 -0400 Received: from player726.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 05287FF8D2A for ; Mon, 25 Jul 2016 16:25:24 +0200 (CEST) Received: from hermes.ibm.com (LFbn-1-2234-107.w90-76.abo.wanadoo.fr [90.76.55.107]) (Authenticated sender: clg@kaod.org) by player726.ha.ovh.net (Postfix) with ESMTPSA id B26352A007B; Mon, 25 Jul 2016 16:25:18 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Mon, 25 Jul 2016 16:24:41 +0200 Message-Id: <1469456683-25891-2-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1469456683-25891-1-git-send-email-clg@kaod.org> References: <1469456683-25891-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 2401263030612954086 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeltddriedugdejhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 46.105.35.72 Subject: [Qemu-devel] [PATCH 1/3] hw/ppc: include fdt helper routine in a common file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- hw/ppc/spapr.c | 11 +---------- hw/ppc/spapr_events.c | 11 +---------- include/hw/ppc/fdt.h | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 include/hw/ppc/fdt.h diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9193ac2c122b..538ff5a46768 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -47,6 +47,7 @@ #include "hw/ppc/ppc.h" #include "hw/loader.h" +#include "hw/ppc/fdt.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/pci-host/spapr.h" @@ -299,16 +300,6 @@ static hwaddr spapr_node0_size(void) return machine->ram_size; } -#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) - static void add_str(GString *s, const gchar *s1) { g_string_append_len(s, s1, strlen(s1) + 1); diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index b0668b34a927..4c7b6aeab630 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -32,6 +32,7 @@ #include "hw/qdev.h" #include "sysemu/device_tree.h" +#include "hw/ppc/fdt.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" #include "hw/pci/pci.h" @@ -210,16 +211,6 @@ struct hp_log_full { #define EVENT_MASK_HOTPLUG 0x10000000 #define EVENT_MASK_IO 0x08000000 -#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) - void spapr_events_fdt_skel(void *fdt, uint32_t check_exception_irq) { uint32_t irq_ranges[] = {cpu_to_be32(check_exception_irq), cpu_to_be32(1)}; diff --git a/include/hw/ppc/fdt.h b/include/hw/ppc/fdt.h new file mode 100644 index 000000000000..fff3e1b57763 --- /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 */