[Skiboot] [PATCH 5/6] plat/qemu: initialize as an astbmc if a bt device is available
Cédric Le Goater
clg at fr.ibm.com
Thu Apr 7 02:30:11 AEST 2016
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 <clg at fr.ibm.com>
---
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 <console.h>
#include <opal.h>
#include <psi.h>
+#include <ipmi.h>
#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,
};
--
2.1.4
More information about the Skiboot
mailing list