greatlakes: support SoL on multi-host
Description:
- Support Meta greatlakes SoL on multi-host
Design:
- We designed by 4 clients on port 2200~2203 represents Host1 ~ Host4,
and 4 clients on port 2300~2303 represents BIC1 ~ BIC4, the clients will
use socket-id to connect to corresponding server.
- For switching between Host/BIC, each client will manipulate the UART
mux by the cpld driver before connect to the server. The script for
switching the mux can be implemented in project layer.
Limitation:
- Since the CPLD device driver is not ready yet, we currently use raw
commands (i2ctransfer) to manipulate the register value, we will adapt
to the interface on CPLD device drvier when it's ready.
Issue:
- None
Test Case:
1. Check ssh -p 2200 ${ip} should successfully connect to Slot 1 Host.
- pass
2. Check ssh -p 2300 ${ip} should successfully connect to Slot 1 BIC.
- pass
3. Check ssh -p 2201 ${ip} should successfully connect to Slot 2 Host.
- pass
4. Check ssh -p 2301 ${ip} should successfully connect to Slot 2 BIC.
- pass
5. Check ssh -p 2202 ${ip} should successfully connect to Slot 3 Host.
- pass
6. Check ssh -p 2302 ${ip} should successfully connect to Slot 3 BIC.
- pass
7. Check ssh -p 2203 ${ip} should successfully connect to Slot 4 Host.
- pass
8. Check ssh -p 2303 ${ip} should successfully connect to Slot 4 BIC.
- pass
Change-Id: I3ebe12d4cabb01b401220c053cced089141e79e8
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
diff --git a/meta-facebook/meta-greatlakes/recipes-phosphor/console/obmc-console/select-uart-mux b/meta-facebook/meta-greatlakes/recipes-phosphor/console/obmc-console/select-uart-mux
new file mode 100644
index 0000000..40b8401
--- /dev/null
+++ b/meta-facebook/meta-greatlakes/recipes-phosphor/console/obmc-console/select-uart-mux
@@ -0,0 +1,61 @@
+#!/bin/sh
+# Select UART Mux: UART Mux for switching between Host and BIC on Slot1 ~ Slot4
+# Usage: select-uart-mux <slot1|slot2|slot3|slot4> <host|bic>
+
+REG_OFFSET="0x01"
+input_slot=$1
+input_target=$2
+i2c_bus_id=
+
+show_usage() {
+ echo "Usage: select-uart-mux [ slot1 | slot2 | slot3 | slot4 ] [ host | bic ]"
+ echo "Select UART Mux"
+}
+
+if [ $# -gt 3 ]; then
+ show_usage
+ exit 255
+fi
+
+case $input_slot in
+ slot1)
+ i2c_bus_id="4"
+ ;;
+ slot2)
+ i2c_bus_id="5"
+ ;;
+ slot3)
+ i2c_bus_id="6"
+ ;;
+ slot4)
+ i2c_bus_id="7"
+ ;;
+ *)
+ echo "Slot must between 1 to 4."
+ show_usage
+ exit 255
+ ;;
+ esac
+
+case $input_target in
+ host)
+ reg_val="0x03"
+ ;;
+ bic)
+ reg_val="0x04"
+ ;;
+ *)
+ echo "Input must be host or bic."
+ show_usage
+ exit 255
+ esac
+
+i2ctransfer -y -f $i2c_bus_id w2@0x0f $REG_OFFSET $reg_val
+
+val=$(i2ctransfer -y -f $i2c_bus_id w1@0x0f $REG_OFFSET r1)
+ret=$?
+
+if [ $ret -ne 0 ] || [ "$val" != $reg_val ]; then
+ echo "Failed to modify the register value, the register value is $val instead of $reg_val."
+ exit 255
+fi
diff --git a/meta-facebook/meta-greatlakes/recipes-phosphor/console/obmc-console_%.bbappend b/meta-facebook/meta-greatlakes/recipes-phosphor/console/obmc-console_%.bbappend
new file mode 100644
index 0000000..461c2bf
--- /dev/null
+++ b/meta-facebook/meta-greatlakes/recipes-phosphor/console/obmc-console_%.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI:append:greatlakes = " file://select-uart-mux"
+
+do_install:append:greatlakes() {
+ install -m 0744 ${WORKDIR}/select-uart-mux ${D}${bindir}
+}