diff options
author | Chau Ly <chaul@amperecomputing.com> | 2023-10-18 17:02:04 +0300 |
---|---|---|
committer | Thang Q. Nguyen <thang@os.amperecomputing.com> | 2023-11-14 06:36:42 +0300 |
commit | b6eaef491c2e3475ca42d41caae585d7eeda55ee (patch) | |
tree | 780a4f57a0b6a6e4a1aca551b3c718b811fecbb9 /meta-ampere/meta-common/recipes-phosphor/console | |
parent | 31ffcfb0d17e804bc3098a59f8ac91620f1c17fd (diff) | |
download | openbmc-b6eaef491c2e3475ca42d41caae585d7eeda55ee.tar.xz |
meta-ampere: console: refactor configuration
Refactor console configuration for Mt.Jade and Mt.Mitchell to avoid
duplication and make the configuration files simpler.
Tested:
1. IPMI sol on Mt.Jade and Mt.Mitchell works
2. SOL SSH on Mt.Jade and Mt.Mitchell work for all console ports
Change-Id: I68d1a3c6be530ca93f8adc1dd61906ba8b206dc5
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Diffstat (limited to 'meta-ampere/meta-common/recipes-phosphor/console')
3 files changed, 87 insertions, 0 deletions
diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh new file mode 100644 index 0000000000..6976263aa5 --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Ampere Computing LLC: UART MUX/DEMUX for CPU0 UART0,1,4 and CPU1 UART1 +# Usage: ampere_uartmux_ctrl.sh <CPU UART port number> <UARTx_MODE> +# <UARTx_MODE> of 1 sets CPU To HDR_CONN +# <UARTx_MODE> of 2 sets BMC to CPU (eg dropbear ssh server on port 2200) +# +# This can be called to set uart mux manually + +# shellcheck disable=SC2046 + +if [ $# -lt 2 ]; then + exit 1 +fi + +case "$1" in + 1) GPIO_UARTx_MODE0="uart1-mode0" + GPIO_UARTx_MODE1="uart1-mode1" + ;; + 2) GPIO_UARTx_MODE0="uart2-mode0" + GPIO_UARTx_MODE1="uart2-mode1" + ;; + 3) GPIO_UARTx_MODE0="uart3-mode0" + GPIO_UARTx_MODE1="uart3-mode1" + ;; + 4) GPIO_UARTx_MODE0="uart4-mode0" + GPIO_UARTx_MODE1="uart4-mode1" + ;; + *) echo "Invalid UART port selection" + exit 1 + ;; +esac + +echo "Ampere UART MUX CTRL UART port $1 to mode $2" + +case "$2" in + # To HDR + 1) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=1 + gpioset $(gpiofind "$GPIO_UARTx_MODE1")=0 + exit 0 + ;; + # To BMC + 2) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=0 + gpioset $(gpiofind "$GPIO_UARTx_MODE1")=1 + exit 0 + ;; + *) echo "Invalid UART mode selection" + exit 1 + ;; +esac diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service new file mode 100644 index 0000000000..64d443ff7d --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service @@ -0,0 +1,10 @@ +[Unit] +Description=%i Console Server +ConditionPathExists=/etc/obmc-console/server.%i.conf + +[Service] +# Instance ID is the VUART basename +ExecStartPre=/usr/sbin/ampere_uart_console_setup.sh %i +ExecStart=/usr/sbin/obmc-console-server --config /etc/obmc-console/server.%i.conf %i +SyslogIdentifier=%i-console-server +Restart=always diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend new file mode 100644 index 0000000000..dd857f2fbe --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend @@ -0,0 +1,27 @@ +FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" +RDEPENDS:${PN} += "bash" + +CONSOLE_CLIENT_SERVICE_FMT = "obmc-console-ssh@{0}.service" +CONSOLE_SERVER_CONF_FMT = "file://server.{0}.conf" +CONSOLE_CLIENT_CONF_FMT = "file://client.{0}.conf" + +SRC_URI += " \ + file://ampere_uartmux_ctrl.sh \ + file://obmc-console@.service \ + " + +SYSTEMD_SERVICE:${PN}:remove = "obmc-console-ssh.socket" + +FILES:${PN}:remove = "${systemd_system_unitdir}/obmc-console-ssh@.service.d/use-socket.conf" + +PACKAGECONFIG:append = " concurrent-servers" + +do_install:append() { + # Script to switch host's uart muxes by GPIOs + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir} + + # Overriding service to call ampere_uart_console_setup.sh at ExecStartPre + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/obmc-console@.service ${D}${systemd_system_unitdir} +} |