[Skiboot] [PATCH 2/8] platform: Add BT to Generic platform

Benjamin Herrenschmidt benh at kernel.crashing.org
Sun Jul 3 10:50:12 AEST 2016


Instantiate if if it's in the device-tree...

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 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 <chip.h>
 #include <xscom.h>
 #include <errorlog.h>
+#include <bt.h>
 
 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 2806914..ba5009f 100644
--- a/doc/device-tree/examples/power9-phb4.dts
+++ b/doc/device-tree/examples/power9-phb4.dts
@@ -193,6 +193,12 @@
 			clock-frequency = < 1843200 >;
 			interrupts = <4>;
 		    };
+
+		    impi at 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 <timer.h>
 #include <ipmi.h>
 #include <timebase.h>
+#include <chip.h>
 
 /* 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");
-- 
2.7.4



More information about the Skiboot mailing list