From patchwork Wed Apr 6 16:30:11 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: 607094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qgB6s2DBFz9sBc for ; Thu, 7 Apr 2016 02:31:01 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3qgB6s19vCzDqGW for ; Thu, 7 Apr 2016 02:31:01 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3qgB6P5KBlzDqB2 for ; Thu, 7 Apr 2016 02:30:37 +1000 (AEST) Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Apr 2016 17:30:34 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 6 Apr 2016 17:30:31 +0100 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: clg@fr.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5CF59219005E for ; Wed, 6 Apr 2016 17:30:10 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u36GUUsu7405946 for ; Wed, 6 Apr 2016 16:30:30 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u36GUUd5005605 for ; Wed, 6 Apr 2016 10:30:30 -0600 Received: from hermes.ibm.com (icon-9-164-133-253.megacenter.de.ibm.com [9.164.133.253]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u36GUOYb005259; Wed, 6 Apr 2016 10:30:29 -0600 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: skiboot@lists.ozlabs.org Date: Wed, 6 Apr 2016 18:30:11 +0200 Message-Id: <1459960212-23890-6-git-send-email-clg@fr.ibm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459960212-23890-1-git-send-email-clg@fr.ibm.com> References: <1459960212-23890-1-git-send-email-clg@fr.ibm.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16040616-0041-0000-0000-000011391BB8 Subject: [Skiboot] [PATCH 5/6] plat/qemu: initialize as an astbmc if a bt device is available X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" BT devices are defined on the qemu command line and the device tree is populated in consequence. This patch checks if such a device is available when the platform is probed. If this is the case, initialization is done as it would have been with a real AST BMC. The IPMI power/reboot operations can also be used, they are protected by ipmi_present() when no BT device is available. Signed-off-by: Cédric Le Goater --- It seems complex to "hardcode" a BT device in a PowerNV guest due to the way it is defined in qemu and also because qemu maintainers rather have devices defined on the command line. platforms/astbmc/qemu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/platforms/astbmc/qemu.c b/platforms/astbmc/qemu.c index 7b72ea668d7d..11d3a99339d8 100644 --- a/platforms/astbmc/qemu.c +++ b/platforms/astbmc/qemu.c @@ -21,11 +21,22 @@ #include #include #include +#include #include "astbmc.h" +static bool has_bt_device; + static void qemu_init(void) { + /* The BT device is available, so we can initialize as if a + * real AST BMC was here. + */ + if (has_bt_device) { + astbmc_init(); + return; + } + /* Setup UART console for use by Linux via OPAL API */ if (!dummy_console_enabled()) uart_setup_opal_console(); @@ -60,12 +71,19 @@ static void qemu_dt_fixup_rtc(struct dt_node *lpc) static void qemu_dt_fixup(void) { struct dt_node *primary_lpc = astbmc_get_primary_lpc(); + struct dt_node *bt; if (!primary_lpc) return; qemu_dt_fixup_rtc(primary_lpc); astbmc_fixup_dt_uart(primary_lpc); + + /* check if the BT device was defined by qemu */ + dt_for_each_child(primary_lpc, bt) { + if (dt_node_is_compatible(bt, "bt")) + has_bt_device = true; + } } static bool qemu_probe(void) @@ -93,4 +111,7 @@ DECLARE_PLATFORM(qemu) = { .probe = qemu_probe, .init = qemu_init, .external_irq = astbmc_ext_irq_serirq_cpld, + .cec_power_down = astbmc_ipmi_power_down, + .cec_reboot = astbmc_ipmi_reboot, + .terminate = ipmi_terminate, };