From patchwork Wed Sep 7 10:28:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9318875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C28A6077F for ; Wed, 7 Sep 2016 10:37:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17C5D29222 for ; Wed, 7 Sep 2016 10:37:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C6E329226; Wed, 7 Sep 2016 10:37:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE19F29222 for ; Wed, 7 Sep 2016 10:37:56 +0000 (UTC) Received: from localhost ([::1]:39398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhaEt-0003D8-IN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Sep 2016 06:37:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bha5a-0002Zd-Th for qemu-devel@nongnu.org; Wed, 07 Sep 2016 06:28:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bha5V-0004Zk-Hp for qemu-devel@nongnu.org; Wed, 07 Sep 2016 06:28:17 -0400 Received: from ozlabs.org ([103.22.144.67]:49918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bha5V-0004ZS-6R; Wed, 07 Sep 2016 06:28:13 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3sTfn62lJYz9s9Y; Wed, 7 Sep 2016 20:28:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1473244090; bh=/HL3TjQK3cYs2agpeWsnmyBYGfRQ4YaZd/ZR7hNv5Lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G8aYV01WcfysZVpH/6wMMiobzL/CHKc8m3bfhstY+Yr7PzgksTmSKOTvazhrhZmty hfMPw+c59pFmwVn+O/kLFld5S5HTCXWTb3DxBuUj/lMYZA6+8AZa1wdOdafayw/zRk vs6/AQoS6KFds60alDELaS66CrKtlAofPSN7z1Tw= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 7 Sep 2016 20:28:41 +1000 Message-Id: <1473244183-31510-3-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473244183-31510-1-git-send-email-david@gibson.dropbear.id.au> References: <1473244183-31510-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 02/64] 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: lvivier@redhat.com, thuth@redhat.com, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cédric Le Goater 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 --- 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 30d6800..79d136d 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 b0668b3..4c7b6ae 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 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 */