From c8fc681aa2ed5dc5584518d213eeecb2eef7b22c Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Tue, 9 Aug 2016 16:38:13 +1000 Subject: platform: Add BT to Generic platform Instantiate if if it's in the device-tree... Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Stewart Smith --- core/platform.c | 6 ++++++ doc/device-tree/examples/power9-phb4.dts | 6 ++++++ hw/bt.c | 10 +++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/core/platform.c b/core/platform.c index de6e406..de700e7 100644 --- a/core/platform.c +++ b/core/platform.c @@ -23,6 +23,7 @@ #include #include #include +#include struct platform platform; @@ -105,6 +106,11 @@ static void generic_platform_init(void) uart_setup_opal_console(); else force_dummy_console(); + + /* Enable a BT interface if we find one too */ + bt_init(); + + /* Fake a real time clock */ fake_rtc_init(); } diff --git a/doc/device-tree/examples/power9-phb4.dts b/doc/device-tree/examples/power9-phb4.dts index e5743f3..8da1cbc 100644 --- a/doc/device-tree/examples/power9-phb4.dts +++ b/doc/device-tree/examples/power9-phb4.dts @@ -192,6 +192,12 @@ clock-frequency = < 1843200 >; interrupts = <4>; }; + + impi@ie4 { + compatible = "ipmi-bt"; + reg = < 1 0xe4 0x3 >; + interrupts = <10>; + }; }; }; diff --git a/hw/bt.c b/hw/bt.c index 19a34e9..2ecc7d3 100644 --- a/hw/bt.c +++ b/hw/bt.c @@ -26,6 +26,7 @@ #include #include #include +#include /* BT registers */ #define BT_CTRL 0 @@ -379,8 +380,9 @@ static void bt_expire_old_msg(uint64_t tb) bt_msg = list_top(&bt.msgq, struct bt_msg, link); - if (bt_msg && bt_msg->tb > 0 && - (tb_compare(tb, bt_msg->tb + secs_to_tb(bt.caps.msg_timeout)) == TB_AAFTERB)) { + if (bt_msg && bt_msg->tb > 0 && !chip_quirk(QUIRK_SIMICS) && + (tb_compare(tb, bt_msg->tb + + secs_to_tb(bt.caps.msg_timeout)) == TB_AAFTERB)) { if (bt_msg->send_count <= bt.caps.max_retries) { /* A message timeout is usually due to the BMC * clearing the H2B_ATN flag without actually @@ -626,8 +628,10 @@ void bt_init(void) /* We support only one */ n = dt_find_compatible_node(dt_root, NULL, "ipmi-bt"); - if (!n) + if (!n) { + prerror("No BT device\n"); return; + } /* Get IO base */ prop = dt_find_property(n, "reg"); -- cgit v1.1