Add IPL observer support for RaptorCS Blackbird
Signed-off-by: Stewart Smith <stewart@flamingspork.com>
diff --git a/openpower/configs/blackbird_defconfig b/openpower/configs/blackbird_defconfig
index daa1fe0..d2fb5cd 100644
--- a/openpower/configs/blackbird_defconfig
+++ b/openpower/configs/blackbird_defconfig
@@ -1,5 +1,6 @@
BR2_powerpc64le=y
BR2_powerpc_power8=y
+BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_OP_BUILD_PATH)/patches/blackbird-patches"
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
BR2_GCC_VERSION_6_X=y
diff --git a/openpower/overlay/etc/init.d/S99signal-linux-complete b/openpower/overlay/etc/init.d/S99signal-linux-complete
new file mode 100755
index 0000000..daf81fd
--- /dev/null
+++ b/openpower/overlay/etc/init.d/S99signal-linux-complete
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright © 2020 Stewart Smith
+# Released under the GNU GPL v3
+
+COMPAT_NODE=/sys/bus/platform/devices/ibm,opal:oppanel/of_node/compatible
+
+case "$1" in
+ start)
+ # Only talk to the rcs,ipl-observer device this way
+ # it's a little bit of a hack, but it's functionally
+ # equivalent to the Raptor build but not relying on debugfs
+ grep rcs,ipl-observer $COMPAT_NODE > /dev/null \
+ && printf '\xfe\xfe\xfe' > /dev/op_panel
+ ;;
+esac
+
+exit 0
diff --git a/openpower/patches/blackbird-patches/hostboot/0001-Add-detailed-ISTEP-output-option-to-hostboot.patch b/openpower/patches/blackbird-patches/hostboot/0001-Add-detailed-ISTEP-output-option-to-hostboot.patch
new file mode 100644
index 0000000..67baa48
--- /dev/null
+++ b/openpower/patches/blackbird-patches/hostboot/0001-Add-detailed-ISTEP-output-option-to-hostboot.patch
@@ -0,0 +1,71 @@
+From d90e6c513094231f622a427030f3dbca1eeb5ed5 Mon Sep 17 00:00:00 2001
+From: Timothy Pearson <tpearson@raptorengineering.com>
+Date: Thu, 18 Apr 2019 06:28:50 +0000
+Subject: [PATCH] Add detailed ISTEP output option to hostboot
+
+Output detailed ISTEP data over LPC port 81h/82h in support of RCS
+Talos II systems. These systems will deadlock due to FSI silicon bugs
+in the CPUs unless the BMC is aware of the current ISTEP data in order
+to properly sequence BMC-side FSI service startup.
+---
+ src/usr/initservice/istepdispatcher/HBconfig | 5 ++++
+ .../istepdispatcher/istepdispatcher.C | 27 +++++++++++++++++++
+ 2 files changed, 32 insertions(+)
+
+diff --git a/src/usr/initservice/istepdispatcher/HBconfig b/src/usr/initservice/istepdispatcher/HBconfig
+index 7987f8ef3..ccbd43854 100644
+--- a/src/usr/initservice/istepdispatcher/HBconfig
++++ b/src/usr/initservice/istepdispatcher/HBconfig
+@@ -21,6 +21,11 @@ config ISTEP_LPC_PORT80_DEBUG
+ help
+ Writes ISTEP progress to LPC port 80h.
+
++config ISTEP_LPC_PORT8X_DEBUG
++ default n
++ help
++ Writes detailed ISTEP progress to LPC port 81h / 82h.
++
+ config HANG_ON_MFG_SRC_TERM
+ default y
+ help
+diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
+index e8db88f33..8f2d57298 100644
+--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
++++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
+@@ -2521,6 +2521,33 @@ errlHndl_t IStepDispatcher::sendProgressCode(bool i_needsLock)
+ port80_val++;
+ #endif
+
++#ifdef CONFIG_ISTEP_LPC_PORT8X_DEBUG
++ // Detailed istep output for consumption by BMC on e.g. RCS Talos II systems.
++ //
++ // Due to FSI silicon issues, those platforms may fail to start correctly
++ // if the BMC is not aware of the exact ISTEP being run to control BMC
++ // service sequencing.
++ //
++ // NEVER output fake values here, only real ISTEP data.
++ // Data is latched in on write to port 82h
++ uint8_t port81_val = iv_curIStep & 0xff;
++ uint8_t port82_val = iv_curSubStep & 0xff;
++ size_t port81_len = sizeof(port81_val);
++ size_t port82_len = sizeof(port82_val);
++ // Write port 81h first
++ err = deviceWrite(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
++ &port81_val, port81_len,
++ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, 0x81));
++ delete err; // this is debug only, ignore any errors
++ err = NULL;
++ // Then write port 82h, latching in the full 16-bit value for read
++ err = deviceWrite(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
++ &port82_val, port82_len,
++ DEVICE_LPC_ADDRESS(LPC::TRANS_IO, 0x82));
++ delete err; // this is debug only, ignore any errors
++ err = NULL;
++#endif
++
+ #ifdef CONFIG_CONSOLE_OUTPUT_PROGRESS
+ //--- Display step on serial console
+ if ((iv_curIStep != lastIstep) || (iv_curSubStep != lastSubstep))
+--
+2.23.0
+