diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-11-04 00:19:32 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-11-04 00:19:32 +0300 |
commit | 901ced0812b458fdc599fe40b0a4233d422d6df9 (patch) | |
tree | b0918e0606da0b1925b5fc9aba5e065e0a5a2f0e /meta-ampere/meta-jade/recipes-ampere | |
parent | ffe6d597d9e3d4407cf8062b5d6505a80ce08f41 (diff) | |
parent | 459d47e59bfb3f80542f17c7eb54ba1f6c1a44f3 (diff) | |
download | openbmc-901ced0812b458fdc599fe40b0a4233d422d6df9.tar.xz |
Merge tag '0.77' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'meta-ampere/meta-jade/recipes-ampere')
6 files changed, 181 insertions, 0 deletions
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update.bb b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update.bb new file mode 100644 index 000000000..b6ddfad80 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update.bb @@ -0,0 +1,26 @@ +SUMMARY = "Ampere Computing LLC Update MAC Address from FRU Inventory Information" +DESCRIPTION = "Update MAC Address from FRU Inventory Information for Ampere systems" +PR = "r1" + +LICENSE = "Apache-2.0" + +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd +inherit obmc-phosphor-systemd + +DEPENDS = "systemd" +RDEPENDS:${PN} = "bash" + +FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" + +SRC_URI += " \ + file://ampere_update_mac.sh \ + " + +SYSTEMD_SERVICE:${PN} = "ampere_update_mac.service" + +do_install:append() { + install -d ${D}/${sbindir} + install -m 755 ${WORKDIR}/ampere_update_mac.sh ${D}/${sbindir} +} diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service new file mode 100644 index 000000000..3425e4571 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service @@ -0,0 +1,13 @@ +[Unit] +Description=Updating MAC Address Service From FRU inventory +Requires=xyz.openbmc_project.EntityManager.service +After=xyz.openbmc_project.EntityManager.service + +[Service] +ExecStart=/usr/bin/env ampere_update_mac.sh +SyslogIdentifier=ampere_update_mac.sh +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.sh new file mode 100644 index 000000000..4e4d6f3e7 --- /dev/null +++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# This script is used to get the MAC Address from FRU Inventory information + +ETHERNET_INTERFACE="eth1" +ETHERNET_NCSI="eth0" +ENV_ETH="eth1addr" +ENV_MAC_ADDR=`fw_printenv | grep $ENV_ETH` + +# Workaround to dhcp NC-SI eth0 interface when BMC boot up +ifconfig ${ETHERNET_NCSI} down +ifconfig ${ETHERNET_NCSI} up + +# Read FRU Board Custom Field 1 to get the MAC address +CUSTOM_FIELD_1=`busctl get-property xyz.openbmc_project.FruDevice /xyz/openbmc_project/FruDevice/Mt_Jade_Motherboard xyz.openbmc_project.FruDevice BOARD_INFO_AM1` +MAC_ADDR=`echo $CUSTOM_FIELD_1 | cut -d "\"" -f 2` + +# Check if BMC MAC address is exported +if [ -z "${MAC_ADDR}" ]; then + echo "ERROR: No BMC MAC address is detected from FRU Inventory information!" + # Return 1 so that systemd knows the service failed to start + exit 1 +fi + +# Check if BMC MAC address is exported +if [[ $ENV_MAC_ADDR =~ $MAC_ADDR ]]; then + echo "WARNING: BMC MAC address already exist!" + exit 0 +fi + +# Request to update the MAC address +fw_setenv ${ENV_ETH} ${MAC_ADDR} + +if [[ $? -ne 0 ]]; then + echo "ERROR: Fail to set MAC address to ${ENV_ETH}" + exit 1 +fi + +# Request to restart the service +ifconfig ${ETHERNET_INTERFACE} down +ifconfig ${ETHERNET_INTERFACE} hw ether ${MAC_ADDR} +if [[ $? -ne 0 ]]; then + echo "ERROR: Can not update MAC ADDR to ${ETHERNET_INTERFACE}" + exit 1 +fi +ifconfig ${ETHERNET_INTERFACE} up + +echo "Successfully update the MAC address ${MAC_ADDR} to ${ENV_ETH} and ${ETHERNET_INTERFACE}" diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init.bb b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init.bb new file mode 100644 index 000000000..aaeb33ffe --- /dev/null +++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init.bb @@ -0,0 +1,28 @@ +SUMMARY = "Phosphor OpenBMC Mt.Jade Platform Init Service" +DESCRIPTION = "Phosphor OpenBMC Mt.Jade Platform Init Daemon" + +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd +inherit obmc-phosphor-systemd + +DEPENDS += "systemd" +RDEPENDS:${PN} += "libsystemd" +RDEPENDS:${PN} += "bash" + +SRC_URI = " \ + file://ampere_platform_init.sh \ + file://ampere-platform-init.service \ + " + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "ampere-platform-init.service" + +do_install () { + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/ampere_platform_init.sh ${D}${sbindir}/ + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/ampere-platform-init.service ${D}${systemd_unitdir}/system +} diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service new file mode 100644 index 000000000..51b3caa1e --- /dev/null +++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/ampere-platform-init.service @@ -0,0 +1,12 @@ +[Unit] +Description = Mt.Jade Platform Initialization + +[Service] +Restart=no +RemainAfterExit=true +Type=oneshot +ExecStart=/usr/sbin/ampere_platform_init.sh +StandardOutput=syslog + +[Install] +WantedBy=sysinit.target diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh new file mode 100644 index 000000000..a2578fa2f --- /dev/null +++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +source /usr/sbin/gpio-lib.sh + +# GPIOAC3 BMC_SPI0_BACKUP_SEL Boot from MAIN SPI-HOST +gpio_configure_output 227 0 + +# GPIOM4 S0_I2C9_ALERT_L +gpio_configure_input 100 + +# GPIOM5 S1_I2C9_ALERT_L +gpio_configure_input 101 + +# GPIOQ7 GPIO_BMC_VGA_FRONT_PRES_L +gpio_configure_input 135 + +# GPIOS0 GPIO_S0_VRHOT_L +gpio_configure_input 144 + +# GPIOS1 GPIO_S1_VRHOT_L +gpio_configure_input 145 + +# GPIOY3 BMC_VGA_SEL +gpio_configure_output 195 1 + +# GPIO_BMC_READY +gpio_configure_output 229 1 + +# ======================================================= +# Below GPIOs are controlled by other services so just +# initialize in A/C power only. +cmdline=`cat /proc/cmdline` +if [[ $cmdline == *resetreason=power* ]]; then + # BMC_GPIOR2_EXT_HIGHTEMP_L + gpio_configure_output 138 1 + + # GPIOS5 GPIO_BMC_VR_PMBUS_SEL_L + gpio_configure_output 149 1 + + # GPIOH7 GPIO_BMC_I2C6_RESET_L + gpio_configure_output 63 1 + + # GPIO_BMC_OCP_AUX_PWREN + gpio_configure_output 139 1 + + # GPIO_BMC_OCP_MAIN_PWREN + gpio_configure_output 140 0 + + # BMC_GPIOAC2_SPI0_PROGRAM_SEL + gpio_configure_output 226 0 + + # BMC_GPIOB0_I2C_BACKUP_SEL + gpio_configure_output 8 1 +fi |