From 2f0b6af6e01c5f7b3c762647d06c4f792e2cb3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Wed, 12 Dec 2018 09:25:26 +0100 Subject: plat/qemu: fix platform initialization when the BT device is not present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A QEMU PowerNV machine does not necessarily have a BT device. It needs to be defined on the command line with : -device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10 When the QEMU platform is initialized by skiboot, we need to check that such a device is present and if not, skip the AST initialization. Fixes: 8340a9642bba ("plat/qemu: use the common OpenPOWER routines to initialize") Signed-off-by: Cédric Le Goater Signed-off-by: Stewart Smith --- platforms/qemu/qemu.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c index 3162313..7ba7f26 100644 --- a/platforms/qemu/qemu.c +++ b/platforms/qemu/qemu.c @@ -15,26 +15,45 @@ */ #include +#include #include #include #include +static bool bt_device_present; static bool qemu_probe(void) { + struct dt_node *n; + if (!dt_node_is_compatible(dt_root, "qemu,powernv")) return false; astbmc_early_init(); + /* check if the BT device was defined by QEMU */ + dt_for_each_child(dt_root, n) { + if (dt_node_is_compatible(n, "bt")) + bt_device_present = true; + } + return true; } +static void qemu_init(void) +{ + if (!bt_device_present) { + set_opal_console(&uart_opal_con); + } else { + astbmc_init(); + } +} + DECLARE_PLATFORM(qemu) = { .name = "Qemu", .probe = qemu_probe, - .init = astbmc_init, + .init = qemu_init, .external_irq = astbmc_ext_irq_serirq_cpld, .cec_power_down = astbmc_ipmi_power_down, .cec_reboot = astbmc_ipmi_reboot, -- cgit v1.1