Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+175
View File
@@ -0,0 +1,175 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
+12
View File
@@ -0,0 +1,12 @@
Different components of meta-fii are under different licenses (a mix
of MIT and Apache-2.0). Please see:
COPYING.Apache-2.0
COPYING.MIT (MIT)
All metadata is MIT licensed unless otherwise stated. Source code
included in tree for individual recipes is under the LICENSE stated in
the associated recipe (.bb file) unless otherwise stated.
License information for any other files is either explicitly stated
or defaults to Apache-2.0.
+4
View File
@@ -0,0 +1,4 @@
owners:
- benjaminfair@google.com
- vveerach@google.com
- johnwedig@google.com
+8
View File
@@ -0,0 +1,8 @@
# meta-fii
Repository for storing metadata for OpenBMC
Fii USA crop
├── meta-fii
└── meta-kudo
└── meta-mori
+8
View File
@@ -0,0 +1,8 @@
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "fii-layer"
BBFILE_PATTERN_fii-layer := "^${LAYERDIR}/"
LAYERSERIES_COMPAT_fii-layer = "langdale mickledore"
@@ -0,0 +1,4 @@
require conf/distro/gbmc.conf
DISTRO = "openbmc-kudo"
VERSION_ID:kudo = "v0.17-00-kudo"
+11
View File
@@ -0,0 +1,11 @@
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "kudo-layer"
BBFILE_PATTERN_kudo-layer = "^${LAYERDIR}/"
LAYERSERIES_COMPAT_kudo-layer = "langdale mickledore"
LAYERDEPENDS_kudo-layer = "core phosphor-layer google-layer fii-layer"
+44
View File
@@ -0,0 +1,44 @@
KMACHINE = "nuvoton"
KERNEL_DEVICETREE = "${KMACHINE}-npcm730-kudo.dtb"
require conf/machine/include/npcm7xx.inc
require conf/machine/include/obmc-bsp-common.inc
FLASH_SIZE = "65536"
FLASH_UBOOT_OFFSET:flash-65536 = "0"
FLASH_UBOOT_ENV_OFFSET:flash-65536 = "1024"
FLASH_KERNEL_OFFSET:flash-65536 = "2048"
FLASH_ROFS_OFFSET:flash-65536 = "7168"
FLASH_RWFS_OFFSET:flash-65536 = "62400"
UBOOT_MACHINE = "PolegSVB_config"
UBOOT_DEVICETREE = "nuvoton-npcm730-kudo"
IGPS_MACHINE = "EB"
GBMC_MAC_EEPROM_OF_NAME = "bmcfru"
GBMC_NCSI_IF_NAME = "eth0"
GBMC_MAC_IF_MAP = "[0]=eth1"
IMAGE_FSTYPES += " cpio.${INITRAMFS_CTYPE}.u-boot"
SERIAL_CONSOLES = "115200;ttyS0"
MACHINE_FEATURES += " \
obmc-host-ipmi \
obmc-phosphor-fan-mgmt \
obmc-phosphor-flash-mgmt \
obmc-phosphor-chassis-mgmt \
"
PREFERRED_PROVIDER_virtual/obmc-system-mgmt = "packagegroup-kudo-apps"
PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw = "phosphor-ipmi-ssif"
PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-kudo-apps"
PREFERRED_PROVIDER_virtual/obmc-fan-mgmt = "packagegroup-kudo-apps"
PREFERRED_PROVIDER_virtual/bmc-update = "kudo-bmc-update"
PREFERRED_PROVIDER_virtual/obmc-chassis-mgmt = "packagegroup-kudo-apps"
# Remove unneeded binaries from image
IMAGE_FEATURES:remove = "obmc-health-monitor \
obmc-fan-control \
obmc-inventory \
"
@@ -0,0 +1,19 @@
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "8"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
##OEROOT##/meta \
##OEROOT##/meta-security/meta-tpm \
##OEROOT##/meta-openembedded/meta-oe \
##OEROOT##/meta-openembedded/meta-networking \
##OEROOT##/meta-openembedded/meta-python \
##OEROOT##/meta-phosphor \
##OEROOT##/meta-nuvoton \
##OEROOT##/meta-google \
##OEROOT##/meta-fii \
##OEROOT##/meta-fii/meta-kudo \
"
@@ -0,0 +1,2 @@
Common targets are:
obmc-phosphor-image
@@ -0,0 +1,18 @@
MACHINE ??= "kudo"
DISTRO ?= "openbmc-kudo"
PACKAGE_CLASSES ?= "package_ipk"
SANITY_TESTED_DISTROS:append ?= " *"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
HALT,${TMPDIR},100M,1K \
HALT,${DL_DIR},100M,1K \
HALT,${SSTATE_DIR},100M,1K \
HALT,/tmp,10M,1K"
CONF_VERSION = "2"
@@ -0,0 +1,24 @@
# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
# Futhermore, if the Flash sector size is ommitted, this value is assumed to
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
# NOR example
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd2 0x0000 0x40000 0x4000
# MTD SPI-dataflash example
# MTD device name Device offset Env. size Flash sector size Number of sectors
#/dev/mtd5 0x4200 0x4200
#/dev/mtd6 0x4200 0x4200
# NAND example
#/dev/mtd0 0x4000 0x4000 0x20000 2
# Block device example
#/dev/mmcblk0 0xc0000 0x20000
# VFAT example
#/boot/uboot.env 0x0000 0x4000
@@ -0,0 +1,7 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
SRC_URI:append:kudo = " file://fw_env.config"
do_install:append:kudo () {
install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
}
@@ -0,0 +1,3 @@
CONFIG_PHY_FIXED=y
CONFIG_CMD_MII=y
CONFIG_NET_RANDOM_ETHADDR=y
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
SRC_URI:append:kudo = " file://kudo.cfg"
@@ -0,0 +1,9 @@
[Unit]
Description=Rotate the event logs
[Service]
Type=simple
ExecStart=/usr/bin/rotate-event-logs.sh
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,10 @@
#!/bin/sh
while true; do
sleep 60
/usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog
ec=$?
if [ $ec -ne 0 ] ; then
echo "logrotate failed ($ec)"
fi
done
@@ -0,0 +1,2 @@
[Service]
ExecReload=/bin/kill -HUP $MAINPID
@@ -0,0 +1,79 @@
# if you experience problems, check
# http://www.rsyslog.com/troubleshoot for assistance
# rsyslog v3: load input modules
# If you do not load inputs, nothing happens!
# You may need to set the module load path if modules are not found.
#
# Ported from debian's sysklogd.conf
# Journal-style logging
# Limit to no more than 4000 entries in one minute and enable the
# journal workaround to avoid duplicate entries
module(load="imjournal" StateFile="/var/log/state"
RateLimit.Interval="60"
RateLimit.Burst="4000")
# Template for IPMI SEL messages
# "<timestamp> <ID>,<Type>,<EventData>,[<Generator ID>,<Path>,<Direction>]"
template(name="IPMISELTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
property(name="$!IPMI_SEL_RECORD_ID")
constant(value=",")
property(name="$!IPMI_SEL_RECORD_TYPE")
constant(value=",")
property(name="$!IPMI_SEL_DATA")
constant(value=",")
property(name="$!IPMI_SEL_GENERATOR_ID")
constant(value=",")
property(name="$!IPMI_SEL_SENSOR_PATH")
constant(value=",")
property(name="$!IPMI_SEL_EVENT_DIR")
constant(value="\n")
}
# Template for Redfish messages
# "<timestamp> <MessageId>,<MessageArgs>"
template(name="RedfishTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
property(name="$!REDFISH_MESSAGE_ID")
constant(value=",")
property(name="$!REDFISH_MESSAGE_ARGS")
constant(value="\n")
}
# Template for Application Crashes
# "<timestamp> <MessageId>,<MessageArgs>"
template(name="CrashTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
constant(value="OpenBMC.0.1.ServiceFailure")
constant(value=",")
property(name="$!UNIT")
constant(value="\n")
}
# If the journal entry has the IPMI SEL MESSAGE_ID, save as IPMI SEL
# The MESSAGE_ID string is generated using journalctl and must match the
# MESSAGE_ID used in IPMI to correctly find the SEL entries.
if ($!MESSAGE_ID == "b370836ccf2f4850ac5bee185b77893a") then {
action(type="omfile" file="/var/log/ipmi_sel" template="IPMISELTemplate")
}
# If the journal entry has a Redfish MessageId, save as a Redfish event
if ($!REDFISH_MESSAGE_ID != "") then {
action(type="omfile" file="/var/log/redfish" template="RedfishTemplate")
}
# If the journal entry has a Exit Code, save as a Redfish event
if ($!EXIT_STATUS != "" and $!EXIT_STATUS != "0") then {
action(type="omfile" file="/var/log/redfish" template="CrashTemplate")
}
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
@@ -0,0 +1,32 @@
# /etc/logrotate.d/rsyslog - Ported from Debian
# Keep up to four 64k files for ipmi_sel (256k total)
/var/log/ipmi_sel
{
rotate 3
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to four 64k files for redfish (256k total)
/var/log/redfish
{
rotate 3
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to two 2k files for gpio log (4k total)
/usr/share/kudo-vrlog/gpio.log
{
rotate 1
size 2k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
@@ -0,0 +1,25 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
SRC_URI:append:kudo = " \
file://rsyslog.conf \
file://rsyslog.logrotate \
file://rotate-event-logs.service \
file://rotate-event-logs.sh \
file://rsyslog-override.conf \
"
FILES:${PN}:append:kudo = " ${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf"
PACKAGECONFIG:append:kudo = " imjournal"
do_install:append:kudo() {
install -m 0644 ${WORKDIR}/rotate-event-logs.service ${D}${systemd_system_unitdir}
install -d ${D}${systemd_system_unitdir}/rsyslog.service.d
install -m 0644 ${WORKDIR}/rsyslog-override.conf \
${D}${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/rotate-event-logs.sh ${D}/${bindir}/rotate-event-logs.sh
rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf
}
SYSTEMD_SERVICE:${PN}:append:kudo = " rotate-event-logs.service"
@@ -0,0 +1,126 @@
CONFIG_HWMON=y
CONFIG_SENSORS_TMP100=y
CONFIG_SENSORS_LM75=y
CONFIG_SENSORS_PWM_FAN=y
CONFIG_SENSORS_ADC128D818=y
CONFIG_SENSORS_ADM1275=y
CONFIG_SENSORS_TMP102=y
CONFIG_SENSORS_TMP421=y
CONFIG_SENSORS_MAX31790=y
CONFIG_SENSORS_MAX34440=y
CONFIG_SENSORS_ADM1266=y
CONFIG_PMBUS=y
CONFIG_SENSORS_PMBUS=y
CONFIG_SENSORS_INA2XX=y
CONFIG_IIO=y
CONFIG_IIO_MUX=y
CONFIG_NPCM_ADC=y
CONFIG_SENSORS_IIO_HWMON=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_OVERLAY_FS=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_XZ=y
CONFIG_JFFS2_FS=y
CONFIG_EXT4_FS=y
# SPI
CONFIG_SPI=y
CONFIG_SPI_NPCM_FIU=y
CONFIG_MTD_M25P80=y
CONFIG_SPI_NPCM_PSPI=y
#
# USB configuration
#
CONFIG_USB_U_ETHER=y
CONFIG_USB_F_ECM=y
CONFIG_USB_F_EEM=y
CONFIG_USB_F_SUBSET=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_F_MASS_STORAGE=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_GADGET_NPCM_USB2=y
#
# Nuvoton emc device
#
CONFIG_NET_VENDOR_NUVOTON=y
CONFIG_NPCM7XX_EMC_ETH=y
CONFIG_NET_NCSI=y
CONFIG_EEPROM_AT24=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_SLAVE_EEPROM=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_GPIO_PCF857X=y
CONFIG_MUX_MMIO=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_VIDEO_NUVOTON=y
CONFIG_NPCM750_VCD=y
CONFIG_NPCM750_ECE=y
CONFIG_FORCE_MAX_ZONEORDER=12
CONFIG_NPCM7XX_PCI_MBOX=y
CONFIG_RESET_NPCM=y
CONFIG_I2C_SLAVE=y
CONFIG_I2C_SLAVE_MQUEUE=y
CONFIG_IPMB_DEVICE_INTERFACE=y
# RTC device
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_PCF85063=y
#
# JATG Configuration
CONFIG_NUVOTON_JTAG=y
CONFIG_NPCM7XX_JTAG_MASTER=y
#
# Core Netfilter Configuration
#
CONFIG_NET_INGRESS=y
CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_NETFILTER_INGRESS=y
CONFIG_NETFILTER_NETLINK=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_PROCFS=y
CONFIG_NF_CT_PROTO_DCCP=y
CONFIG_NF_CT_PROTO_SCTP=y
CONFIG_NF_CT_PROTO_UDPLITE=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NETFILTER_XTABLES=y
#
# IP: Netfilter Configuration
#
CONFIG_NF_DEFRAG_IPV4=y
CONFIG_NF_REJECT_IPV4=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_NF_DEFRAG_IPV6=y
CONFIG_TCG_TPM=y
CONFIG_TCG_TIS_I2C_INFINEON=y
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/linux-nuvoton:"
SRC_URI:append:kudo = " file://kudo.cfg"
@@ -0,0 +1,73 @@
SUMMARY = "Ampere Computing LLC Host Control Implementation"
DESCRIPTION = "A host control implementation suitable for Ampere Computing LLC's 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
S = "${WORKDIR}"
SRC_URI = "file://ampere-host-shutdown.service \
file://ampere_power_util.sh \
file://ampere-chassis-poweroff.service \
file://ampere-chassis-poweron.service \
file://ampere-chassis-powercycle.service \
file://ampere-host-shutdown-ack.service \
file://ampere-host-power-cycle.service \
file://ampere-host-reset.service \
"
DEPENDS = "systemd"
RDEPENDS:${PN} = "bash"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = " \
ampere-host-shutdown.service \
ampere-chassis-poweroff.service \
ampere-chassis-poweron.service \
ampere-chassis-powercycle.service \
ampere-host-shutdown-ack.service \
ampere-host-power-cycle.service \
ampere-host-reset.service \
"
# host power control
# overwrite the host shutdown to graceful shutdown
HOST_SHUTDOWN_TMPL = "ampere-host-shutdown.service"
HOST_SHUTDOWN_TGTFMT = "obmc-host-shutdown@{0}.target"
HOST_SHUTDOWN_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_SHUTDOWN_TGTFMT}.requires/${HOST_SHUTDOWN_TMPL}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_SHUTDOWN_FMT', 'OBMC_HOST_INSTANCES')}"
# Force the power cycle target to run the ampere power cycle
HOST_REBOOT_SVC = "ampere-host-power-cycle.service"
HOST_REBOOT_SVC_TGTFMT = "obmc-host-reboot@{0}.target"
HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_SVC_TGTFMT}.requires/${HOST_REBOOT_SVC}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES')}"
# chassis power control
CHASSIS_POWERON_SVC = "ampere-chassis-poweron.service"
CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target"
CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_SVC}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}"
CHASSIS_POWEROFF_SVC = "ampere-chassis-poweroff.service"
CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target"
CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_SVC}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}"
CHASSIS_POWERCYCLE_SVC = "ampere-chassis-powercycle.service"
CHASSIS_POWERCYCLE_TGTFMT = "obmc-chassis-powercycle@{0}.target"
CHASSIS_POWERCYCLE_FMT = "../${CHASSIS_POWERCYCLE_SVC}:${CHASSIS_POWERCYCLE_TGTFMT}.requires/${CHASSIS_POWERCYCLE_SVC}"
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERCYCLE_FMT', 'OBMC_CHASSIS_INSTANCES')}"
TMPL = "phosphor-gpio-monitor@.service"
INSTFMT = "phosphor-gpio-monitor@{0}.service"
TGT = "multi-user.target"
FMT = "../${TMPL}:${TGT}.requires/${INSTFMT}"
SYSTEMD_LINK:${PN} += "${@compose_list(d, 'FMT', 'OBMC_HOST_MONITOR_INSTANCES')}"
do_install() {
install -d ${D}${libexecdir}/${PN}
install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}${libexecdir}/${PN}/ampere_power_util.sh
}
@@ -0,0 +1,8 @@
[Unit]
Description=Ampere Computing LLC Power OFF Chassis
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb hotswap
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,11 @@
[Unit]
Description=Ampere Computing LLC Power OFF Chassis
Requires=phosphor-wait-power-off@%i.service
Before=phosphor-wait-power-off@%i.service
Conflicts=obmc-chassis-poweron@0.target
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb off
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,9 @@
[Unit]
Description=Ampere Computing LLC Power ON Chassis
Conflicts=obmc-chassis-poweroff@0.target
[Service]
RemainAfterExit=yes
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb on
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,12 @@
[Unit]
Description=Ampere Computing LLC power cycle service
Conflicts=obmc-host-start@0.target
OnFailure=obmc-chassis-powerreset@0.target
Wants=kudo-bios-verify.service
After=kudo-bios-verify.service
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb host_cycle
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,12 @@
[Unit]
Description=Ampere Computing LLC power cycle service
Conflicts=obmc-host-start@0.target
OnFailure=obmc-chassis-powerreset@0.target
Wants=kudo-bios-verify.service
After=kudo-bios-verify.service
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb host_reset
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,11 @@
[Unit]
Description=Ampere Computing LLC host shutdown ACK
Requires=phosphor-wait-power-off@%i.service
Before=phosphor-wait-power-off@%i.service
Conflicts=obmc-chassis-poweron@0.target
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb shutdown_ack
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,10 @@
[Unit]
Description=Ampere Computing LLC graceful shutdown host
Conflicts=obmc-host-start@0.target
OnFailure=obmc-chassis-poweroff@0.target
[Service]
RemainAfterExit=no
Type=oneshot
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb graceful_shutdown
SyslogIdentifier=ampere_power_util.sh
@@ -0,0 +1,140 @@
#!/bin/bash
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
# Usage of this utility
function usage() {
echo "usage: power-util mb [on|off|graceful_shutdown|host_reset|host_cycle|shutdown_ack|hotswap]";
}
hotswap() {
kudo.sh rst hotswap
}
force_off() {
echo "Powering down Server"
set_gpio_ctrl POWER_OUT 1
sleep 6
set_gpio_ctrl POWER_OUT 0
}
power_off() {
busctl set-property xyz.openbmc_project.Watchdog /xyz/openbmc_project/watchdog/host0 xyz.openbmc_project.State.Watchdog ExpireAction s xyz.openbmc_project.State.Watchdog.Action.None
busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Off
}
power_on() {
echo "Powering on Server"
set_gpio_ctrl POWER_OUT 1
sleep 1
set_gpio_ctrl POWER_OUT 0
busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.On
}
power_status() {
st=$(busctl get-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis CurrentPowerState | cut -d "." -f6)
if [ "${st}" == "On\"" ]; then
echo "on"
else
echo "off"
fi
}
host_status() {
BOOT_OK=$(get_gpio_ctrl S0_FW_BOOT_OK)
S5_N=$(get_gpio_ctrl S0_SLPS5_N)
if [ "$S5_N" == 1 ] || [ "$BOOT_OK" == 1 ]; then
echo "on"
else
echo "off"
fi
}
timestamp() {
date +"%s" # current time
}
graceful_shutdown() {
if [ -f "/run/openbmc/host@0-request" ]; then
echo "Shutdown host immediately"
power_off
else
echo "Triggering graceful shutdown"
mkdir /run/openbmc
timestamp > "/run/openbmc/host@0-shutdown-req-time"
set_gpio_ctrl S0_SHD_REQ 0
sleep 3
set_gpio_ctrl S0_SHD_REQ 1
fi
}
host_reset() {
echo "Triggering sysreset pin"
busctl set-property xyz.openbmc_project.Watchdog /xyz/openbmc_project/watchdog/host0 xyz.openbmc_project.State.Watchdog ExpireAction s xyz.openbmc_project.State.Watchdog.Action.None
set_gpio_ctrl S0_SYSRESET 0
sleep 1
set_gpio_ctrl S0_SYSRESET 1
}
host_cycle() {
echo "DC cycling host"
force_off
sleep 2
power_on
}
shutdown_ack() {
echo "Receive shutdown ACK triggered"
power_off
if [ -f "/run/openbmc/host@0-shutdown-req-time" ]; then
rm -rf "/run/openbmc/host@0-shutdown-req-time"
fi
}
if [ $# -lt 2 ]; then
echo "Total number of parameter=$#"
echo "Insufficient parameter"
usage;
exit 0;
fi
if [ "$1" != "mb" ]; then
echo "Invalid parameter1=$1"
usage;
exit 0;
fi
if [ "$2" = "on" ]; then
sleep 3
if [ "$(power_status)" == "off" ]; then
power_on
fi
elif [ "$2" = "off" ]; then
if [ "$(power_status)" == "on" ]; then
power_off
sleep 6
if [ "$(host_status)" == "on" ]; then
force_off
fi
fi
elif [ "$2" == "hotswap" ]; then
hotswap
elif [ "$2" == "graceful_shutdown" ]; then
graceful_shutdown
elif [ "$2" == "host_reset" ]; then
host_reset
elif [ "$2" == "host_cycle" ]; then
host_cycle
elif [ "$2" == "shutdown_ack" ]; then
shutdown_ack
else
echo "Invalid parameter2=$2"
usage;
fi
exit 0;
@@ -0,0 +1,11 @@
[Unit]
Description=Power Cycle by Hotswap Controller
After=gbmc-psu-hardreset.target
[Service]
Type=oneshot
ExecStart=gpioset 2 30=1
StandardOutput=syslog
[Install]
WantedBy=gbmc-psu-hardreset.target
@@ -0,0 +1,21 @@
SUMMARY = "Power Cycle by Hotswap Controller"
DESCRIPTION = "Power Cycle by Hotswap Controller Daemon"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit systemd
DEPENDS += "systemd"
RDEPENDS:${PN} += "bash"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += " file://hotswap-power-cycle.service"
do_install() {
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/hotswap-power-cycle.service ${D}${systemd_unitdir}/system/hotswap-power-cycle.service
}
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = " hotswap-power-cycle.service"
@@ -0,0 +1,18 @@
SUMMARY = "foxconn OEM IPMI commands"
DESCRIPTION = "foxconn OEM IPMI commands"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
S = "${WORKDIR}/git"
DEPENDS = "boost phosphor-ipmi-host phosphor-logging systemd libgpiod"
inherit meson pkgconfig
SRC_URI = "git://github.com/openbmc/foxconn-ipmi-oem.git;branch=master;protocol=https"
SRCREV = "40553244bd6131be9c3395f212bed39e44932651"
FILES:${PN}:append = " ${libdir}/ipmid-providers"
FILES:${PN}:append = " ${libdir}/host-ipmid"
FILES:${PN}:append = " ${libdir}/net-ipmid"
@@ -0,0 +1,33 @@
SUMMARY = "Phosphor OpenBMC Kudo BIOS Firmware Upgrade Command"
DESCRIPTION = "Phosphor OpenBMC Kudo BIOS Firmware Upgrade Comman 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"
DEPENDS += "phosphor-ipmi-flash"
RDEPENDS:${PN} += "libsystemd"
RDEPENDS:${PN} += "bash"
FILES:${PN} += "${datadir}/phosphor-ipmi-flash/config-bios.json"
SRC_URI += " \
file://phosphor-ipmi-flash-bios-update.service \
file://config-bios.json \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} += " \
phosphor-ipmi-flash-bios-update.service \
"
do_install () {
install -d ${D}${datadir}/phosphor-ipmi-flash
install -m 0644 ${WORKDIR}/config-bios.json ${D}${datadir}/phosphor-ipmi-flash
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bios-update.service ${D}${systemd_system_unitdir}
}
@@ -0,0 +1,19 @@
[{
"blob": "/flash/bios",
"handler": {
"type": "file",
"path": "/run/initramfs/bios-image"
},
"actions": {
"preparation": {
"type": "skip"
},
"verification": {
"type": "skip"
},
"update": {
"type": "systemd",
"unit": "phosphor-ipmi-flash-bios-update.service"
}
}
}]
@@ -0,0 +1,6 @@
[Unit]
Description=Phosphor-ipmi-flash update BIOS firmware service
[Service]
ExecStart=/usr/sbin/kudo-fw.sh bios /run/initramfs/bios-image
Type=oneshot
@@ -0,0 +1,20 @@
SUMMARY = "Phosphor OpenBMC Kudo BMC Firmware Upgrade Command"
DESCRIPTION = "Phosphor OpenBMC Kudo BMC Firmware Upgrade Comman Daemon"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
DEPENDS += "phosphor-ipmi-flash"
RDEPENDS:${PN} += "bash"
RPROVIDES:${PN} += "virtual/bmc-update"
FILES:${PN} += "${datadir}/phosphor-ipmi-flash/config-bmc.json"
SRC_URI += " \
file://config-bmc.json \
"
do_install () {
install -d ${D}${datadir}/phosphor-ipmi-flash
install -m 0644 ${WORKDIR}/config-bmc.json ${D}${datadir}/phosphor-ipmi-flash
}
@@ -0,0 +1,20 @@
[{
"blob": "/flash/image",
"handler": {
"type": "file",
"path": "/run/initramfs/image-bmc"
},
"actions": {
"preparation": {
"type": "skip"
},
"verification": {
"type": "skip"
},
"update": {
"type": "systemd",
"unit": "reboot.target",
"mode": "replace-irreversibly"
}
}
}]
@@ -0,0 +1,39 @@
SUMMARY = "Phosphor OpenBMC Kudo CPLD Firmware Upgrade Command"
DESCRIPTION = "Phosphor OpenBMC Kudo CPLD Firmware Upgrade Comman 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"
DEPENDS += "phosphor-ipmi-flash"
RDEPENDS:${PN} += "libsystemd"
RDEPENDS:${PN} += "bash"
FILES:${PN} += "${datadir}/phosphor-ipmi-flash/config-bmccpld.json"
FILES:${PN} += "${datadir}/phosphor-ipmi-flash/config-mbcpld.json"
SRC_URI += " \
file://phosphor-ipmi-flash-bmccpld-update.service \
file://phosphor-ipmi-flash-mbcpld-update.service \
file://config-bmccpld.json \
file://config-mbcpld.json \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} += " \
phosphor-ipmi-flash-bmccpld-update.service \
phosphor-ipmi-flash-mbcpld-update.service \
"
do_install () {
install -d ${D}${datadir}/phosphor-ipmi-flash
install -m 0644 ${WORKDIR}/config-bmccpld.json ${D}${datadir}/phosphor-ipmi-flash
install -m 0644 ${WORKDIR}/config-mbcpld.json ${D}${datadir}/phosphor-ipmi-flash
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bmccpld-update.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-mbcpld-update.service ${D}${systemd_system_unitdir}
}
@@ -0,0 +1,19 @@
[{
"blob": "/flash/bmccpld",
"handler": {
"type": "file",
"path": "/run/initramfs/bmc-cpld.svf"
},
"actions": {
"preparation": {
"type": "skip"
},
"verification": {
"type": "skip"
},
"update": {
"type": "systemd",
"unit": "phosphor-ipmi-flash-bmccpld-update.service"
}
}
}]
@@ -0,0 +1,20 @@
[{
"blob": "/flash/mbcpld",
"handler": {
"type": "file",
"path": "/run/initramfs/mb-cpld.svf"
},
"actions": {
"preparation": {
"type": "skip"
},
"verification": {
"type": "skip"
},
"update": {
"type": "systemd",
"unit": "phosphor-ipmi-flash-mbcpld-update.service"
}
}
}]
@@ -0,0 +1,9 @@
[Unit]
Description=Phosphor-ipmi-flash update BMC CPLD firmware service
[Service]
ExecStart=/usr/sbin/kudo-fw.sh bmccpld /run/initramfs/bmc-cpld.svf
Type=oneshot
[Install]
WantedBy=phosphor-ipmi-flash-bmccpld-update.target
@@ -0,0 +1,9 @@
[Unit]
Description=Phosphor-ipmi-flash update MB CPLD firmware service
[Service]
ExecStart=/usr/sbin/kudo-fw.sh mbcpld /run/initramfs/mb-cpld.svf
Type=oneshot
[Install]
WantedBy=phosphor-ipmi-flash-mbcpld-update.target
@@ -0,0 +1,37 @@
SUMMARY = "Phosphor OpenBMC Kudo Firmware Upgrade Command"
DESCRIPTION = "Phosphor OpenBMC Kudo Firmware Upgrade Comman 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"
DEPENDS += "phosphor-ipmi-flash"
RDEPENDS:${PN} += "libsystemd"
RDEPENDS:${PN} += "bash"
SRC_URI = " \
file://kudo-fw.sh \
file://kudo-fw-ver.service \
file://kudo-fw-ver.sh \
file://kudo-lib.sh \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = " \
kudo-fw-ver.service \
"
do_install () {
install -d ${D}${sbindir}
install -d ${D}${libexecdir}/${PN}
install -m 0755 ${WORKDIR}/kudo-fw.sh ${D}${sbindir}/kudo-fw.sh
install -m 0755 ${WORKDIR}/kudo-fw-ver.sh ${D}${libexecdir}/${PN}/kudo-fw-ver.sh
install -m 0755 ${WORKDIR}/kudo-lib.sh ${D}${libexecdir}/${PN}/kudo-lib.sh
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/kudo-fw-ver.service ${D}${systemd_system_unitdir}
}
@@ -0,0 +1,10 @@
[Unit]
Description=Firmware Version Daemon
[Service]
RemainAfterExit=yes
Type=oneshot
ExecStart=/usr/libexec/kudo-fw/kudo-fw-ver.sh
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,33 @@
#!/bin/bash
# Disable check for splitting
# shellcheck disable=SC2207
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
BMC_CPLD_VER_FILE="/run/cpld0.version"
MB_CPLD_VER_FILE="/run/cpld1.version"
ver=''
function fw_rev() {
case $1 in
cpldb)
rsp=($(i2cget -y -f -a "${I2C_BMC_CPLD[0]}" 0x"${I2C_BMC_CPLD[1]}" 0x00 i 5))
ver=$(printf '%d.%d.%d.%d' "${rsp[4]}" "${rsp[3]}" "${rsp[2]}" "${rsp[1]}")
;;
cpldm)
rsp=($(i2cget -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x00 i 5))
ver=$(printf '%d.%d.%d.%d' "${rsp[4]}" "${rsp[3]}" "${rsp[2]}" "${rsp[1]}")
;;
*)
;;
esac
}
fw_rev cpldb
echo "BMC CPLD version : ${ver}"
echo "${ver}" > "${BMC_CPLD_VER_FILE}"
fw_rev cpldm
echo "MB CPLD version : ${ver}"
echo "${ver}" > "${MB_CPLD_VER_FILE}"
@@ -0,0 +1,204 @@
#!/bin/bash
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
# Disable check for globbing and word splitting within double quotes
# shellcheck disable=SC2086
source /usr/libexec/kudo-fw/kudo-lib.sh
function fwbios() {
KERNEL_FIU_ID="c0000000.spi"
KERNEL_SYSFS_FIU="/sys/bus/platform/drivers/NPCM-FIU"
# switch the SPI mux from Host to BMC
i2cset -y -f -a ${I2C_BMC_CPLD[0]} 0x${I2C_BMC_CPLD[1]} 0x10 0x01
# rescan the spi bus
if [ -d "${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID}" ]; then
echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind
sleep 1
fi
echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/bind
# write to the mtd device
BIOS_MTD=$(grep "bios" /proc/mtd | sed -n 's/^\(.*\):.*/\1/p')
if [ ! -f "$1" ]; then
echo " Cannot find the" "$1" "image file"
return 1
fi
echo "Flashing BIOS @/dev/${BIOS_MTD}"
if [ "$(flashcp -v $1 /dev/${BIOS_MTD})" -ne 0 ]; then
echo "Flashing the bios failed " >&2
return 1
fi
wait
# switch the SPI mux from BMC to Host
if [ -d "${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID}" ]; then
echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind
fi
i2cset -y -f -a ${I2C_BMC_CPLD[0]} 0x${I2C_BMC_CPLD[1]} 0x10 0x00
# Disable LPI mode NV_SI_CPU_LPI_FREQ_DISABLE for SCP 1.06 and older.
if [ "$(nvparm -s 0x1 -o 0x114090)" -ne 0 ]; then
echo "Setting LPI mode for SCP 1.06 and older failed " >&2
return 1
fi
# Disable LPI mode NV_SI_CPU_LPI_FREQ_DISABLE for SCP 1.07 and newer
if [ "$(nvparm -s 0x1 -o 0x02A8)" -ne 0 ]; then
echo "Setting LPI mode for SCP 1.07 and newer failed " >&2
return 1
fi
# Disable toggling of SMPro heartbeat
if [ "$(nvparm -s 0x0 -o 0x5F0638)" -ne 0 ]; then
echo "Setting SMpro heartbeat failed " >&2
return 1
fi
if [[ $(find "$1" -type f -size +17156k 2>/dev/null) ]]; then
echo "Extracting the SCP from the image"
dd if="$1" bs=1024 skip=17156 count=256 of=/run/initramfs/myscp.img
# Update both primary and backup EEPROM
fwscp /run/initramfs/myscp.img
fwscpback /run/initramfs/myscp.img
fi
return 0
}
function fwbmccpld() {
# BMC_JTAG_MUX_1 0:BMC 1:MB
set_gpio_ctrl MB_JTAG_MUX_SEL 0
if [ "$(loadsvf -d /dev/jtag0 -s $1 -m 0)" -ne 0 ]; then
echo "BMC CPLD update failed" >&2
return 1
fi
wait
set_gpio_ctrl MB_JTAG_MUX_SEL 1
return 0
}
function fwmbcpld() {
# BMC_JTAG_MUX_1 0:BMC 1:MB
# BMC_JTAG_SEL 0:BMC 1:CPU
set_gpio_ctrl MB_JTAG_MUX_SEL 1
set_gpio_ctrl BMC_JTAG_MUX_SEL 1
if [ "$(loadsvf -d /dev/jtag0 -s $1 -m 0)" -ne 0 ]; then
echo "Mobo CPLD update failed" >&2
return 1
fi
wait
return 0
}
function fwscp() {
# BMC_I2C_BACKUP_SEL 0:failover, 1:main
# BMC_CPU_EEPROM_I2C_SEL 0:BMC, 1:CPU
scp_eeprom_sel=$(get_gpio_ctrl BACKUP_SCP_SEL)
set_gpio_ctrl BACKUP_SCP_SEL 1
set_gpio_ctrl CPU_EEPROM_SEL 0
if [ "$(ampere_eeprom_prog -b ${I2C_CPU_EEPROM[0]} -s 0x${I2C_CPU_EEPROM[1]} -p -f $1)" -ne 0 ]; then
echo "SCP eeprom update failed" >&2
return 1
fi
wait
set_gpio_ctrl CPU_EEPROM_SEL 1
set_gpio_ctrl BACKUP_SCP_SEL "$scp_eeprom_sel"
return 0
}
function fwscpback() {
# BMC_I2C_BACKUP_SEL 0:failover, 1:main
# BMC_CPU_EEPROM_I2C_SEL 0:BMC, 1:CPU
scp_eeprom_sel=$(get_gpio_ctrl BACKUP_SCP_SEL)
set_gpio_ctrl BACKUP_SCP_SEL 0
set_gpio_ctrl CPU_EEPROM_SEL 0
if [ "$(ampere_eeprom_prog -b ${I2C_CPU_EEPROM[0]} -s 0x${I2C_CPU_EEPROM[1]} -p -f $1)" -ne 0 ]; then
echo "SCP BACKUP eeprom update failed" >&2
return 1
fi
wait
set_gpio_ctrl CPU_EEPROM_SEL 1
set_gpio_ctrl BACKUP_SCP_SEL "$scp_eeprom_sel"
return 0
}
function fwmb_pwr_seq(){
#$1 0x40 seq config file
#$2 0x41 seq config file
if [[ ! -e "$1" ]]; then
echo "The file $1 does not exist"
return 1
fi
if [[ ! -e "$2" ]]; then
echo "The file $2 file does not exist"
return 1
fi
echo ${I2C_MB_PWRSEQ1[0]}-00${I2C_MB_PWRSEQ1[1]} > /sys/bus/i2c/drivers/adm1266/unbind
echo ${I2C_MB_PWRSEQ2[0]}-00${I2C_MB_PWRSEQ2[1]} > /sys/bus/i2c/drivers/adm1266/unbind
#Parameters passed to adm1266_fw_fx to be used to flash PS
#1st I2C bus number of PS's
#2nd/3rd PS seq config file
if [ "$(adm1266_fw_fx ${I2C_MB_PWRSEQ1[0]} $1 $2)" -ne 0 ]; then
echo "The power seq flash failed" >&2
return 1
fi
echo ${I2C_MB_PWRSEQ1[0]}-00${I2C_MB_PWRSEQ1[1]} > /sys/bus/i2c/drivers/adm1266/bind
echo ${I2C_MB_PWRSEQ2[0]}-00${I2C_MB_PWRSEQ2[1]} > /sys/bus/i2c/drivers/adm1266/bind
return 0
}
if [[ ! $(which flashcp) ]]; then
echo "flashcp utility not installed"
exit 1
fi
if [[ ! $(which ampere_eeprom_prog) ]]; then
echo "ampere_eeprom_prog utility not installed"
exit 1
fi
if [[ ! $(which loadsvf) ]]; then
echo "loadsvf utility not installed"
exit 1
fi
if [[ ! -e /dev/jtag0 ]]; then
echo "Jtag device driver not functional"
exit 1
fi
case $1 in
bios)
fwbios "$2"
;;
bmccpld)
fwbmccpld "$2"
;;
mbcpld)
fwmbcpld "$2"
;;
scp)
fwscp "$2"
;;
scpback)
fwscpback "$2"
;;
mbseq)
fwmb_pwr_seq "$2" "$3"
;;
*)
;;
esac
ret=$?
rm -f "$2" "$3"
exit $ret
@@ -0,0 +1,73 @@
#!/bin/bash
# Disable check for usage of the definitions within kudo-lib.sh
# shellcheck disable=SC2034
# get_gpio_num
# Dynamically obtains GPIO number from chip base and I2C expanders through line name
# line-name
function get_gpio_num() {
#shellcheck disable=SC2207
CHIP_PIN=($(gpiofind "$1" | awk '{print substr ($1, 9 ), $2 }'))
#shellcheck disable=SC2128
if [ -z "$CHIP_PIN" ]; then
echo "Could not find GPIO with name: $1"
return 1
fi
if [ "${CHIP_PIN[0]}" -gt 7 ]; then
BUS_ADDR=$(gpiodetect | grep gpiochip"${CHIP_PIN[0]}" | awk '{print substr($2, 2, length($2) - 2)}')
GPIO_BASE=$(cat /sys/bus/i2c/devices/"$BUS_ADDR"/gpio/*/base)
echo "$((GPIO_BASE+CHIP_PIN[1]))"
else
echo "$((CHIP_PIN[0]*32+CHIP_PIN[1]))"
fi
}
# set_gpio_ctrl
# line-name, high(1)/low(0)
function set_gpio_ctrl() {
#shellcheck disable=SC2046
gpioset $(gpiofind "$1")="$2"
}
# get_gpio_ctrl
# line-name
function get_gpio_ctrl() {
GPIO_NUM=$(get_gpio_num "$1")
echo "$GPIO_NUM" > /sys/class/gpio/export
cat /sys/class/gpio/gpio"$GPIO_NUM"/value
echo "$GPIO_NUM" > /sys/class/gpio/unexport
}
function get_scp_eeprom() {
scp_eeprom_sel=$(get_gpio_ctrl BACKUP_SCP_SEL)
case $scp_eeprom_sel in
0)
echo " Using Secondary SCP EEPROM"
;;
1)
echo " Using Primary SCP EEPROM"
;;
esac
}
# I2C Definitions
# The array is (<bus> <address>), where address is in hexadecimal.
I2C_BMC_CPLD=(13 76)
I2C_MB_CPLD=(34 76)
I2C_S0_SMPRO=(2 4f)
I2C_S1_SMPRO=(2 4e)
I2C_FANCTRL=(18 2c)
I2C_BMC_PWRSEQ=(14 59)
I2C_MB_PWRSEQ1=(32 40)
I2C_MB_PWRSEQ2=(32 41)
I2C_CPU_EEPROM=(40 50)
I2C_S1_CLKGEN=(37 68)
I2C_S1_PCIE_CLKGEN1=(16 6a)
I2C_S1_PCIE_CLKGEN2=(17 67)
# Board Version Definitions
BOARDVER_EVT_LAST=64
BOARDVER_DVT_LAST=127
BOARDVER_PVT_LAST=191
@@ -0,0 +1,40 @@
SUMMARY = "Phosphor OpenBMC Kudo SCP Firmware Upgrade Command"
DESCRIPTION = "Phosphor OpenBMC Kudo SCP Firmware Upgrade Comman 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"
DEPENDS += "phosphor-ipmi-flash"
RDEPENDS:${PN} += "libsystemd"
RDEPENDS:${PN} += "bash"
FILES:${PN} += "${datadir}/phosphor-ipmi-flash/config-scp.json"
FILES:${PN} += "${datadir}/phosphor-ipmi-flash/config-scpback.json"
SRC_URI += " \
file://phosphor-ipmi-flash-scp-update.service \
file://phosphor-ipmi-flash-scpback-update.service \
file://config-scp.json \
file://config-scpback.json \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} += " \
phosphor-ipmi-flash-scp-update.service \
phosphor-ipmi-flash-scpback-update.service \
"
do_install () {
install -d ${D}${datadir}/phosphor-ipmi-flash
install -m 0644 ${WORKDIR}/config-scp.json ${D}${datadir}/phosphor-ipmi-flash
install -m 0644 ${WORKDIR}/config-scpback.json ${D}${datadir}/phosphor-ipmi-flash
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-scp-update.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-scpback-update.service ${D}${systemd_system_unitdir}
}
@@ -0,0 +1,19 @@
[{
"blob": "/flash/scp",
"handler": {
"type": "file",
"path": "/run/initramfs/scp-fw.slim"
},
"actions": {
"preparation": {
"type": "skip"
},
"verification": {
"type": "skip"
},
"update": {
"type": "systemd",
"unit": "phosphor-ipmi-flash-scp-update.service"
}
}
}]
@@ -0,0 +1,20 @@
[{
"blob": "/flash/scpb",
"handler": {
"type": "file",
"path": "/run/initramfs/scp-fw.slim"
},
"actions": {
"preparation": {
"type": "skip"
},
"verification": {
"type": "skip"
},
"update": {
"type": "systemd",
"unit": "phosphor-ipmi-flash-scpback-update.service"
}
}
}]
@@ -0,0 +1,9 @@
[Unit]
Description=Phosphor-ipmi-flash update main EEPROM SCP firmware service
[Service]
ExecStart=/usr/sbin/kudo-fw.sh scp /run/initramfs/scp-fw.slim
Type=oneshot
[Install]
WantedBy=phosphor-ipmi-flash-scp-update.target
@@ -0,0 +1,9 @@
[Unit]
Description=Phosphor-ipmi-flash update failover EEPROM SCP firmware service
[Service]
ExecStart=/usr/sbin/kudo-fw.sh scpback /run/initramfs/scp-fw.slim
Type=oneshot
[Install]
WantedBy=phosphor-ipmi-flash-scpback-update.target
@@ -0,0 +1,30 @@
SUMMARY = "Phosphor OpenBMC Kudo System Power Control Service"
DESCRIPTION = "Phosphor OpenBMC Kudo System Power Control 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://init_once.sh \
file://host-powerctrl.service \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = " \
host-powerctrl.service \
"
do_install () {
install -d ${D}${libexecdir}/${PN}
install -m 0755 ${WORKDIR}/init_once.sh ${D}${libexecdir}/${PN}/init_once.sh
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/host-powerctrl.service ${D}${systemd_unitdir}/system
}
@@ -0,0 +1,16 @@
[Unit]
Description = Host Power Control Sequence
Wants=ssifbridge.service
After=ssifbridge.service
Wants=kudo-bios-verify.service
After=kudo-bios-verify.service
[Service]
Restart=no
RemainAfterExit=true
Type=oneshot
ExecStart=/usr/libexec/kudo-boot/init_once.sh
StandardOutput=syslog
[Install]
WantedBy=sysinit.target
@@ -0,0 +1,75 @@
#!/bin/bash
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
function set_mux_default(){
# set all mux route to CPU before power on host
# BMC_CPU_RTC_I2C_SEL
set_gpio_ctrl CPU_RTC_SEL 1
# BMC_CPU_DDR_I2C_SEL
set_gpio_ctrl CPU_DDR_SEL 1
# BMC_CPU_EEPROM_I2C_SEL
set_gpio_ctrl CPU_EEPROM_SEL 1
# BMC_CPU_PMBUS_SEL
set_gpio_ctrl CPU_VRD_SEL 1
# LED control
# LED_BMC_LIVE
set_gpio_ctrl LED_BMC_ALIVE 1
# SPI control
# Send command to CPLD to switch the bios spi interface to host
i2cset -y -f -a "${I2C_BMC_CPLD[0]}" 0x"${I2C_BMC_CPLD[1]}" 0x10 0x00
}
# 0 - 63 EVT
# 64 + DVT/PVT
boardver=$(printf '%d' "$(awk '{print $6}' /sys/bus/i2c/drivers/fiicpld/"${I2C_MB_CPLD[0]}"-00"${I2C_MB_CPLD[1]}"/CMD00)")
# On EVT machines, the secondary SCP EEPROM is used.
# Set BMC_I2C_BACKUP_SEL to secondary.
if [[ $boardver -lt $BOARDVER_EVT_LAST ]]; then
echo "EVT system. Choosing secondary SCP EEPROM."
set_gpio_ctrl BACKUP_SCP_SEL 0
set_mux_default
# Power control
# S0_BMC_OK
set_gpio_ctrl S0_BMC_OK 1
else
echo "DVT or PVT system"
# sleep so that FRU and all ipmitool Devices are ready before HOST OS
# HPM_STBY_RST_N to DC-SCM spec
set_gpio_ctrl HPM_STBY_RST_N 1 # on DVT this became HPM_STBY_RST_N (EVT1 came from CPLD)
sleep 5 # for the MUX to get ready
set_mux_default
# Power control
# S0_BMC_OK
set_gpio_ctrl S0_BMC_OK 1
fi
# Disable CPU 1 CLK when cpu not detected
# echo init_once cpu $CPU1_STATUS > /dev/ttyS0
# echo init_once board $boardver > /dev/ttyS0
CPU1_STATUS_N=$(get_gpio_ctrl S1_STATUS_N)
if [[ $CPU1_STATUS_N == 1 ]]; then
#Execute this only on DVT systems
if [[ $boardver -lt $BOARDVER_EVT_LAST ]]; then
echo EVT system "$boardver"
else
echo DVT system "$boardver"
i2cset -y -a -f "${I2C_S1_CLKGEN[0]}" 0x"${I2C_S1_CLKGEN[1]}" 0x05 0x03
fi
#These i2c deviecs are already installed on EVT systems
i2cset -y -a -f "${I2C_S1_PCIE_CLKGEN1[0]}" 0x"${I2C_S1_PCIE_CLKGEN1[1]}" 0 1 0xdf i
i2cset -y -a -f "${I2C_S1_PCIE_CLKGEN1[0]}" 0x"${I2C_S1_PCIE_CLKGEN1[1]}" 11 1 0x01 i
i2cset -y -a -f "${I2C_S1_PCIE_CLKGEN2[0]}" 0x"${I2C_S1_PCIE_CLKGEN2[1]}" 1 2 0x3f 0x0c i
fi
# Create /run/openbmc for system power files
mkdir "/run/openbmc"
# Restart psusensor service to enusre that the VBAT sensor doesn't say "no reading" until
# it's second query after a hotswap
(sleep 45; systemctl restart xyz.openbmc_project.psusensor.service)&
@@ -0,0 +1,21 @@
SUMMARY = "Phosphor OpenBMC Kudo System Command"
DESCRIPTION = "Phosphor OpenBMC Kudo System Command Daemon"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
RDEPENDS:${PN} += "bash"
SRC_URI = " \
file://kudo.sh \
file://kudo-ras.sh \
"
SYSTEMD_PACKAGES = "${PN}"
do_install () {
install -d ${D}${sbindir}
install -m 0755 ${WORKDIR}/kudo.sh ${D}${sbindir}/kudo.sh
install -m 0755 ${WORKDIR}/kudo-ras.sh ${D}${sbindir}/kudo-ras.sh
}
@@ -0,0 +1,579 @@
#!/bin/bash
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
powerState=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0xe0 b)
getGPISourceRegisters(){
REG60=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x60 w) # GPI Data Set
REG61=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x61 w) # GPI DATA Set #0
REG62=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x62 w) # GPI DATA Set #1
REG63=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x63 w) # GPI DATA Set #2
REG64=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x64 w) # GPI DATA Set #3
DS0Pres=$((REG60 & 0x0100))
DS1Pres=$((REG60 & 0x0200))
DS2Pres=$((REG60 & 0x0400))
DS3Pres=$((REG60 & 0x0800))
}
getErrorCount() {
MemCE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x90 w)
MemUE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x93 w)
CoreCE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x80 w)
CoreUE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x83 w)
PCIeCE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0xc0 w)
PCIeUE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0xc2 w)
OtherCE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0xd0 w)
OtherUE=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0xd8 w)
}
getReg61Vals() {
REG61_0800=$((REG61 & 0x0800))
REG61_0800_VAL=$((REG61_0800 >> 8))
REG61_1000=$((REG61 & 0x1000))
REG61_1000_VAL=$((REG61_1000 >> 12))
}
getReg62Vals() {
REG62_0100=$((REG62 & 0x0100))
REG62_0100_VAL=$((REG62_0100 >> 8))
REG62_0200=$((REG62 & 0x0200))
REG62_0200_VAL=$((REG62_0200 >> 9))
REG62_0400=$((REG62 & 0x0400))
REG62_0400_VAL=$((REG62_0400 >> 10))
}
getReg63Vals() {
REG63_0100=$((REG63 & 0x0100))
REG63_0100_VAL=$((REG63_0100 >> 8))
}
getReg64Vals() {
REG64_0100=$((REG64 & 0x0100))
REG64_0100_VAL=$((REG64_0100 >> 8))
REG64_0200=$((REG64 & 0x0200))
REG64_0200_VAL=$((REG64_0200 >> 9))
REG64_0800=$((REG64 & 0x0800))
REG64_0800_VAL=$((REG64_0800 >> 11))
REG64_2000=$((REG64 & 0x2000))
REG64_2000_VAL=$((REG64_2000 >> 13))
REG64_4000=$((REG64 & 0x4000))
REG64_4000_VAL=$((REG64_4000 >> 14))
REG64_8000=$((REG64 & 0x8000))
REG64_8000_VAL=$((REG64_8000 >> 15))
REG64_0001=$((REG64 & 0x0001))
REG64_0001_VAL=$((REG64_0001))
}
getGPIStatusRegisters(){
REG70=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x70 w) # Core, DIMM, SLC, PCIe, and Other errors
REG78=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x78 w) # VRD Fault/Warning Error
REG79=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x79 w) # VRD Hot
REG7A=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x7A w) # DIMM Hot Error
REG7B=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x7B w) # Boot #1 Error
REG7C=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x7C w) # Boot #2 Error
REG7D=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x7D w) # Watchdog/Other Status
REG7E=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x7E w) # RAS internal error
}
getReg70Vals() {
REG70_0100=$((REG70 & 0x0100))
REG70_0100_VAL=$((REG70_0100 >> 8))
REG70_0200=$((REG70 & 0x0200))
REG70_0200_VAL=$((REG70_0200 >> 9))
REG70_0400=$((REG70 & 0x0400))
REG70_0400_VAL=$((REG70_0400 >> 10))
REG70_0800=$((REG70 & 0x0800))
REG70_0800_VAL=$((REG70_0800 >> 11))
REG70_4000=$((REG70 & 0x4000))
REG70_4000_VAL=$((REG70_4000 >> 14))
REG70_8000=$((REG70 & 0x8000))
REG70_8000_VAL=$((REG70_8000 >> 15))
REG70_0001=$((REG70 & 0x0001))
REG70_0001_VAL=$((REG70_0001))
REG70_0002=$((REG70 & 0x0002))
REG70_0002_VAL=$((REG70_0002 >> 1))
}
getReg78Vals() {
REG78_0100=$((REG78 & 0x0100))
REG78_0100_VAL=$((REG78_0100 >> 8))
REG78_0200=$((REG78 & 0x0200))
REG78_0200_VAL=$((REG78_0200 >> 9))
REG78_0400=$((REG78 & 0x0400))
REG78_0400_VAL=$((REG78_0400 >> 10))
REG78_0800=$((REG78 & 0x0800))
REG78_0800_VAL=$((REG78_0800 >> 11))
REG78_1000=$((REG78 & 0x1000))
REG78_1000_VAL=$((REG78_1000 >> 12))
REG78_2000=$((REG78 & 0x2000))
REG78_2000_VAL=$((REG78_2000 >> 13))
REG78_4000=$((REG78 & 0x4000))
REG78_4000_VAL=$((REG78_4000 >> 14))
REG78_8000=$((REG78 & 0x8000))
REG78_8000_VAL=$((REG78_8000 >> 15))
REG78_0001=$((REG78 & 0x0001))
REG78_0001_VAL=$((REG78_0001))
REG78_0002=$((REG78 & 0x0002))
REG78_0002_VAL=$((REG78_0002 >> 1))
REG78_0004=$((REG78 & 0x0004))
REG78_0004_VAL=$((REG78_0004 >> 2))
REG78_0008=$((REG78 & 0x0008))
REG78_0008_VAL=$((REG78_0008 >> 3))
}
getReg79Vals() {
REG79_0100=$((REG79 & 0x0100))
REG79_0100_VAL=$((REG79_0100 >> 8))
REG79_1000=$((REG79 & 0x1000))
REG79_1000_VAL=$((REG79_1000 >> 12))
REG79_2000=$((REG79 & 0x2000))
REG79_2000_VAL=$((REG79_2000 >> 13))
REG79_4000=$((REG79 & 0x4000))
REG79_4000_VAL=$((REG79_4000 >> 14))
REG79_0001=$((REG79 & 0x0001))
REG79_0001_VAL=$((REG79_0001))
REG79_0002=$((REG79 & 0x0002))
REG79_0002_VAL=$((REG79_0002 >> 1))
REG79_0004=$((REG79 & 0x0004))
REG79_0004_VAL=$((REG79_0004 >> 2))
REG79_0008=$((REG79 & 0x0008))
REG79_0008_VAL=$((REG79_0008 >> 3))
}
getReg7AVals() {
REG7A_0100=$((REG7A & 0x0100))
REG7A_0100_VAL=$((REG7A_0100 >> 8))
REG7A_0200=$((REG7A & 0x0200))
REG7A_0200_VAL=$((REG7A_0200 >> 9))
REG7A_0400=$((REG7A & 0x0400))
REG7A_0400_VAL=$((REG7A_0400 >> 10))
REG7A_0800=$((REG7A & 0x0800))
REG7A_0800_VAL=$((REG7A_0800 >> 11))
REG7A_1000=$((REG7A & 0x1000))
REG7A_1000_VAL=$((REG7A_1000 >> 12))
REG7A_2000=$((REG7A & 0x2000))
REG7A_2000_VAL=$((REG7A_2000 >> 13))
REG7A_4000=$((REG7A & 0x4000))
REG7A_4000_VAL=$((REG7A_4000 >> 14))
REG7A_8000=$((REG7A & 0x8000))
REG7A_8000_VAL=$((REG7A_8000 >> 15))
}
getReg7DVals() {
REG7D_0100=$((REG7D & 0x0100))
REG7D_0100_VAL=$((REG7D_0100 >> 8))
REG7D_0200=$((REG7D & 0x0200))
REG7D_0200_VAL=$((REG7D_0200 >> 9))
REG7D_0400=$((REG7D & 0x0400))
REG7D_0400_VAL=$((REG7D_0400 >> 10))
}
getReg7EVals() {
REG7E_0100=$((REG7E & 0x0100))
REG7E_0100_VAL=$((REG7E_0100 >> 8))
REG7E_0200=$((REG7E & 0x0200))
REG7E_0200_VAL=$((REG7E_0200 >> 9))
}
getGPIMaskRegisters(){
REG50=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x50 w) # GPI Control #0
REG51=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x51 w) # GPI Control #1
REG52=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x52 w) # GPI Control #2
REG53=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x53 w) # GPI Control #3
REG54=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x54 w) # GPI CE/UE Mask
}
getReg50Vals() {
REG50_0400=$((REG50 & 0x0400))
REG50_0400_VAL=$((REG50_0400 >> 10))
REG50_0800=$((REG50 & 0x0800))
REG50_0800_VAL=$((REG50_0800 >> 11))
}
getReg51Vals() {
REG51_0100=$((REG51 & 0x0100))
REG51_0100_VAL=$((REG51_0100 >> 8))
REG51_0200=$((REG51 & 0x0200))
REG51_0200_VAL=$((REG51_0200 >> 9))
REG51_0400=$((REG51 & 0x0400))
REG51_0400_VAL=$((REG51_0400 >> 10))
}
getReg52Vals() {
REG52_0100=$((REG52 & 0x0100))
REG52_0100_VAL=$((REG52_0100 >> 8))
}
getReg53Vals() {
REG53_0100=$((REG53 & 0x0100))
REG53_0100_VAL=$((REG53_0100 >> 8))
REG53_0200=$((REG53 & 0x0200))
REG53_0200_VAL=$((REG53_0200 >> 9))
REG53_0800=$((REG53 & 0x0800))
REG53_0800_VAL=$((REG53_0800 >> 11))
REG53_2000=$((REG53 & 0x2000))
REG53_2000_VAL=$((REG53_2000 >> 13))
REG53_4000=$((REG53 & 0x4000))
REG53_4000_VAL=$((REG53_4000 >> 14))
REG53_8000=$((REG53 & 0x8000))
REG53_8000_VAL=$((REG53_8000 >> 15))
REG53_0001=$((REG53 & 0x0001))
REG53_0001_VAL=$((REG53_0001))
}
getReg54Vals() {
REG54_0100=$((REG54 & 0x0100))
REG54_0100_VAL=$((REG54_0100 >> 8))
REG54_0200=$((REG54 & 0x0200))
REG54_0200_VAL=$((REG54_0200 >> 9))
REG54_0001=$((REG54 & 0x0001))
REG54_0001_VAL=$((REG54_0001))
REG54_0002=$((REG54 & 0x0002))
REG54_0002_VAL=$((REG54_0002 >> 1))
REG54_0004=$((REG54 & 0x0004))
REG54_0004_VAL=$((REG54_0004 >> 2))
REG54_0008=$((REG54 & 0x0008))
REG54_0008_VAL=$((REG54_0008 >> 3))
REG54_0010=$((REG54 & 0x0010))
REG54_0010_VAL=$((REG54_0010 >> 4))
REG54_0020=$((REG54 & 0x0020))
REG54_0020_VAL=$((REG54_0020 >> 5))
}
if [ -z "${powerState}" ]
then
echo "System is currently Powered off S6"
else
echo "System is currently in ${powerState} "
# Get Error Count
getErrorCount
echo " "
echo " Error Count: "
echo " Memory Errors: Correctable $((MemCE >> 8)) Uncorrectable $((MemUE >> 8)) "
echo " Core Errors: Correctable $((CoreCE >> 8)) Uncorrectable $((CoreUE >> 8))"
echo " PCIe Errors: Correctable $((PCIeCE >> 8)) Uncorrectable $((PCIeUE >> 8)) "
echo " Other Errors: Correctable $((OtherCE >> 8)) Uncorrectable $((OtherUE >> 8)) "
# GPI Source Registers
getGPISourceRegisters
echo " "
echo " GPI Source Registers: "
echo " GPI Data Set #0 Present: $((DS0Pres >> 8)) "
echo " GPI Data Set #1 Present: $((DS1Pres >> 9)) "
echo " GPI Data Set #2 Present: $((DS2Pres >> 10)) "
echo " GPI Data Set #3 Present: $((DS3Pres >> 11)) "
# REG61 Data Set#0
getReg61Vals
echo " "
echo " GPI Data Set#0: "
if [[ "$REG61_0800_VAL" != 0 ]]; then
echo " Platform Booting "
fi
if [[ "$REG61_1000_VAL" != 0 ]]; then
echo " Critical Stop "
fi
# REG62 Data Set#1
getReg62Vals
echo " "
echo " GPI Data Set#1: "
if [[ "$REG62_0100_VAL" != 0 ]]; then
echo " SoC VR HOT/Warn/Fault "
fi
if [[ "$REG62_0200_VAL" != 0 ]]; then
echo " Core VR HOT/Warn/Fault "
fi
if [[ "$REG62_0400_VAL" != 0 ]]; then
echo " DIMM HOT/Warn/Fault "
fi
# REG63 Data Set#2
getReg63Vals
echo " "
echo " GPI Data Set#2: "
if [[ "$REG63_0100_VAL" != 0 ]]; then
echo " DIMM HOT "
fi
# REG64 Data Set#3
getReg64Vals
echo " "
echo " GPI Data Set#3: "
if [[ "$REG64_0100_VAL" != 0 ]]; then
echo " Core Errors "
fi
if [[ "$REG64_0200_VAL" != 0 ]]; then
echo " Memory Errors "
fi
if [[ "$REG64_0800_VAL" != 0 ]]; then
echo " PCIe Errors "
fi
if [[ "$REG64_2000_VAL" != 0 ]]; then
echo " Other Errors "
fi
if [[ "$REG64_4000_VAL" != 0 ]]; then
echo " ACPI State Change "
fi
if [[ "$REG64_8000_VAL" != 0 ]]; then
echo " Boot Errors "
fi
if [[ "$REG64_0001_VAL" != 0 ]]; then
echo " RAS Internal Error "
fi
# GPI Status Regs
getGPIStatusRegisters
echo " "
echo " GPI Status Regs "
getReg70Vals
echo " "
echo " Core, DIMM, SLC, PCIe, and Other errors: "
if [[ "$REG70_0100_VAL" != 0 ]]; then
echo " Core CE Error "
fi
if [[ "$REG70_0200_VAL" != 0 ]]; then
echo " Core UE Error "
fi
if [[ "$REG70_0400_VAL" != 0 ]]; then
echo " DIMM CE Error "
fi
if [[ "$REG70_0800_VAL" != 0 ]]; then
echo " DIMM UE Error "
fi
if [[ "$REG70_4000_VAL" != 0 ]]; then
echo " PCIe CE Error "
fi
if [[ "$REG70_8000_VAL" != 0 ]]; then
echo " PCIe UE Error "
fi
if [[ "$REG70_0001_VAL" != 0 ]]; then
echo " Other CE Error "
fi
if [[ "$REG70_0002_VAL" != 0 ]]; then
echo " Other UE Error "
fi
getReg78Vals
echo " "
echo " VRD Fault/Warning Error: "
if [[ "$REG78_0100_VAL" != 0 ]]; then
echo " SoC VRD fault/warning "
fi
if [[ "$REG78_0200_VAL" != 0 ]]; then
echo " Core VRD1 fault/warning "
fi
if [[ "$REG78_0400_VAL" != 0 ]]; then
echo " Core VRD2 fault/warning "
fi
if [[ "$REG78_0800_VAL" != 0 ]]; then
echo " Core VRD3 fault/warning "
fi
if [[ "$REG78_1000_VAL" != 0 ]]; then
echo " DIMM VRD1 fault/warning "
fi
if [[ "$REG78_2000_VAL" != 0 ]]; then
echo " DIMM VRD2 fault/warning "
fi
if [[ "$REG78_4000_VAL" != 0 ]]; then
echo " DIMM VRD3 fault/warning "
fi
if [[ "$REG78_8000_VAL" != 0 ]]; then
echo " DIMM VRD3 fault/warning "
fi
if [[ "$REG78_0001_VAL" != 0 ]]; then
echo " DIMM fault/warning "
fi
if [[ "$REG78_0002_VAL" != 0 ]]; then
echo " DIMM fault/warning "
fi
if [[ "$REG78_0004_VAL" != 0 ]]; then
echo " DIMM fault/warning "
fi
if [[ "$REG78_0008_VAL" != 0 ]]; then
echo " DIMM fault/warning "
fi
getReg79Vals
echo " "
echo " VRD Hot: "
if [[ "$REG79_0100_VAL" != 0 ]]; then
echo " SoC VRD is HOT "
fi
if [[ "$REG79_1000_VAL" != 0 ]]; then
echo " Core VRD1 is HOT "
fi
if [[ "$REG79_2000_VAL" != 0 ]]; then
echo " Core VRD2 is HOT "
fi
if [[ "$REG79_4000_VAL" != 0 ]]; then
echo " Core VRD3 is HOT "
fi
if [[ "$REG79_0001_VAL" != 0 ]]; then
echo " DIMM VRD1 is HOT "
fi
if [[ "$REG79_0002_VAL" != 0 ]]; then
echo " DIMM VRD2 is HOT "
fi
if [[ "$REG79_0004_VAL" != 0 ]]; then
echo " DIMM VRD3 is HOT "
fi
if [[ "$REG79_0008_VAL" != 0 ]]; then
echo " DIMM VRD4 is HOT "
fi
getReg7AVals
echo " "
echo " DIMM Hot Error: "
if [[ "$REG7A_0100_VAL" != 0 ]]; then
echo " DIMM channel 0 is HOT "
fi
if [[ "$REG7A_0200_VAL" != 0 ]]; then
echo " DIMM channel 1 is HOT "
fi
if [[ "$REG7A_0400_VAL" != 0 ]]; then
echo " DIMM channel 2 is HOT "
fi
if [[ "$REG7A_0800_VAL" != 0 ]]; then
echo " DIMM channel 3 is HOT "
fi
if [[ "$REG7A_1000_VAL" != 0 ]]; then
echo " DIMM channel 4 is HOT "
fi
if [[ "$REG7A_2000_VAL" != 0 ]]; then
echo " DIMM channel 5 is HOT "
fi
if [[ "$REG7A_4000_VAL" != 0 ]]; then
echo " DIMM channel 6 is HOT "
fi
if [[ "$REG7A_8000_VAL" != 0 ]]; then
echo " DIMM channel 7 is HOT "
fi
echo " "
echo " Boot #1 Error: $((REG7B >> 8)) "
echo " Boot #2 Error: $((REG7C >> 8)) "
getReg7DVals
echo " "
echo " Watchdog/Other Status: "
if [[ "$REG7D_0100_VAL" != 0 ]]; then
echo " Non-secure WDT expired "
fi
if [[ "$REG7D_0200_VAL" != 0 ]]; then
echo " Secure WDT expired "
fi
if [[ "$REG7D_0400_VAL" != 0 ]]; then
echo " Firmware WDT expired "
fi
getReg7EVals
echo " "
echo " RAS internal error: "
if [[ "$REG7E_0100_VAL" != 0 ]]; then
echo " Error from SMpro "
fi
if [[ "$REG7E_0200_VAL" != 0 ]]; then
echo " Error from PMpro "
fi
# GPI Mask Regs
getGPIMaskRegisters
echo " "
echo " GPI Mask Regs "
getReg50Vals
echo " "
echo " GPI Control #0: "
if [[ "$REG50_0400_VAL" != 0 ]]; then
echo " Platform Booting "
fi
if [[ "$REG50_0800_VAL" != 0 ]]; then
echo " Critical Stop "
fi
getReg51Vals
echo " "
echo " GPI Control #1: "
if [[ "$REG51_0100_VAL" != 0 ]]; then
echo " SoC VR HOT/Warn/Fault "
fi
if [[ "$REG51_0200_VAL" != 0 ]]; then
echo " Core VR HOT/Warn/Fault "
fi
if [[ "$REG51_0400_VAL" != 0 ]]; then
echo " DIMM VRD HOT/Warn/Fault "
fi
getReg52Vals
echo " "
echo " GPI Control #2: "
if [[ "$REG52_0100_VAL" != 0 ]]; then
echo " DIMM HOT "
fi
getReg53Vals
echo " "
echo " GPI Control #3: "
if [[ "$REG53_0100_VAL" != 0 ]]; then
echo " Core Errors "
fi
if [[ "$REG53_0200_VAL" != 0 ]]; then
echo " Memory Errors "
fi
if [[ "$REG53_0800_VAL" != 0 ]]; then
echo " PCIe Errors "
fi
if [[ "$REG53_2000_VAL" != 0 ]]; then
echo " Other SoC Errors "
fi
if [[ "$REG53_4000_VAL" != 0 ]]; then
echo " ACPI State Change "
fi
if [[ "$REG53_8000_VAL" != 0 ]]; then
echo " Boot Errors "
fi
if [[ "$REG53_0001_VAL" != 0 ]]; then
echo " RAS Internal Error "
fi
getReg54Vals
echo " "
echo " GPI CE/UE Mask: "
if [[ "$REG54_0100_VAL" != 0 ]]; then
echo " Core CE "
fi
if [[ "$REG54_0200_VAL" != 0 ]]; then
echo " Core UE "
fi
if [[ "$REG54_0001_VAL" != 0 ]]; then
echo " DIMM CE "
fi
if [[ "$REG54_0002_VAL" != 0 ]]; then
echo " DIMM UE "
fi
if [[ "$REG54_0004_VAL" != 0 ]]; then
echo " PCIe CE "
fi
if [[ "$REG54_0008_VAL" != 0 ]]; then
echo " PCIe UE "
fi
if [[ "$REG54_0010_VAL" != 0 ]]; then
echo " Other CE "
fi
if [[ "$REG54_0020_VAL" != 0 ]]; then
echo " Other UE "
fi
fi
@@ -0,0 +1,312 @@
#!/bin/bash
# help information
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
function usage_rst() {
echo " kudo rst [parameter]"
echo " hotswap --> reset the whole kudo node"
echo " system --> reset the host"
echo " btn --> trigger a power button event"
echo " shutdown --> send out shutdown signal to CPU"
echo " display --> "
}
function usage_led() {
echo " kudo led 'att'/'boot' [parameter]"
echo " on --> change to CPU console"
echo " off --> change to CPU 0 SCP console"
echo " status --> change to CPU 1 SCP console"
}
function usage_uart() {
echo " kudo uart [parameter]"
echo " host --> show CPU console"
echo " scp --> show SCP0 console"
echo " swhost --> change to CPU console to ttyS1"
echo " swscp1 --> change to CPU 0 SCP console to ttyS3"
echo " swscp2 --> change to CPU 1 SCP console"
echo " swhosthr --> change CPU console to header"
echo " swscphr --> change SCP console to header"
echo " display --> "
}
function usage() {
echo " kudo BMC console system utilities"
echo " kudo [optional] [parameter]"
echo " rst --> reset traget device"
echo " fw --> get version"
echo " uart --> control the uart mux"
echo " led --> control the leds"
}
function reset() {
case $1 in
hotswap)
# Virtual reset
set_gpio_ctrl HOTSWAP 1
;;
system)
# S0 system reset
set_gpio_ctrl S0_SYSRESET 0
sleep 1
set_gpio_ctrl S0_SYSRESET 1
;;
btn)
# virtual power button
set_gpio_ctrl POWER_OUT 1
sleep 1
set_gpio_ctrl POWER_OUT 0
;;
shutdown)
# BMC_CPU_SHD_REQ
set_gpio_ctrl S0_SHD_REQ 0
sleep 3
set_gpio_ctrl S0_SHD_REQ 1
;;
forceOff)
# virtual power button
set_gpio_ctrl POWER_OUT 1
sleep 6
set_gpio_ctrl POWER_OUT 0
;;
display)
echo "Virtual reset #$(get_gpio_num HOTSWAP)" "$(get_gpio_ctrl HOTSWAP)"
echo "S0 System reset #$(get_gpio_num S0_SYSRESET)" "$(get_gpio_ctrl S0_SYSRESET)"
echo "Power Button #$(get_gpio_num POWER_OUT)" "$(get_gpio_ctrl POWER_OUT)"
echo "BMC_CPU SHD Req #$(get_gpio_num S0_SHD_REQ)" "$(get_gpio_ctrl S0_SHD_REQ)"
;;
*)
usage_rst
;;
esac
}
function fw_rev() {
BMC_CPLD_VER_FILE="/run/cpld0.version"
MB_CPLD_VER_FILE="/run/cpld1.version"
cmd=$(cat ${BMC_CPLD_VER_FILE})
echo " BMC_CPLD: " "${cmd}"
cmd=$(cat ${MB_CPLD_VER_FILE})
echo " MB_CPLD: " "${cmd}"
# BMC Version
# Save VERSION_ID line in string "VERSION_ID=vXX.XX-XX-kudo"
StringVersion=$(awk '/VERSION_ID/' /etc/os-release)
#Save Major Version value between v and . "vXX." then convert Hex to Decimal
MajorVersion=${StringVersion#*v}
MajorVersion=$(( 10#${MajorVersion%.*}))
#Save SubMajor Version valeu between . and - ".XX-" then convert Hex to Decimal
SubMajorVersion=${StringVersion##*.}
SubMajorVersion=$(( 10#${SubMajorVersion%%-*}))
#Save Minor Version value between - and - "-XX-" then convert Hex to Decimal
MinorVersion=${StringVersion#*-}
MinorVersion=$(( 10#${MinorVersion%-*}))
echo " BMC: " ${MajorVersion}.${SubMajorVersion}.${MinorVersion}
#BMC PWR Sequencer
i2cset -y -f -a "${I2C_BMC_PWRSEQ[0]}" 0x"${I2C_BMC_PWRSEQ[1]}" 0xfe 0x0000 w
cmd=$(i2cget -y -f -a "${I2C_BMC_PWRSEQ[0]}" 0x"${I2C_BMC_PWRSEQ[1]}" 0xfe i 2 | awk '{print substr($0,3)}')
echo " BMC PowerSequencer : ${cmd}"
#only display with smbios exists
if [[ -e /var/lib/smbios/smbios2 ]]; then
cmd=$(busctl introspect xyz.openbmc_project.Smbios.MDR_V2 \
/xyz/openbmc_project/inventory/system/chassis/motherboard/bios | grep Version | awk '{print $4}')
echo " Bios: $cmd"
fi
cmd=$(i2cget -f -y "${I2C_S0_SMPRO[0]}" 0x"${I2C_S0_SMPRO[1]}" 0x1 w);
echo " SCP Firmware: ${cmd}"
get_scp_eeprom
adm1266_ver "${I2C_MB_PWRSEQ1[0]}" | grep REVISION
}
function uartmux() {
case $1 in
host)
if [ "$(tty)" == "/dev/ttyS0" ]; then
echo "Couldn't redirect to the host console within BMC local console"
else
echo "Entering Console use 'shift ~~..' to quit"
obmc-console-client -c /etc/obmc-console/server.ttyS1.conf
fi
;;
scp)
if [ "$(tty)" == "/dev/ttyS0" ]; then
echo "Couldn't redirect to the scp console within BMC local console"
else
echo "Entering Console use 'shift ~~..' to quit"
obmc-console-client -c /etc/obmc-console/server.ttyS3.conf
fi
;;
swhost)
set_gpio_ctrl S0_UART0_BMC_SEL 1
;;
swscp1)
set_gpio_ctrl S0_UART1_BMC_SEL 1
set_gpio_ctrl S1_UART0_BMC_SEL 1
set_gpio_ctrl S1_UART1_BMC_SEL 0
;;
swscp2)
set_gpio_ctrl S0_UART1_BMC_SEL 1
set_gpio_ctrl S1_UART0_BMC_SEL 1
set_gpio_ctrl S1_UART1_BMC_SEL 1
;;
swhosthr)
set_gpio_ctrl S0_UART0_BMC_SEL 0
;;
swscphr)
set_gpio_ctrl S0_UART1_BMC_SEL 0
set_gpio_ctrl S1_UART0_BMC_SEL 0
;;
display)
if [ "$(get_gpio_ctrl S0_UART0_BMC_SEL)" -eq 1 ]; then
echo " CPU host to BMC console"
else
echo " CPU host to header"
fi
if [ "$(get_gpio_ctrl S0_UART1_BMC_SEL)" -eq 1 ] && [ "$(get_gpio_ctrl S1_UART0_BMC_SEL)" -eq 1 ]; then
if [ "$(get_gpio_ctrl S1_UART1_BMC_SEL)" -eq 1 ]; then
echo " SCP2 host to BMC console"
else
echo " SCP1 host to BMC console"
fi
elif [ "$(get_gpio_ctrl S0_UART1_BMC_SEL)" -eq 0 ] && [ "$(get_gpio_ctrl S1_UART0_BMC_SEL)" -eq 0 ]; then
if [ "$(get_gpio_ctrl S1_UART1_BMC_SEL)" -eq 1 ]; then
echo " SCP2 host to Header"
else
echo " SCP1 host to Header"
fi
else
echo "It's unknown status"
echo "S0_UART0_BMC_SEL $(get_gpio_ctrl S0_UART0_BMC_SEL)"
echo "S0_UART1_BMC_SEL $(get_gpio_ctrl S0_UART1_BMC_SEL)"
echo "S1_UART0_BMC_SEL $(get_gpio_ctrl S1_UART0_BMC_SEL)"
echo "S1_UART1_BMC_SEL $(get_gpio_ctrl S1_UART1_BMC_SEL)"
fi
;;
*)
usage_uart
;;
esac
}
function ledtoggle() {
CurrentLED=$( i2cget -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x05 i 1 | cut -d ' ' -f 2)
case $1 in
boot)
cmd=$(((CurrentLED & 0x40) != 0))
case $2 in
on)
#turn on LED
if [[ $cmd -eq 0 ]]; then
setValue=$(( 0x40 + CurrentLED ))
i2cset -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x10 $setValue
fi
;;
off)
#turn off led
if [[ $cmd -eq 1 ]]; then
setValue=$(( 0x80 & CurrentLED ))
i2cset -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x10 $setValue
fi
;;
toggle)
#turn on LED
setValue=$(( 0x40 ^ CurrentLED ))
i2cset -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x10 $setValue
;;
status)
#displayLED status
if [[ $cmd -eq 1 ]]; then
echo "on"
else
echo "off"
fi
;;
*)
usage_led
;;
esac
;;
att)
cmd=$(((CurrentLED & 0x80) != 0))
case $2 in
on)
#turn on LED
if [[ $cmd -eq 0 ]]; then
setValue=$(( 0x80 + CurrentLED ))
i2cset -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x10 $setValue
fi
;;
off)
#turn off led
if [[ $cmd -eq 1 ]]; then
setValue=$(( 0x40 & CurrentLED ))
i2cset -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x10 $setValue
fi
;;
toggle)
#turn on LED
setValue=$(( 0x80 ^ CurrentLED ))
i2cset -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x10 $setValue
;;
status)
#displayLED status
if [[ $cmd -eq 1 ]]; then
echo "on"
else
echo "off"
fi
;;
*)
usage_led
;;
esac
;;
*)
usage_led
;;
esac
}
function usblist() {
for i in {5..9}
do
cmd=$(devmem 0xf083"${i}"154)
printf "udc%d : 0xF083%d154-" "${i}" "${i}"
echo "$cmd"
done
}
case $1 in
rst)
reset "$2"
;;
fw)
fw_rev
;;
uart)
uartmux "$2"
;;
usb)
usblist
;;
led)
ledtoggle "$2" "$3"
;;
*)
usage
;;
esac
@@ -0,0 +1,16 @@
UMMARY = "Kudo IPMI Entity association mapping."
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
SRC_URI += "file://kudo_entity_association_map.json"
FILES:${PN} = " \
${datadir}/ipmi-entity-association/entity_association_map.json \
"
do_install() {
install -d ${D}${datadir}/ipmi-entity-association
install -m 0644 -D ${WORKDIR}/kudo_entity_association_map.json \
${D}${datadir}/ipmi-entity-association/entity_association_map.json
}
@@ -0,0 +1,35 @@
{
"system_board": [
{"instance": 1, "name": "/"}
],
"system_internal_expansion_board": [
{"instance": 1, "name": "/"}
],
"power_system_board": [
{"instance": 1, "name": "/"}
],
"add_in_card": [
{"instance": 3, "name": "/PE0"},
{"instance": 5, "name": "/PE1"},
{"instance": 6, "name": "/PE2"},
{"instance": 7, "name": "/PE3"},
{"instance": 8, "name": "/PE4"},
{"instance": 9, "name": "/PE5"},
{"instance": 10, "name": "/PE6"},
{"instance": 11, "name": "/PE7"}
],
"fan": [
{"instance": 0, "name": "/fan0"},
{"instance": 1, "name": "/fan1"},
{"instance": 2, "name": "/fan2"},
{"instance": 3, "name": "/fan3"},
{"instance": 4, "name": "/fan4"},
{"instance": 5, "name": "/fan5"}
],
"cooling_unit": [
{"instance": 0, "name": "/ZONE0"},
{"instance": 1, "name": "/ZONE1"},
{"instance": 2, "name": "/ZONE2"},
{"instance": 3, "name": "/ZONE3"}
]
}
@@ -0,0 +1,29 @@
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit allarch systemd
DEPENDS += "systemd"
RDEPENDS:${PN} += "libsystemd"
RDEPENDS:${PN} += "bash"
SRC_URI +=" \
file://usb_network.sh \
file://usb_network.service \
file://00-bmc-usb0.network \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} += " usb_network.service"
FILES:${PN} += "${sysconfdir_native}/systemd/network/00-bmc-usb0.network"
do_install() {
install -d ${D}${libexecdir}/${PN}
install -m 0755 ${WORKDIR}/usb_network.sh ${D}${libexecdir}/${PN}/usb_network.sh
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/usb_network.service ${D}${systemd_unitdir}/system
install -d ${D}${sysconfdir_native}/systemd/network/
install -m 0644 ${WORKDIR}/00-bmc-usb0.network ${D}${sysconfdir_native}/systemd/network
}
@@ -0,0 +1,7 @@
[Match]
Name=usb0
[Address]
Address=169.254.95.118/16
[Network]
LinkLocalAddressing=ipv6
IPv6AcceptRA=no
@@ -0,0 +1,10 @@
[Unit]
Description=enable usb network
After=phosphor-ipmi-host.service
[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/libexec/usb-network/usb_network.sh'
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,27 @@
#!/bin/bash
cd /sys/kernel/config/usb_gadget || exit 1
if [ ! -f "g1" ]; then
mkdir g1
cd g1 || exit 1
echo 0x1d6b > idVendor # Linux foundation
echo 0x0104 > idProduct # Multifunction composite gadget
mkdir -p strings/0x409
echo "Linux" > strings/0x409/manufacturer
echo "Ethernet/ECM gadget" > strings/0x409/product
mkdir -p configs/c.1
echo 100 > configs/c.1/MaxPower
mkdir -p configs/c.1/strings/0x409
echo "ECM" > configs/c.1/strings/0x409/configuration
mkdir -p functions/ecm.usb0
ln -s functions/ecm.usb0 configs/c.1
echo f0835000.udc > UDC
fi
exit 0
@@ -0,0 +1,62 @@
SUMMARY = "OpenBMC for kudo system - Applications"
PR = "r1"
inherit packagegroup
PROVIDES = "${PACKAGES}"
PACKAGES = " \
${PN}-kudo-chassis \
${PN}-kudo-system \
${PN}-kudo-fw \
${PN}-fan-mgmt \
"
PROVIDES += "virtual/obmc-chassis-mgmt"
PROVIDES += "virtual/obmc-system-mgmt"
PROVIDES += "virtual/obmc-fan-mgmt"
RPROVIDES:${PN}-kudo-chassis += "virtual-obmc-chassis-mgmt"
RPROVIDES:${PN}-kudo-system += "virtual-obmc-system-mgmt"
RPROVIDES:${PN}-kudo-fw += "virtual-obmc-flash-mgmt"
RPROVIDES:${PN}-fan-mgmt += "virtual-obmc-fan-mgmt"
SUMMARY:${PN}-kudo-chassis = "kudo chassis"
RDEPENDS:${PN}-kudo-chassis = " \
phosphor-skeleton-control-power \
obmc-phosphor-buttons-signals \
obmc-phosphor-buttons-handler \
"
SUMMARY:${PN}-kudo-system = "kudo System"
RDEPENDS:${PN}-kudo-system = " \
ipmitool \
ethtool \
memtester \
loadsvf \
fii-ipmi-oem \
kudo-entity-association-map \
hotswap-power-cycle \
obmc-console \
usb-network \
ncsid \
gbmc-mac-config \
kudo-boot \
kudo-cmd \
phosphor-state-manager \
smbios-mdr \
"
SUMMARY:${PN}-kudo-fw = "kudo Firmware"
RDEPENDS:${PN}-kudo-fw = " \
kudo-fw \
kudo-bios-update \
kudo-bmc-update \
kudo-cpld-update \
kudo-scp-update \
"
SUMMARY:${PN}-fan-mgmt = "kudo fan mgmt"
RDEPENDS:${PN}-fan-mgmt = " \
pwm-init \
phosphor-pid-control \
"
@@ -0,0 +1,3 @@
{
"buses": [1, 12]
}
@@ -0,0 +1,9 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
SRC_URI:append:kudo = " \
file://blacklist.json \
"
do_install:append:kudo () {
install -m 0644 -D ${WORKDIR}/blacklist.json ${D}${datadir}/${PN}/blacklist.json
}
@@ -0,0 +1,43 @@
#!/bin/bash
#
# Copyright (c) 2020 Ampere Computing LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Ampere Computing LLC mtjade: 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 BSP
# <UARTx_MODE> of 2 sets SCP1 to SI2
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
if [ $# -lt 1 ]; then
exit 1
fi
echo "Ampere UART MUX CTRL UART port $1 to mode" > /dev/ttyS0
case "$1" in
ttyS1)
set_gpio_ctrl S0_UART0_BMC_SEL 1
;;
ttyS3)
set_gpio_ctrl S0_UART1_BMC_SEL 1
set_gpio_ctrl S1_UART1_BMC_SEL 0
;;
*)
echo "Invalid tty passed to $0. Exiting!" > /dev/ttyS0
;;
esac
@@ -0,0 +1,18 @@
[Unit]
Description=Phosphor Console Muxer listening on device /dev/%I
BindsTo=dev-%i.device
After=dev-%i.device
StartLimitBurst=3
StartLimitIntervalSec=300
[Service]
ExecStartPre=/usr/libexec/obmc-console/kudo_uart_mux_ctrl.sh %i
ExecStart=/usr/sbin/obmc-console-server --config /etc/obmc-console/server.%i.conf %i
SyslogIdentifier=obmc-console-server
Restart=always
RestartSec=10
TimeoutStartSec=60
TimeoutStopSec=60
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,3 @@
baud = 115200
logfile = /var/log/obmc-console-cpu.log
logsize = 1M
@@ -0,0 +1,4 @@
baud = 115200
console-id = ttyS3
logfile = /var/log/obmc-console-scp.log
logsize = 1M
@@ -0,0 +1,27 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
RDEPENDS:${PN}:append:kudo = " bash"
OBMC_CONSOLE_TTYS = "ttyS1 ttyS3"
SRC_URI:append:kudo = " file://${BPN}@.service \
file://kudo_uart_mux_ctrl.sh \
file://server.ttyS1.conf \
file://server.ttyS3.conf \
"
SYSTEMD_SERVICE:${PN}:append:kudo = " \
${BPN}@.service \
"
do_install:append() {
# Overwrite base package's obmc-console@.service with our own
install -m 0644 ${WORKDIR}/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@.service
install -d ${D}${libexecdir}/${PN}
install -m 0755 ${WORKDIR}/kudo_uart_mux_ctrl.sh ${D}${libexecdir}/${PN}/kudo_uart_mux_ctrl.sh
}
pkg_postinst:${PN}:append () {
systemctl --root=$D enable obmc-console@ttyS1.service
systemctl --root=$D enable obmc-console@ttyS3.service
}
@@ -0,0 +1,29 @@
SUMMARY = "Initialize PWM sensors"
DESCRIPTION = "Initialize PWM sensors"
LICENSE = "CLOSED"
PR = "r1"
inherit systemd
DEPENDS = "systemd"
RDEPENDS:${PN} = "bash"
S = "${WORKDIR}"
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += " \
file://pwm_init.service \
file://bin/pwm_init.sh \
"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_AUTO_ENABLE = "enable"
SYSTEMD_SERVICE:${PN} += "pwm_init.service"
FILES:${PN} += "${bindir}/* ${systemd_system_unitdir}/*"
do_install:append() {
install -d ${D}${libexecdir}/${PN}
install -m 0755 ${S}/bin/* ${D}${libexecdir}/${PN}/
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${S}/*.service ${D}${systemd_system_unitdir}
}
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Set all fans to pwm mode.
# Provide source directive to shellcheck.
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
source /usr/libexec/kudo-fw/kudo-lib.sh
# Set all pwm_enable to 1
find /sys/class/hwmon/hwmon*/ -name 'pwm*_enable' -exec bash -c 'echo "$1" && echo 1 > "$1" && cat "$1"' -- {} \;
for i in {0..5}
do
fan_pwm_rate_of_change=0x$(printf '%02x' $((8 + i)) | \
awk '{print $1}')
# Set Fan PWM Rate-of-Change Bits(bits 4:2) to 000b
# Register 08h to 0Dh
oriRegVal=$(i2cget -y -f "${I2C_FANCTRL[0]}" 0x"${I2C_FANCTRL[1]}" \
"${fan_pwm_rate_of_change}")
updateVal=$((oriRegVal & 0xe3))
updateVal=0x$(printf "%x" ${updateVal})
i2cset -y -f "${I2C_FANCTRL[0]}" 0x"${I2C_FANCTRL[1]}" \
"${fan_pwm_rate_of_change}" "${updateVal}"
done
@@ -0,0 +1,11 @@
[Unit]
Description=Init PWM sensors
Before=xyz.openbmc_project.fansensor.service
[Service]
Type=oneshot
ExecStart=/usr/libexec/pwm-init/pwm_init.sh
[Install]
WantedBy=multi-user.target
WantedBy=xyz.openbmc_project.fansensor.service
@@ -0,0 +1,12 @@
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-ipmi-blobs"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-ipmi-blobs-binarystore"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-ipmi-ethstats"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-ipmi-flash"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-ipmi-net"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-ipmi-host"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-host-postd"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-logging"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-sel-logger"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " entity-manager"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " dbus-sensors"
OBMC_IMAGE_EXTRA_INSTALL:append:kudo = " phosphor-virtual-sensor"
@@ -0,0 +1,4 @@
EXTRA_OEMESON:append:kudo = " \
-Dredfish-dump-log=enabled \
-Dredfish-bmc-journal=enabled \
"
@@ -0,0 +1,5 @@
[{
"blobBaseId": "/skm/hss/",
"sysFilePath": "/sys/bus/i2c/devices/i2c-4/i2c-33/33-0055/eeprom",
"offsetBytes": 0
}]
@@ -0,0 +1,8 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
SRC_URI:append:kudo = " file://config.json"
FILES:${PN}:append:kudo = " ${datadir}/binaryblob/config.json"
do_install:append:kudo() {
install -d ${D}${datadir}/binaryblob/
install ${WORKDIR}/config.json ${D}${datadir}/binaryblob/config.json
}
@@ -0,0 +1,6 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
# Remove unused entity-map JSON
do_install:append:kudo() {
rm ${D}${datadir}/ipmi-providers/entity-map.json
}
@@ -0,0 +1,2 @@
{"id": 0, "revision": 1, "addn_dev_support": 133,
"manuf_id": 17084, "prod_id": 1, "aux": 0}
@@ -0,0 +1,3 @@
PACKAGECONFIG:append:kudo = " nuvoton-p2a-mbox net-bridge"
IPMI_FLASH_BMC_ADDRESS:kudo = "0xF0848000"
@@ -0,0 +1 @@
CHASSIS_TARGETS = ""
@@ -0,0 +1,2 @@
# Enable threshold, pulse, and watchdog monitoring; enable clear SEL method
PACKAGECONFIG:append:kudo = " log-threshold log-pulse log-watchdog clears-sel"
@@ -0,0 +1,302 @@
[
{
"Desc":{
"Name":"CPU0_NBM_T",
"SensorType":"temperature",
"MinValue":0,
"MaxValue":160
},
"Threshold":
{
"CriticalHigh":110,
"WarningHigh":108
},
"Associations":[
[
"chassis",
"all_sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
],
[
"inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
]
],
"Params":{
"DbusParam":[
{
"ParamName":"CPU0_NBM2G_TMP_V",
"Desc":{
"Name":"CPU0_NBM2G_TMP_V",
"SensorType":"voltage"
}
},
{
"ParamName":"CPU0_NBM4G_TMP_V",
"Desc":{
"Name":"CPU0_NBM4G_TMP_V",
"SensorType":"voltage"
}
}
]
},
"Expression":"(CPU0_NBM4G_TMP_V == CPU0_NBM4G_TMP_V) ? (CPU0_NBM4G_TMP_V - 1.911) / 0.007 : (CPU0_NBM2G_TMP_V == CPU0_NBM2G_TMP_V) ? (CPU0_NBM2G_TMP_V - 2.73) * 100 : NULL"
},
{
"Desc":{
"Name":"CPU0_DIMMG_T",
"SensorType":"temperature",
"MinValue":0,
"MaxValue":255
},
"Threshold":
{
"CriticalHigh":90,
"WarningHigh":85
},
"Associations":[
[
"chassis",
"all_sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
],
[
"inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
]
],
"Params":{
"DbusParam":[
{
"ParamName":"CPU0_CH0",
"Desc":{
"Name":"CPU0_CH0DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH1",
"Desc":{
"Name":"CPU0_CH1DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH2",
"Desc":{
"Name":"CPU0_CH2DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH3",
"Desc":{
"Name":"CPU0_CH3DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH4",
"Desc":{
"Name":"CPU0_CH4DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH5",
"Desc":{
"Name":"CPU0_CH5DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH6",
"Desc":{
"Name":"CPU0_CH6DIMM_T",
"SensorType":"temperature"
}
},
{
"ParamName":"CPU0_CH7",
"Desc":{
"Name":"CPU0_CH7DIMM_T",
"SensorType":"temperature"
}
}
]
},
"Expression":"var x := max((CPU0_CH0 == CPU0_CH0) ? CPU0_CH0 : 0,(CPU0_CH1 == CPU0_CH1) ? CPU0_CH1 : 0,(CPU0_CH2 == CPU0_CH2) ? CPU0_CH2 : 0,(CPU0_CH3 == CPU0_CH3) ? CPU0_CH3 : 0,(CPU0_CH4 == CPU0_CH4) ? CPU0_CH4 : 0,(CPU0_CH5 == CPU0_CH5) ? CPU0_CH5 : 0,(CPU0_CH6 == CPU0_CH6) ? CPU0_CH6 : 0,(CPU0_CH7 == CPU0_CH7) ? CPU0_CH7 : 0); x == 0 ? NULL : x"
},
{
"Desc":{
"Name":"CPU0_DIMM_DDR_V",
"SensorType":"voltage",
"MinValue":0,
"MaxValue":5
},
"Threshold":
{
"CriticalHigh":2.999
},
"Associations":[
[
"chassis",
"all_sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
],
[
"inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
]
],
"Params":{
"DbusParam":[
{
"ParamName":"CPU0_DIMM_VR1_V",
"Desc":{
"Name":"CPU0_DIMM_VR1_V",
"SensorType":"voltage"
}
},
{
"ParamName":"CPU0_DIMM_VR2_V",
"Desc":{
"Name":"CPU0_DIMM_VR2_V",
"SensorType":"voltage"
}
}
]
},
"Expression":"(CPU0_DIMM_VR1_V + CPU0_DIMM_VR2_V) >= 0 ? (CPU0_DIMM_VR1_V + CPU0_DIMM_VR2_V) : NULL"
},
{
"Desc":{
"Name":"CPU0_MEM_PW",
"SensorType":"power",
"MinValue":0,
"MaxValue":200
},
"Threshold":
{
"CriticalHigh":100
},
"Associations":[
[
"chassis",
"all_sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
],
[
"inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
]
],
"Params":{
"DbusParam":[
{
"ParamName":"CPU0_DIMM_VR1_PW",
"Desc":{
"Name":"CPU0_DIMM_VR1_PW",
"SensorType":"power"
}
},
{
"ParamName":"CPU0_DIMM_VR2_PW",
"Desc":{
"Name":"CPU0_DIMM_VR2_PW",
"SensorType":"power"
}
}
]
},
"Expression":"(CPU0_DIMM_VR1_PW + CPU0_DIMM_VR2_PW) >= 0 ? (CPU0_DIMM_VR1_PW + CPU0_DIMM_VR2_PW) : NULL"
},
{
"Desc":{
"Name":"CPU0_CPU_PW",
"SensorType":"power",
"MinValue":0,
"MaxValue":550
},
"Threshold":
{
"CriticalHigh":500
},
"Associations":[
[
"chassis",
"all_sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
],
[
"inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
]
],
"Params":{
"DbusParam":[
{
"ParamName":"CPU0_Core_VRD_PW",
"Desc":{
"Name":"CPU0_Core_VRD_PW",
"SensorType":"power"
}
},
{
"ParamName":"CPU0_SOC_PW",
"Desc":{
"Name":"CPU0_SOC_PW",
"SensorType":"power"
}
}
]
},
"Expression":"(CPU0_Core_VRD_PW + CPU0_SOC_PW) >= 0 ? (CPU0_Core_VRD_PW + CPU0_SOC_PW) : NULL"
},
{
"Desc":
{
"Name": "zone0_temp",
"SensorType": "temperature",
"MinValue": 0,
"MaxValue": 300
},
"Threshold" :
{
"CriticalHigh": 200,
"WarningHigh": 198
},
"Associations":[
[
"chassis",
"all_sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
],
[
"inventory",
"sensors",
"/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
]
],
"Params":
{
"DbusParam":
[
{
"ParamName": "margin0",
"Desc":
{
"Name": "thermal_zone0",
"SensorType": "temperature"
}
}
]
},
"Expression": "(200 - margin0)"
}
]
@@ -0,0 +1,13 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
inherit systemd
RDEPENDS:${PN} += "bash"
SRC_URI:append:kudo = " \
file://virtual_sensor_config.json \
"
do_install:append:kudo() {
install -d ${D}${datadir}
install -m 0644 ${WORKDIR}/virtual_sensor_config.json ${D}${datadir}/phosphor-virtual-sensor/virtual_sensor_config.json
}
@@ -0,0 +1,23 @@
/xyz/openbmc_project/control/chassis0/chassiscapabilities:
- Interface: xyz.openbmc_project.Control.ChassisCapabilities
Properties:
CapabilitiesFlags:
Default: 32
ChassisIntrusionEnabled:
Default: 'true'
ChassisFrontPanelLockoutEnabled:
Default: 'true'
ChassisNMIEnabled:
Default: 'true'
ChassisPowerInterlockEnabled:
Default: 'true'
FRUDeviceAddress:
Default: 32
SDRDeviceAddress:
Default: 32
SELDeviceAddress:
Default: 32
SMDeviceAddress:
Default: 32
BridgeDeviceAddress:
Default: 32
@@ -0,0 +1,2 @@
FILESEXTRAPATHS:append:kudo := ":${THISDIR}/${PN}"
SRC_URI:append:kudo = " file://chassis_capabilities.override.yml"
@@ -0,0 +1,31 @@
{
"gpio_configs": {
"power_config": {
"power_good_in": "PGOOD",
"power_up_outs": [
],
"reset_outs": [
]
}
},
"gpio_definitions": [
{
"name": "PGOOD",
"num": 200,
"direction": "in"
},
{
"name": "POWER_BUTTON",
"num": 192,
"direction": "both"
},
{
"name": "RESET_BUTTON",
"num": 13,
"direction": "both"
}
]
}
@@ -0,0 +1,3 @@
FILESEXTRAPATHS:append:kudo := ":${THISDIR}/${PN}"
SRC_URI:append:kudo = " file://gpio_defs.json"
@@ -0,0 +1,3 @@
PACKAGECONFIG:append:kudo = " smbios-ipmi-blob"
PACKAGECONFIG:remove:kudo = " cpuinfo"
@@ -0,0 +1,15 @@
[Unit]
Description=Phosphor Chassis%i State Manager
Before=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
After=org.openbmc.control.Power@%i.service
After=host-powerctrl.service
[Service]
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/phosphor-chassis-state-manager --chassis %i
Restart=always
Type=dbus
BusName=xyz.openbmc_project.State.Chassis%i
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,17 @@
[Unit]
Description=Phosphor Host%i State Manager
Wants=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot.service
After=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot.service
Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
After=phosphor-ipmi-host.service
Before=obmc-host-reset@%i.target
[Service]
ExecStart=/usr/bin/phosphor-host-state-manager --host %i
Restart=always
Type=dbus
BusName=xyz.openbmc_project.State.Host%i
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,52 @@
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
DEPENDS:append:kudo = " gpioplus"
STATE_MGR_PACKAGES:remove:kudo = " ${PN}-host-check"
RRECOMMENDS:${PN}-host:remove:kudo = " ${PN}-host-check"
EXTRA_OEMESON:append:kudo = " -Dhost-gpios=enabled"
FILES:${PN}:append:kudo = " ${systemd_system_unitdir}/*"
FILES:${PN}-host:append:kudo = " ${bindir}/phosphor-host-condition-gpio"
SYSTEMD_SERVICE:${PN}-host:append:kudo = " phosphor-host-condition-gpio@.service"
pkg_postinst:${PN}-obmc-targets:prepend:kudo() {
mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-host-condition-gpio@0.service"
TARGET="../phosphor-host-condition-gpio@.service"
ln -s $TARGET $LINK
}
pkg_postinst:${PN}-obmc-targets:append:kudo() {
rm "$D$systemd_system_unitdir/obmc-host-shutdown@0.target.requires/obmc-chassis-poweroff@0.target"
rm "$D$systemd_system_unitdir/obmc-host-warm-reboot@0.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
rm "$D$systemd_system_unitdir/obmc-host-warm-reboot@0.target.requires/obmc-host-force-warm-reboot@0.target"
rm "$D$systemd_system_unitdir/obmc-host-reboot@0.target.requires/phosphor-reboot-host@0.service"
rm "$D$systemd_system_unitdir/obmc-host-reboot@0.target.requires/obmc-host-shutdown@0.target"
rm "$D$systemd_system_unitdir/obmc-host-force-warm-reboot@0.target.requires/obmc-host-stop@0.target"
rm "$D$systemd_system_unitdir/obmc-host-force-warm-reboot@0.target.requires/phosphor-reboot-host@0.service"
rm "$D$systemd_system_unitdir/obmc-host-reset@0.target.requires/phosphor-reset-host-running@0.service"
}
pkg_prerm:${PN}-obmc-targets:prepend:kudo() {
LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-host-condition-gpio@0.service"
rm $LINK
}
SRC_URI:append:kudo = " \
file://xyz.openbmc_project.State.Chassis@.service \
file://xyz.openbmc_project.State.Host@.service \
"
do_install:append:kudo() {
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/xyz.openbmc_project.State.Chassis@.service ${D}${systemd_system_unitdir}/xyz.openbmc_project.State.Chassis@.service
install -m 0644 ${WORKDIR}/xyz.openbmc_project.State.Host@.service ${D}${systemd_system_unitdir}/xyz.openbmc_project.State.Host@.service
rm -f ${D}${systemd_system_unitdir}/phosphor-reset-host-check@.service
rm -f ${D}${systemd_system_unitdir}/phosphor-reset-host-running@.service
}
@@ -0,0 +1,8 @@
[Unit]
Description=Watchdog power state power hotswap
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/sbin/kudo.sh rst hotswap
SyslogIdentifier=phosphor-watchdog
@@ -0,0 +1,8 @@
[Unit]
Description=Watchdog power state power cycle shutdown
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/libexec/ampere-hostctrl/ampere_power_util.sh mb off
SyslogIdentifier=phosphor-watchdog

Some files were not shown because too many files have changed in this diff Show More