Initial commit
This commit is contained in:
@@ -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.
|
||||
@@ -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.
|
||||
@@ -0,0 +1,12 @@
|
||||
Different components of meta-ampere 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.
|
||||
@@ -0,0 +1,3 @@
|
||||
owners:
|
||||
- thang@os.amperecomputing.com
|
||||
- thu@os.amperecomputing.com
|
||||
@@ -0,0 +1,10 @@
|
||||
# We have a conf and classes directory, add to BBPATH
|
||||
BBPATH .= ":${LAYERDIR}"
|
||||
|
||||
# We have recipes-* directories, add to BBFILES
|
||||
BBFILES += "${LAYERDIR}/meta-common/recipes-*/*/*.bb \
|
||||
${LAYERDIR}/meta-common/recipes-*/*/*.bbappend"
|
||||
|
||||
BBFILE_COLLECTIONS += "ampere-layer"
|
||||
BBFILE_PATTERN_ampere-layer := "^${LAYERDIR}/"
|
||||
LAYERSERIES_COMPAT_ampere-layer = "langdale mickledore"
|
||||
@@ -0,0 +1,35 @@
|
||||
SUMMARY = "Phosphor OpenBMC Boot Progress Handling Service"
|
||||
DESCRIPTION = "Phosphor OpenBMC Altra Boot Progress Handling Daemon"
|
||||
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit systemd
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
DEPENDS += "systemd"
|
||||
RDEPENDS:${PN} += "libsystemd"
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
SRC_URI = " \
|
||||
file://ampere_boot_progress.sh \
|
||||
file://dimm_train_fail_log.sh \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
|
||||
HOST_ON_RESET_HOSTTMPL = "ampere-boot-progress.service"
|
||||
HOST_ON_RESET_HOSTINSTMPL = "ampere-boot-progress.service"
|
||||
HOST_ON_RESET_HOSTTGTFMT = "obmc-host-already-on@{0}.target"
|
||||
HOST_ON_RESET_HOSTFMT = "../${HOST_ON_RESET_HOSTTMPL}:${HOST_ON_RESET_HOSTTGTFMT}.requires/${HOST_ON_RESET_HOSTINSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_ON_RESET_HOSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} += "${HOST_ON_RESET_HOSTTMPL}"
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/ampere_boot_progress.sh ${D}${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/dimm_train_fail_log.sh ${D}${sbindir}/
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Ampere Altra Boot Progress Handling
|
||||
After=obmc-host-already-on@0.target
|
||||
BindTo=obmc-host-already-on@0.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/ampere_boot_progress.sh
|
||||
SyslogIdentifier=ampere-boot-progress
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
#!/bin/bash
|
||||
# Initialize variables
|
||||
boot_stage=00
|
||||
boot_status=00
|
||||
uefi_code=00000000
|
||||
|
||||
function set_postcode()
|
||||
{
|
||||
# shellcheck disable=SC2086
|
||||
busctl set-property xyz.openbmc_project.State.Boot.Raw \
|
||||
/xyz/openbmc_project/state/boot/raw0 \
|
||||
xyz.openbmc_project.State.Boot.Raw Value \(tay\) "$1" 0
|
||||
}
|
||||
|
||||
function update_boot_progress_last_state_time()
|
||||
{
|
||||
# Get BMC current time
|
||||
bp_last_state_time=$(busctl get-property xyz.openbmc_project.Time.Manager \
|
||||
/xyz/openbmc_project/time/bmc \
|
||||
xyz.openbmc_project.Time.EpochTime \
|
||||
Elapsed | cut -d' ' -f2)
|
||||
|
||||
# Update the Boot Progress LastStateTime
|
||||
busctl set-property xyz.openbmc_project.State.Host \
|
||||
/xyz/openbmc_project/state/host0 \
|
||||
xyz.openbmc_project.State.Boot.Progress \
|
||||
BootProgressLastUpdate t \
|
||||
"$bp_last_state_time"
|
||||
}
|
||||
|
||||
function update_boot_progress()
|
||||
{
|
||||
bootprog=$1
|
||||
|
||||
busctl set-property xyz.openbmc_project.State.Host \
|
||||
/xyz/openbmc_project/state/host0 \
|
||||
xyz.openbmc_project.State.Boot.Progress \
|
||||
BootProgress s \
|
||||
"xyz.openbmc_project.State.Boot.Progress.ProgressStages.$bootprog"
|
||||
|
||||
# Update Boot Progress LastStateTime
|
||||
update_boot_progress_last_state_time
|
||||
}
|
||||
|
||||
function get_boot_stage_string()
|
||||
{
|
||||
bootstage=$1
|
||||
ueficode=$2
|
||||
|
||||
case $bootstage in
|
||||
|
||||
00)
|
||||
boot_stage_str="SMpro"
|
||||
;;
|
||||
|
||||
01)
|
||||
boot_stage_str="PMpro"
|
||||
;;
|
||||
|
||||
02)
|
||||
boot_stage_str="ATF BL1 (Code=${ueficode})"
|
||||
;;
|
||||
|
||||
03)
|
||||
boot_stage_str="DDR initialization (Code=${ueficode})"
|
||||
;;
|
||||
|
||||
04)
|
||||
boot_stage_str="DDR training progress (Code=${ueficode})"
|
||||
;;
|
||||
|
||||
05)
|
||||
boot_stage_str="ATF BL2 (Code=${ueficode})"
|
||||
;;
|
||||
|
||||
06)
|
||||
boot_stage_str="ATF BL31 (Code=${ueficode})"
|
||||
;;
|
||||
|
||||
07)
|
||||
boot_stage_str="ATF BL32 (Code=${ueficode})"
|
||||
;;
|
||||
|
||||
08)
|
||||
boot_stage_str="UEFI booting (UEFI Code=${ueficode})"
|
||||
;;
|
||||
09)
|
||||
boot_stage_str="OS booting"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
echo "$boot_stage_str"
|
||||
}
|
||||
|
||||
function set_boot_progress()
|
||||
{
|
||||
boot_stage=$1
|
||||
uefi_code=$2
|
||||
|
||||
case $boot_stage in
|
||||
|
||||
02)
|
||||
update_boot_progress "PrimaryProcInit"
|
||||
;;
|
||||
|
||||
03)
|
||||
update_boot_progress "MemoryInit"
|
||||
;;
|
||||
|
||||
08)
|
||||
if [[ "$uefi_code" =~ 0201* ]]; then
|
||||
update_boot_progress "PCIInit"
|
||||
fi
|
||||
;;
|
||||
09)
|
||||
update_boot_progress "OSStart"
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
function log_redfish_biosboot_ok_event()
|
||||
{
|
||||
logger-systemd --journald << EOF
|
||||
MESSAGE=
|
||||
PRIORITY=2
|
||||
SEVERITY=
|
||||
REDFISH_MESSAGE_ID=OpenBMC.0.1.BIOSBoot.OK
|
||||
REDFISH_MESSAGE_ARGS="UEFI firmware booting done"
|
||||
EOF
|
||||
}
|
||||
|
||||
function log_redfish_bios_panic_event()
|
||||
{
|
||||
boot_state_str=$(get_boot_stage_string "$1" "$2")
|
||||
|
||||
logger-systemd --journald << EOF
|
||||
MESSAGE=
|
||||
PRIORITY=2
|
||||
SEVERITY=
|
||||
REDFISH_MESSAGE_ID=OpenBMC.0.1.BIOSFirmwarePanicReason.Warning
|
||||
REDFISH_MESSAGE_ARGS=${boot_state_str}
|
||||
EOF
|
||||
}
|
||||
|
||||
cnt=0
|
||||
# If any reason makes SCP fail to access in 6s, break the service.
|
||||
while [ $cnt -lt 30 ];
|
||||
do
|
||||
# Sleep 200ms
|
||||
sleep 1s
|
||||
if ! read -r bg <<< "$(cat /sys/bus/platform/devices/smpro-misc.2.auto/boot_progress)";
|
||||
then
|
||||
cnt=$((cnt + 1))
|
||||
continue
|
||||
fi
|
||||
cnt=0
|
||||
|
||||
# Check if any update from previous check
|
||||
if [ "$last_bg" == "$bg" ]; then
|
||||
continue
|
||||
fi
|
||||
last_bg=$bg
|
||||
|
||||
# Check if the Host is already ON or not. If Host is already boot, update boot progress and break.
|
||||
if [ "${boot_stage}" == "00" ] && [ "${bg[0]}" == "09" ];
|
||||
then
|
||||
update_boot_progress "OSRunning"
|
||||
break
|
||||
fi
|
||||
|
||||
# Update current boot progress
|
||||
boot_stage=${bg:2:2}
|
||||
boot_status=${bg:0:2}
|
||||
uefi_code=${bg:4}
|
||||
echo "Boot Progress = ${boot_stage} ${boot_status} ${uefi_code}"
|
||||
|
||||
# Log Boot Progress to dbus
|
||||
if [ "${boot_status}" == "03" ]; then
|
||||
# Log Redfish Event if failure.
|
||||
log_redfish_bios_panic_event "$boot_stage" "$uefi_code"
|
||||
# Dimm training failed, check errors
|
||||
if [ "${boot_stage}" == "04" ]; then
|
||||
/usr/sbin/dimm_train_fail_log.sh 0
|
||||
/usr/sbin/dimm_train_fail_log.sh 1
|
||||
fi
|
||||
elif [ "${boot_status}" == "01" ]; then
|
||||
# Check and set boot progress to dbus
|
||||
set_boot_progress "$boot_stage" "$uefi_code"
|
||||
fi
|
||||
|
||||
# Log POST Code to dbus.
|
||||
set_postcode "0x$boot_stage$boot_status$uefi_code"
|
||||
|
||||
# Stop the service when booting to OS
|
||||
if [ "${boot_stage}" == "08" ] && [ "${boot_status}" == "02" ]; then
|
||||
update_boot_progress "SystemInitComplete"
|
||||
log_redfish_biosboot_ok_event
|
||||
elif [ "${boot_stage}" == "09" ] && [ "${boot_status}" == "02" ];
|
||||
then
|
||||
update_boot_progress "OSRunning"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
#!/bin/bash
|
||||
smpro_path() {
|
||||
if [ "$1" == 0 ]; then
|
||||
echo "/sys/bus/i2c/drivers/smpro-core/2-004f"
|
||||
else
|
||||
echo "/sys/bus/i2c/drivers/smpro-core/2-004e"
|
||||
fi
|
||||
}
|
||||
|
||||
function log_ampere_oem_redfish_event()
|
||||
{
|
||||
msg=$1
|
||||
priority=$2
|
||||
severity=$3
|
||||
msgID=$4
|
||||
msgArgs1=$5
|
||||
msgArgs2=$6
|
||||
|
||||
logger-systemd --journald << EOF
|
||||
MESSAGE=${msg}
|
||||
PRIORITY=${priority}
|
||||
SEVERITY=${severity}
|
||||
REDFISH_MESSAGE_ID=${msgID}
|
||||
REDFISH_MESSAGE_ARGS=${msgArgs1},${msgArgs2}
|
||||
EOF
|
||||
}
|
||||
|
||||
parse_phy_syndrome_s1_type() {
|
||||
s1=$1
|
||||
slice=$((s1 & 0xf))
|
||||
ubit=$(((s1 & 0x10) >> 4))
|
||||
lbit=$(((s1 & 0x20) >> 5))
|
||||
uMsg="Upper Nibble: No Error"
|
||||
lMsg="Lower Nibble: No Error"
|
||||
if [ $ubit == 1 ]; then
|
||||
uMsg="Upper Nibble: No rising edge error"
|
||||
fi
|
||||
if [ $lbit == 1 ]; then
|
||||
lMsg="Lower Nibble: No rising edge error"
|
||||
fi
|
||||
echo "Slice $slice: $uMsg, $lMsg"
|
||||
}
|
||||
|
||||
parse_phy_syndrome() {
|
||||
s0=$1
|
||||
s1=$2
|
||||
case $s0 in
|
||||
1)
|
||||
echo "PHY Training Setup failure"
|
||||
;;
|
||||
2)
|
||||
s1Msg=$(parse_phy_syndrome_s1_type "$s1")
|
||||
echo "PHY Write Leveling failure: $s1Msg"
|
||||
;;
|
||||
3)
|
||||
echo "PHY Read Gate Leveling failure"
|
||||
;;
|
||||
4)
|
||||
echo "PHY Read Leveling failure"
|
||||
;;
|
||||
5)
|
||||
echo "PHY Software Training failure"
|
||||
;;
|
||||
*)
|
||||
echo "N/A"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_dimm_syndrome() {
|
||||
s0=$1
|
||||
case $s0 in
|
||||
1)
|
||||
echo "DRAM VREFDQ Training failure"
|
||||
;;
|
||||
2)
|
||||
echo "LRDIMM DB Training failure"
|
||||
;;
|
||||
3)
|
||||
echo "LRDIMM DB Software Training failure"
|
||||
;;
|
||||
*)
|
||||
echo "N/A"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
log_err_to_redfish_err() {
|
||||
channel="$(printf '%d' "0x$1" 2>/dev/null)"
|
||||
data="$(printf '%d' "0x$2" 2>/dev/null)"
|
||||
trErrType=$((data & 0x03))
|
||||
rank=$(((data & 0x1C) >> 2))
|
||||
syndrome0=$(((data & 0xE0) >> 5))
|
||||
syndrome1=$(((data & 0xFF00) >> 8))
|
||||
|
||||
# PHY sysdrom errors
|
||||
fType=""
|
||||
redfisComp="DIMM"
|
||||
redfisMsg=""
|
||||
if [ $trErrType == 1 ]; then
|
||||
fType="PHY training failure"
|
||||
redfisMsg=$(parse_phy_syndrome $syndrome0 $syndrome1)
|
||||
# DIMM traning errors
|
||||
elif [ $trErrType == 2 ]; then
|
||||
fType="DIMM training failure"
|
||||
redfisMsg=$(parse_dimm_syndrome $syndrome0)
|
||||
else
|
||||
fType="Invalid DIMM Syndrome error type"
|
||||
redfisMsg="NA"
|
||||
fi
|
||||
|
||||
#smg=$("DDR training: MCU rank $rank: $fType: $redfisMsg")
|
||||
log_ampere_oem_redfish_event \
|
||||
"" 2 "" "OpenBMC.0.1.AmpereCritical.Critical" \
|
||||
$redfisComp "Slot $channel MCU rank $rank: $fType: $redfisMsg"
|
||||
}
|
||||
|
||||
log_err_to_sel_err() {
|
||||
channel="$(printf '%d' "0x$1" 2>/dev/null)"
|
||||
data="$(printf '%d' "0x$2" 2>/dev/null)"
|
||||
byte0=$(((data & 0xff00) >> 8))
|
||||
byte1=$((data & 0xff))
|
||||
evtdata0=$((EVENT_DIR_ASSERTION | OEM_SENSOR_SPECIFIC))
|
||||
evtdata1=$(((channel << 4) | BOOT_SYNDROME_DATA | (socket << 3)))
|
||||
|
||||
# phy sysdrom errors
|
||||
# OEM data bytes
|
||||
# oem id: 3 bytes [0x3a 0xcd 0x00]
|
||||
# sensor num: 1 bytes
|
||||
# sensor type: 1 bytes
|
||||
# data bytes: 4 bytes
|
||||
# sel type: 4 byte [0x00 0x00 0x00 0xC0]
|
||||
busctl call xyz.openbmc_project.Logging.IPMI \
|
||||
/xyz/openbmc_project/Logging/IPMI \
|
||||
xyz.openbmc_project.Logging.IPMI IpmiSelAddOem \
|
||||
sayy "" 12 \
|
||||
0x3a 0xcd 0x00 \
|
||||
"$SENSOR_TYPE_SYSTEM_FW_PROGRESS" "$SENSOR_BOOT_PROGRESS" \
|
||||
"$evtdata0" "$evtdata1" "$byte0" "$byte1" \
|
||||
0x00 0x00 0x00 0xC0
|
||||
}
|
||||
|
||||
BOOT_SYNDROME_DATA=4
|
||||
SENSOR_BOOT_PROGRESS=235
|
||||
EVENT_DIR_ASSERTION=0x00
|
||||
OEM_SENSOR_SPECIFIC=0x70
|
||||
SENSOR_TYPE_SYSTEM_FW_PROGRESS=0x0F
|
||||
|
||||
socket=$1
|
||||
base="$(smpro_path "$socket")"
|
||||
|
||||
# For the second socket, it is required to read out to
|
||||
# clear all old boot progress before query the dimm
|
||||
# training fail info.
|
||||
# Normally, it would take up to 12 times to read them all
|
||||
# Make the value to 16 to make sure it always works.
|
||||
if [ "$socket" == "1" ]; then
|
||||
path=("$base"/smpro-misc.*.auto/boot_progress)
|
||||
filename="${path[0]}"
|
||||
if [ ! -f "$filename" ];
|
||||
then
|
||||
echo "Error: $filename not found"
|
||||
else
|
||||
for ((i=0; i<16; i++))
|
||||
do
|
||||
cat "$filename" > /dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Checking for DIMM slot 0-15
|
||||
for ((i=0; i<16; i++))
|
||||
do
|
||||
path=("$base"/smpro-errmon.*.auto/event_dimm"${i}"_syndrome)
|
||||
filename="${path[0]}"
|
||||
if [ ! -f "$filename" ];
|
||||
then
|
||||
echo "Error: $filename not found"
|
||||
continue
|
||||
fi
|
||||
|
||||
line=$(cat "$filename")
|
||||
if [ -n "$line" ];
|
||||
then
|
||||
log_err_to_redfish_err "$i" "$line"
|
||||
log_err_to_sel_err "$i" "$line"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0;
|
||||
@@ -0,0 +1,63 @@
|
||||
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
|
||||
|
||||
RDEPENDS:${PN} = "bash"
|
||||
S = "${WORKDIR}"
|
||||
|
||||
SRC_URI = " \
|
||||
file://ampere-host-force-reset@.service \
|
||||
file://ampere-host-on-host-check@.service \
|
||||
file://ampere_host_check.sh \
|
||||
file://obmc-power-already-on@.target \
|
||||
file://obmc-host-already-on@.target \
|
||||
file://ampere-bmc-reboot-host-check@.service \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN} = " \
|
||||
ampere-host-force-reset@.service \
|
||||
obmc-power-already-on@.target \
|
||||
obmc-host-already-on@.target \
|
||||
ampere-bmc-reboot-host-check@.service \
|
||||
"
|
||||
|
||||
# append force reboot
|
||||
HOST_WARM_REBOOT_FORCE_TGT = "ampere-host-force-reset@.service"
|
||||
HOST_WARM_REBOOT_FORCE_INSTMPL = "ampere-host-force-reset@{0}.service"
|
||||
HOST_WARM_REBOOT_FORCE_TGTFMT = "obmc-host-force-warm-reboot@{0}.target"
|
||||
HOST_WARM_REBOOT_FORCE_TARGET_FMT = "../${HOST_WARM_REBOOT_FORCE_TGT}:${HOST_WARM_REBOOT_FORCE_TGTFMT}.requires/${HOST_WARM_REBOOT_FORCE_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_WARM_REBOOT_FORCE_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
|
||||
SYSTEMD_SERVICE:${PN} += "${HOST_WARM_REBOOT_FORCE_TGT}"
|
||||
|
||||
HOST_ON_RESET_HOSTTMPL = "ampere-host-on-host-check@.service"
|
||||
HOST_ON_RESET_HOSTINSTMPL = "ampere-host-on-host-check@{0}.service"
|
||||
HOST_ON_RESET_HOSTTGTFMT = "obmc-host-startmin@{0}.target"
|
||||
HOST_ON_RESET_HOSTFMT = "../${HOST_ON_RESET_HOSTTMPL}:${HOST_ON_RESET_HOSTTGTFMT}.requires/${HOST_ON_RESET_HOSTINSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_ON_RESET_HOSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
SYSTEMD_SERVICE:${PN} += "${HOST_ON_RESET_HOSTTMPL}"
|
||||
|
||||
# append on phosphor-wait-power-on
|
||||
AMPERE_POWER_ON_TGT = "obmc-power-already-on@.target"
|
||||
AMPERE_POWER_ON_INSTMPL = "obmc-power-already-on@{0}.target"
|
||||
OP_WAIT_POWER_ON = "phosphor-wait-power-on@{0}.service"
|
||||
AMPERE_POWER_ON_TARGET_FMT = "../${AMPERE_POWER_ON_TGT}:${OP_WAIT_POWER_ON}.wants/${AMPERE_POWER_ON_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'AMPERE_POWER_ON_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
# append on obmc-chassis-poweron but will start after phosphor-state-manager init
|
||||
# host state as running
|
||||
HOST_CHECK_BMC_REBOOT_HOSTTMPL = "ampere-bmc-reboot-host-check@.service"
|
||||
HOST_CHECK_BMC_REBOOT_HOSTINSTMPL = "ampere-bmc-reboot-host-check@{0}.service"
|
||||
HOST_CHECK_BMC_REBOOT_HOSTTGTFMT = "obmc-chassis-poweron@{0}.target"
|
||||
HOST_CHECK_BMC_REBOOT_HOSTFMT = "../${HOST_CHECK_BMC_REBOOT_HOSTTMPL}:${HOST_CHECK_BMC_REBOOT_HOSTTGTFMT}.requires/${HOST_CHECK_BMC_REBOOT_HOSTINSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_CHECK_BMC_REBOOT_HOSTFMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}/usr/sbin
|
||||
install -m 0755 ${WORKDIR}/ampere_host_check.sh ${D}/${sbindir}/
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Check Host%i status after bmc reboot
|
||||
After=obmc-host-reset@%i.target
|
||||
After=obmc-host-reset-running@%i.target
|
||||
After=mapper-wait@-xyz-openbmc_project-state-host%i.service
|
||||
OnSuccess=obmc-host-already-on@%i.target
|
||||
ConditionPathExists=/run/openbmc/chassis@%i-on
|
||||
ConditionPathExists=/run/openbmc/host@%i-on
|
||||
Conflicts=obmc-chassis-poweroff@%i.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c "if [ $(busctl get-property `mapper get-service /xyz/openbmc_project/state/host0` /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host CurrentHostState | grep -i '\.Running' | wc -l) != 0 ]; then exit 0; fi"
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC force reset host%i
|
||||
Wants=phosphor-reboot-host@%i.service
|
||||
Conflicts=obmc-chassis-poweroff@%i.target
|
||||
OnFailure=obmc-chassis-powerreset@%i.target
|
||||
|
||||
[Service]
|
||||
RemainAfterExit=no
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c "sleep 3 && /usr/bin/env ampere_power_util.sh mb force_reset"
|
||||
SyslogIdentifier=ampere_power_util.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-host-force-warm-reboot@%i.target
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Check Host%i status before obmc-host-startmin
|
||||
After=obmc-host-started@%i.target
|
||||
After=obmc-power-start-pre@%i.target
|
||||
Conflicts=obmc-host-stop@%i.target
|
||||
Conflicts=phosphor-reset-host-check@%i.service
|
||||
OnFailure=obmc-host-quiesce@%i.target
|
||||
OnSuccess=obmc-host-already-on@%i.target
|
||||
OnFailureJobMode=flush
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/ampere_host_check.sh
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check current Host status. Do nothing when the Host is currently ON
|
||||
st=$(busctl get-property xyz.openbmc_project.State.Host \
|
||||
/xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \
|
||||
CurrentHostState | cut -d"." -f6)
|
||||
if [ "$st" == "Running\"" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Time out checking for Host ON is 60s
|
||||
cnt=60
|
||||
while [ "$cnt" -gt 0 ];
|
||||
do
|
||||
cnt=$((cnt - 1))
|
||||
st=$(busctl call xyz.openbmc_project.State.HostCondition.Gpio \
|
||||
/xyz/openbmc_project/Gpios/host0 org.freedesktop.DBus.Properties \
|
||||
Get ss xyz.openbmc_project.Condition.HostFirmware \
|
||||
CurrentFirmwareCondition | cut -d"." -f6)
|
||||
if [ "$st" == "Running\"" ]; then
|
||||
if command -v ampere_driver_binder.sh;
|
||||
then
|
||||
ampere_driver_binder.sh
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exit 1
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Ampere Host %i already on target
|
||||
Conflicts=obmc-chassis-poweroff@%i.target
|
||||
Conflicts=obmc-host-quiesce@%i.target
|
||||
Conflicts=ampere-host-force-reset@%i.service
|
||||
Conflicts=ampere-host-shutdown-ack@%i.service
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
[Unit]
|
||||
Description=Ampere power %i already on target
|
||||
After=phosphor-wait-power-on@%i.service
|
||||
Conflicts=obmc-chassis-poweroff@%i.target
|
||||
Conflicts=ampere-host-shutdown-ack@%i.service
|
||||
@@ -0,0 +1,28 @@
|
||||
SUMMARY = "Enable USB ethernet"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
DEPENDS += "systemd"
|
||||
RDEPENDS:${PN} += "libsystemd bash"
|
||||
|
||||
inherit allarch systemd
|
||||
|
||||
SRC_URI += "file://ampere-usbnet.service \
|
||||
file://ampere_usbnet.sh \
|
||||
file://00-bmc-usb0.network"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/ampere-usbnet.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
|
||||
|
||||
install -d ${D}/${sbindir}
|
||||
install -m 755 ${WORKDIR}/ampere_usbnet.sh ${D}/${sbindir}
|
||||
}
|
||||
|
||||
NATIVE_SYSTEMD_SUPPORT = "1"
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN} = "ampere-usbnet.service"
|
||||
@@ -0,0 +1,8 @@
|
||||
[Match]
|
||||
Name=usb0
|
||||
[Address]
|
||||
Address=192.168.0.10/16
|
||||
[Network]
|
||||
LinkLocalAddressing=no
|
||||
IPv6AcceptRA=no
|
||||
DHCP=no
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Ampere Ethernet over USB gadget device
|
||||
After=phosphor-ipmi-host.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/sbin/ampere_usbnet.sh
|
||||
ExecStop=/usr/bin/usb-ctrl ecm usbnet off
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
ENV_MAC_ADDR=$(fw_printenv bmc_macaddr)
|
||||
|
||||
MAC_ADDR=$(echo "$ENV_MAC_ADDR" | cut -d "=" -f 2)
|
||||
|
||||
if [ -n "$MAC_ADDR" ]; then
|
||||
# Generate MAC Address from eth1addr using locally administered MAC
|
||||
# https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local_(U/L_bit
|
||||
SUBMAC=$(echo "$MAC_ADDR" | cut -d ":" -f 2-6)
|
||||
/usr/bin/usb-ctrl ecm usbnet on "06:$SUBMAC" "02:$SUBMAC"
|
||||
else
|
||||
/usr/bin/usb-ctrl ecm usbnet on
|
||||
fi
|
||||
|
||||
# Use NCM (Ethernet) Gadget instead of FunctionFS Gadget
|
||||
echo 0x0103 > /sys/kernel/config/usb_gadget/usbnet/idProduct
|
||||
echo "OpenBMC usbnet Device" > /sys/kernel/config/usb_gadget/usbnet/strings/0x409/product
|
||||
@@ -0,0 +1,35 @@
|
||||
SUMMARY = "Ampere Driver Binder Implementation"
|
||||
DESCRIPTION = "The driver binder 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
|
||||
|
||||
RDEPENDS:${PN} = "bash"
|
||||
S = "${WORKDIR}"
|
||||
|
||||
SRC_URI = " \
|
||||
file://ampere-power-on-driver-binder@.service \
|
||||
file://ampere-host-on-driver-binder@.service \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN} = " \
|
||||
ampere-power-on-driver-binder@.service \
|
||||
ampere-host-on-driver-binder@.service \
|
||||
"
|
||||
# bind driver after the power is on
|
||||
POWER_ON_DRIVER_BINDER_TGT = "ampere-power-on-driver-binder@.service"
|
||||
POWER_ON_DRIVER_BINDER_INSTMPL = "ampere-power-on-driver-binder@{0}.service"
|
||||
AMPER_POWER_ON = "obmc-power-already-on@{0}.target"
|
||||
POWER_ON_DRIVER_BINDER_TARGET_FMT = "../${POWER_ON_DRIVER_BINDER_TGT}:${AMPER_POWER_ON}.wants/${POWER_ON_DRIVER_BINDER_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'POWER_ON_DRIVER_BINDER_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
# bind driver after the host is on
|
||||
HOST_ON_DRIVER_BINDER_TGT = "ampere-host-on-driver-binder@.service"
|
||||
HOST_ON_DRIVER_BINDER_INSTMPL = "ampere-host-on-driver-binder@{0}.service"
|
||||
AMPER_HOST_RUNNING = "obmc-host-already-on@{0}.target"
|
||||
HOST_ON_DRIVER_BINDER_TARGET_FMT = "../${HOST_ON_DRIVER_BINDER_TGT}:${AMPER_HOST_RUNNING}.wants/${HOST_ON_DRIVER_BINDER_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'HOST_ON_DRIVER_BINDER_TARGET_FMT', 'OBMC_HOST_INSTANCES')}"
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Ampere host on driver binder %i
|
||||
After=obmc-host-already-on@%i.target
|
||||
BindTo=obmc-host-already-on@%i.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c "if command -v ampere_host_on_driver_binder.sh; then echo 'Try to bind driver after host on if does not' && ampere_host_on_driver_binder.sh; fi && exit 0;"
|
||||
SyslogIdentifier=host_on_binder
|
||||
RemainAfterExit=no
|
||||
|
||||
[Install]
|
||||
WantedBy=obmc-host-already-on@%i.target
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Ampere power on driver binder %i
|
||||
After=obmc-power-already-on@%i.target
|
||||
BindTo=obmc-power-already-on@%i.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c "if command -v ampere_power_on_driver_binder.sh; then echo 'Try to bind driver after power on if does not' && ampere_power_on_driver_binder.sh; fi && exit 0;"
|
||||
SyslogIdentifier=power_on_binder
|
||||
RemainAfterExit=no
|
||||
@@ -0,0 +1,23 @@
|
||||
SUMMARY = "Ampere Computing LLC Fault Monitor"
|
||||
DESCRIPTION = "Monitor fault events and update fault led status for Ampere systems"
|
||||
PR = "r1"
|
||||
|
||||
LICENSE = "Apache-2.0"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit systemd
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "ampere-fault-monitor.service"
|
||||
|
||||
GPIO_FAULT_START_TGT = "ampere-check-gpio-fault@.service"
|
||||
GPIO_FAULT_START_S0_INSTMPL = "ampere-check-gpio-fault@{0}.service"
|
||||
SYSTEMD_SERVICE:${PN} += "${GPIO_FAULT_START_TGT}"
|
||||
|
||||
HOST_ON_STARTMIN_TGTFMT = "obmc-host-startmin@{0}.target"
|
||||
GPIO_FAULT_START_S0_STARTMIN_FMT = "../${GPIO_FAULT_START_TGT}:${HOST_ON_STARTMIN_TGTFMT}.wants/${GPIO_FAULT_START_S0_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'GPIO_FAULT_START_S0_STARTMIN_FMT', 'OBMC_HOST_INSTANCES')}"
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Monitor GPIO fault and updade fault LED status %i
|
||||
Before=obmc-host-start-pre@0.target
|
||||
After=obmc-host-already-on@0.target
|
||||
Conflicts=obmc-host-stop@0.target
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/bin/sh -c "if [ -f /usr/sbin/ampere_check_gpio_fault.sh ]; then /usr/sbin/ampere_check_gpio_fault.sh %i; fi"
|
||||
ExecStopPost=/bin/sh -c "if [ -f /tmp/gpio_fault ]; then sleep 5; rm /tmp/gpio_fault; fi"
|
||||
SyslogIdentifier=ampere_check_fault_gpio
|
||||
Type=simple
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Monitor fault events and updade fault LED status
|
||||
After=xyz.openbmc_project.State.Host@0.service
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
ExecStart=/usr/sbin/ampere_fault_monitor.sh
|
||||
SyslogIdentifier=ampere_fault_monitor.sh
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy={SYSTEMD_DEFAULT_TARGET}
|
||||
@@ -0,0 +1,22 @@
|
||||
SUMMARY = "Ampere Platform Environment Definitions"
|
||||
DESCRIPTION = "Ampere Platform Environment Definitions"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
SRC_URI = " \
|
||||
file://ampere_add_redfishevent.sh \
|
||||
file://ampere_update_mac.sh \
|
||||
file://ampere_spi_util.sh \
|
||||
file://ampere_power_control_lock.sh \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN} = "bash"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}/usr/sbin
|
||||
install -m 0755 ${WORKDIR}/ampere_add_redfishevent.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_update_mac.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_spi_util.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_power_control_lock.sh ${D}/${sbindir}/
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
registry=$1
|
||||
msgarg=$2
|
||||
|
||||
if [ -z "$registry" ]; then
|
||||
echo "Usage:"
|
||||
echo " $0 <redfish registry> <argument>"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check if logger-systemd exist. Do nothing if not exists
|
||||
if ! command -v logger-systemd;
|
||||
then
|
||||
echo "logger-systemd does not exist. Skip log events for $registry $msgarg"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Log events
|
||||
logger-systemd --journald << EOF
|
||||
MESSAGE=
|
||||
PRIORITY=
|
||||
SEVERITY=
|
||||
REDFISH_MESSAGE_ID=$registry
|
||||
REDFISH_MESSAGE_ARGS=$msgarg
|
||||
EOF
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -a power_reboot_targets=(
|
||||
obmc-host-reboot@0.target
|
||||
obmc-host-warm-reboot@0.target
|
||||
obmc-host-force-warm-reboot@0.target
|
||||
)
|
||||
|
||||
declare -a power_off_targets=(
|
||||
obmc-chassis-hard-poweroff@0.target
|
||||
)
|
||||
|
||||
declare -a power_on_targets=(
|
||||
obmc-host-start@0.target
|
||||
)
|
||||
|
||||
systemd1_service="org.freedesktop.systemd1"
|
||||
systemd1_object_path="/org/freedesktop/systemd1"
|
||||
systemd1_manager_interface="org.freedesktop.systemd1.Manager"
|
||||
mask_method="MaskUnitFiles"
|
||||
unmask_method="UnmaskUnitFiles"
|
||||
|
||||
function mask_reboot_targets()
|
||||
{
|
||||
# To prevent reboot actions, this function will mask all reboot targets
|
||||
for target in "${power_reboot_targets[@]}"
|
||||
do
|
||||
busctl call $systemd1_service $systemd1_object_path $systemd1_manager_interface \
|
||||
$mask_method asbb 1 "$target" true true
|
||||
done
|
||||
}
|
||||
|
||||
function unmask_reboot_targets()
|
||||
{
|
||||
# Allow reboot targets work normal
|
||||
for target in "${power_reboot_targets[@]}"
|
||||
do
|
||||
busctl call $systemd1_service $systemd1_object_path $systemd1_manager_interface \
|
||||
$unmask_method asb 1 "$target" true
|
||||
done
|
||||
}
|
||||
|
||||
function mask_off_targets()
|
||||
{
|
||||
# To prevent off actions,this function will mask all off targets
|
||||
for target in "${power_off_targets[@]}"
|
||||
do
|
||||
busctl call $systemd1_service $systemd1_object_path $systemd1_manager_interface \
|
||||
$mask_method asbb 1 "$target" true true
|
||||
done
|
||||
}
|
||||
|
||||
function unmask_off_targets()
|
||||
{
|
||||
# Allow off targets work normal
|
||||
for target in "${power_off_targets[@]}"
|
||||
do
|
||||
busctl call $systemd1_service $systemd1_object_path $systemd1_manager_interface \
|
||||
$unmask_method asb 1 "$target" true
|
||||
done
|
||||
}
|
||||
|
||||
function mask_on_targets()
|
||||
{
|
||||
# To prevent on actions, this function will mask all on targets
|
||||
systemctl mask "${power_on_targets[@]}" --runtime
|
||||
}
|
||||
|
||||
function unmask_on_targets()
|
||||
{
|
||||
# Allow on targets work normal
|
||||
systemctl unmask "${power_on_targets[@]}" --runtime
|
||||
}
|
||||
|
||||
purpose=$1
|
||||
allow=$2
|
||||
|
||||
if [ "$purpose" == "reboot" ]; then
|
||||
if [ "$allow" == "false" ]
|
||||
then
|
||||
mask_reboot_targets
|
||||
else
|
||||
unmask_reboot_targets
|
||||
fi
|
||||
elif [ "$purpose" == "off" ]; then
|
||||
if [ "$allow" == "false" ]
|
||||
then
|
||||
mask_off_targets
|
||||
else
|
||||
unmask_off_targets
|
||||
fi
|
||||
elif [ "$purpose" == "on" ]; then
|
||||
if [ "$allow" == "false" ]
|
||||
then
|
||||
mask_on_targets
|
||||
else
|
||||
unmask_on_targets
|
||||
fi
|
||||
fi
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
# shellcheck source=meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/gpio-lib.sh
|
||||
source /usr/sbin/gpio-lib.sh
|
||||
|
||||
spi_address="1e630000.spi"
|
||||
spi_bind="/sys/bus/platform/drivers/spi-aspeed-smc/bind"
|
||||
spi_unbind="/sys/bus/platform/drivers/spi-aspeed-smc/unbind"
|
||||
spi_lock="/run/platform/spi.lock"
|
||||
spi_lock_dir="/run/platform"
|
||||
|
||||
bind_aspeed_smc_driver() {
|
||||
if [ -f "${spi_lock}" ]; then
|
||||
pid=$1
|
||||
pid_lock=$(cat "${spi_lock}")
|
||||
if [[ "${pid}" != "${pid_lock}" ]]; then
|
||||
echo "SPI-NOR resoure is lock by process $pid_lock"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# BMC access SPI-NOR resource
|
||||
gpio_name_set spi0-program-sel 1
|
||||
sleep 0.1
|
||||
echo "Bind the ASpeed SMC driver"
|
||||
echo "${spi_address}" > "${spi_bind}" 2>/dev/null
|
||||
# Check the HNOR partition available
|
||||
HOST_MTD=$(< /proc/mtd grep "pnor" | sed -n 's/^\(.*\):.*/\1/p')
|
||||
if [ -z "$HOST_MTD" ]; then
|
||||
echo "${spi_address}" > "${spi_unbind}"
|
||||
sleep 0.1
|
||||
echo "${spi_address}" > "${spi_bind}"
|
||||
fi
|
||||
# BMC release SPI-NOR resource
|
||||
gpio_name_set spi0-program-sel 0
|
||||
return 0
|
||||
}
|
||||
|
||||
unbind_aspeed_smc_driver() {
|
||||
if [ -f "${spi_lock}" ]; then
|
||||
pid=$1
|
||||
pid_lock=$(cat "${spi_lock}")
|
||||
if [[ "${pid}" != "${pid_lock}" ]]; then
|
||||
echo "SPI-NOR resoure is lock by process $pid_lock . Wait 10s"
|
||||
# Wait maximum 10 seconds for unlock SPI-NOR
|
||||
cnt=10
|
||||
while [ $cnt -gt 0 ]
|
||||
do
|
||||
if [ -f "${spi_lock}" ]; then
|
||||
sleep 1
|
||||
cnt=$((cnt - 1))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$cnt" -eq "0" ]; then
|
||||
echo "Timeout 10 seconds, SPI-NOR still busy. Force unlock to access SPI"
|
||||
rm -f "${spi_lock}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
HOST_MTD=$(< /proc/mtd grep "pnor" | sed -n 's/^\(.*\):.*/\1/p')
|
||||
if [ -n "$HOST_MTD" ]; then
|
||||
# If the HNOR partition is available, then unbind driver
|
||||
# BMC access SPI-NOR resource
|
||||
gpio_name_set spi0-program-sel 1
|
||||
sleep 0.1
|
||||
echo "Unbind the ASpeed SMC driver"
|
||||
echo "${spi_address}" > "${spi_unbind}"
|
||||
fi
|
||||
# BMC release SPI-NOR resource
|
||||
gpio_name_set spi0-program-sel 0
|
||||
# Deassert BMC access SPI-NOR pin
|
||||
gpio_name_set spi-nor-access 0
|
||||
sleep 0.5
|
||||
return 0
|
||||
}
|
||||
|
||||
lock_spi_resource() {
|
||||
# Wait maximum 10 seconds to lock SPI-NOR
|
||||
cnt=10
|
||||
while [ $cnt -gt 0 ]
|
||||
do
|
||||
if [ -f "${spi_lock}" ]; then
|
||||
sleep 1
|
||||
cnt=$((cnt - 1))
|
||||
else
|
||||
echo "$1" > "${spi_lock}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$cnt" -eq "0" ]; then
|
||||
echo "Timeout 10 seconds, SPI-NOR is still locked by another process"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
unlock_spi_resource() {
|
||||
if [ ! -f "${spi_lock}" ]; then
|
||||
echo "SPI-NOR is already unlocked"
|
||||
return 0
|
||||
fi
|
||||
|
||||
pid=$1
|
||||
pid_lock=$(cat "${spi_lock}")
|
||||
if [[ "${pid}" == "${pid_lock}" ]]; then
|
||||
rm -f "${spi_lock}"
|
||||
else
|
||||
echo "Cannot unlock, SPI-NOR is locked by another process"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start_handshake_spi() {
|
||||
if [ -f "${spi_lock}" ]; then
|
||||
pid=$1
|
||||
pid_lock=$(cat "${spi_lock}")
|
||||
if [[ "${pid}" != "${pid_lock}" ]]; then
|
||||
echo "SPI-NOR resoure is lock by process $pid_lock"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Wait maximum 10 seconds to grant access SPI
|
||||
cnt=10
|
||||
while [ $cnt -gt 0 ]
|
||||
do
|
||||
spinor_access=$(gpio_name_get soc-spi-nor-access)
|
||||
if [ "$spinor_access" == "1" ]; then
|
||||
sleep 1
|
||||
cnt=$((cnt - 1))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$cnt" -eq "0" ]; then
|
||||
echo "Timeout 10 seconds, host is still hold SPI-NOR."
|
||||
return 1
|
||||
fi
|
||||
echo "Start handshake SPI-NOR"
|
||||
# Grant BMC access SPI-NOR. The process call the scripts should only
|
||||
# claim the bus for only maximum period 500ms.
|
||||
gpio_name_set spi-nor-access 1
|
||||
# Switch the Host SPI-NOR to BMC
|
||||
gpio_name_set spi0-program-sel 1
|
||||
}
|
||||
|
||||
stop_handshake_spi() {
|
||||
if [ -f "${spi_lock}" ]; then
|
||||
pid=$1
|
||||
pid_lock=$(cat "${spi_lock}")
|
||||
if [[ "${pid}" != "${pid_lock}" ]]; then
|
||||
echo "SPI-NOR resoure is lock by process $pid_lock"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
echo "Stop handshake SPI-NOR"
|
||||
# Switch the Host SPI-NOR to HOST
|
||||
gpio_name_set spi0-program-sel 0
|
||||
# Deassert BMC access SPI-NOR pin
|
||||
gpio_name_set spi-nor-access 0
|
||||
}
|
||||
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage:"
|
||||
echo " - Handshake access SPI-NOR "
|
||||
echo " $(basename "$0") cmd pid"
|
||||
echo " <cmd>:"
|
||||
echo " lock - lock the SPI-NOR resource"
|
||||
echo " unlock - unlock the SPI-NOR resource"
|
||||
echo " bind - bind the SPI-NOR resource"
|
||||
echo " unbind - unbind the SPI-NOR resource"
|
||||
echo " start_handshake - start handshake between BMC and Host"
|
||||
echo " stop_handshake - release handshake between BMC and Host"
|
||||
echo " <pid>: Optional - PID of the process call script"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CMD=$1
|
||||
|
||||
if [ ! -d "${spi_lock_dir}" ]; then
|
||||
mkdir -p "${spi_lock_dir}"
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
PID=$$
|
||||
else
|
||||
PID=$2
|
||||
fi
|
||||
|
||||
if [[ "${CMD}" == "lock" ]]; then
|
||||
lock_spi_resource "${PID}"
|
||||
ret=$?
|
||||
if [[ "${ret}" == "1" ]]; then
|
||||
echo "Cannot lock SPI-NOR, the resource is busy"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "${CMD}" == "unlock" ]]; then
|
||||
unlock_spi_resource "${PID}"
|
||||
ret=$?
|
||||
if [[ "${ret}" == "1" ]]; then
|
||||
echo "Cannot unlock SPI-NOR, the resource is busy"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "${CMD}" == "bind" ]]; then
|
||||
bind_aspeed_smc_driver "${PID}"
|
||||
ret=$?
|
||||
if [[ "${ret}" == "1" ]]; then
|
||||
echo "Cannot bind SPI-NOR, the resource is busy"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "${CMD}" == "unbind" ]]; then
|
||||
unbind_aspeed_smc_driver "${PID}"
|
||||
ret=$?
|
||||
if [[ "${ret}" == "1" ]]; then
|
||||
echo "Cannot unbind SPI-NOR, the resource is busy"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "${CMD}" == "start_handshake" ]]; then
|
||||
start_handshake_spi "${PID}"
|
||||
ret=$?
|
||||
if [[ "${ret}" == "1" ]]; then
|
||||
echo "Cannot start handshake SPI-NOR"
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "${CMD}" == "stop_handshake" ]]; then
|
||||
stop_handshake_spi "${PID}"
|
||||
ret=$?
|
||||
if [[ "${ret}" == "1" ]]; then
|
||||
echo "Cannot stop handshake SPI-NOR"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script is used to get the BMC MAC Address from FRU EEPROM at Board Extra.
|
||||
# and if the eth address is not exist on U-boot Enviroment, this script will update it.
|
||||
#
|
||||
|
||||
function Usage () {
|
||||
echo "Usage:"
|
||||
echo " ampere_update_mac.sh <ethX> <fru bus> <fru addr>"
|
||||
echo "Example:"
|
||||
echo " ampere_update_mac.sh eth1 3 80"
|
||||
}
|
||||
|
||||
function read_mac_address () {
|
||||
fruBus=$1
|
||||
fruAddr=$2
|
||||
|
||||
if FRU_OBJECT_PATH=$(busctl tree xyz.openbmc_project.FruDevice | grep "/xyz/openbmc_project/FruDevice/" | tr -s '\n' ' ' | tr -d "|-" | tr -d '`')
|
||||
then
|
||||
IFS=' ' read -r -a FRU_OBJ_PATH_ARR <<< "$FRU_OBJECT_PATH"
|
||||
|
||||
for fruObj in "${FRU_OBJ_PATH_ARR[@]}"
|
||||
do
|
||||
BUS_IDX_RW=$(busctl get-property xyz.openbmc_project.FruDevice "$fruObj" xyz.openbmc_project.FruDevice BUS)
|
||||
BUS_ADDR_RW=$(busctl get-property xyz.openbmc_project.FruDevice "$fruObj" xyz.openbmc_project.FruDevice ADDRESS)
|
||||
|
||||
if [ -z "$BUS_IDX_RW" ] || [ -z "$BUS_IDX_RW" ]; then
|
||||
continue
|
||||
else
|
||||
BUS_IDX_CV=$(echo "$BUS_IDX_RW" | cut -d " " -f 2)
|
||||
BUS_ADDR_CV=$(echo "$BUS_ADDR_RW" | cut -d " " -f 2)
|
||||
if [ "$BUS_IDX_CV" != "$fruBus" ] || [ "$BUS_ADDR_CV" != "$fruAddr" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
MAC_ADDR_RAW=$(busctl get-property xyz.openbmc_project.FruDevice "$fruObj" xyz.openbmc_project.FruDevice BOARD_INFO_AM1)
|
||||
MAC_ADDR=$(echo "$MAC_ADDR_RAW" | cut -d "\"" -f 2)
|
||||
break
|
||||
done
|
||||
fi
|
||||
echo "$MAC_ADDR"
|
||||
}
|
||||
|
||||
ETHERNET_INTERFACE=$1
|
||||
BMC_FRU_BUS=$2
|
||||
BMC_FRU_ADDR=$3
|
||||
|
||||
if [ -z "$BMC_FRU_ADDR" ];
|
||||
then
|
||||
Usage
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check eth port
|
||||
case ${ETHERNET_INTERFACE} in
|
||||
"eth0")
|
||||
ENV_PORT="1"
|
||||
;;
|
||||
"eth1")
|
||||
ENV_PORT="2"
|
||||
;;
|
||||
"eth2")
|
||||
ENV_PORT="3"
|
||||
;;
|
||||
*)
|
||||
Usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# Read FRU Board Custom Field 1 to get the MAC address
|
||||
for i in {1..10}; do
|
||||
MAC_ADDR=$(read_mac_address "$BMC_FRU_BUS" "$BMC_FRU_ADDR")
|
||||
|
||||
# Check if BMC MAC address is exported
|
||||
if [ -z "${MAC_ADDR}" ]; then
|
||||
sleep 2
|
||||
continue
|
||||
fi
|
||||
|
||||
if echo "$MAC_ADDR" | grep -q -vE "^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$" ; then
|
||||
echo "ERROR: No valid BMC MAC Address detected from BMC FRU! $MAC_ADDR"
|
||||
exit 0
|
||||
else
|
||||
echo "mac-update: detect BMC MAC $MAC_ADDR at loop $i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if the Ethernet port has correct MAC Address
|
||||
ETH_INCLUDE_MAC=$(ifconfig "${ETHERNET_INTERFACE}" | grep -i "$MAC_ADDR")
|
||||
if [ -n "$ETH_INCLUDE_MAC" ]; then
|
||||
echo "BMC MAC Address is already configured"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Request to restart the service
|
||||
ifconfig "${ETHERNET_INTERFACE}" down
|
||||
fw_setenv bmc_macaddr "${MAC_ADDR}"
|
||||
|
||||
ifconfig "${ETHERNET_INTERFACE}" hw ether "${MAC_ADDR}"
|
||||
retval=$?
|
||||
if [[ $retval -ne 0 ]]; then
|
||||
echo "ERROR: Can not update MAC ADDR to ${ETHERNET_INTERFACE}"
|
||||
exit 1
|
||||
fi
|
||||
# Setting LAN MAC Address to xx:xx:xx:xx:xx:xx
|
||||
ipmitool lan set "${ENV_PORT}" macaddr "${ETHERNET_INTERFACE}"
|
||||
# Enableing BMC-generated ARP responses & Setting SNMP Community String to public
|
||||
ipmitool lan set "${ENV_PORT}" arp respond on
|
||||
ipmitool lan set "${ENV_PORT}" snmp public
|
||||
ifconfig "${ETHERNET_INTERFACE}" up
|
||||
|
||||
echo "Successfully update the MAC address ${MAC_ADDR} to ${ETHERNET_INTERFACE}"
|
||||
@@ -0,0 +1,17 @@
|
||||
def run_git(d, cmd):
|
||||
try:
|
||||
oeroot = d.getVar('COREBASE', True)
|
||||
return bb.process.run("git --work-tree %s --git-dir %s/.git %s"
|
||||
% (oeroot, oeroot, cmd))[0].strip('\n')
|
||||
except:
|
||||
pass
|
||||
|
||||
python() {
|
||||
version_id = run_git(d, 'describe --dirty --long --tags')
|
||||
if version_id:
|
||||
versionList = version_id.split('-')
|
||||
|
||||
# Override with tag name only, if built at tag.
|
||||
if 'dirty' not in version_id and versionList[1] == 'ampere':
|
||||
d.setVar('VERSION_ID', versionList[0].split('v')[-1])
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
enforce_for_root
|
||||
minlen=9
|
||||
difok=0
|
||||
lcredit=-1
|
||||
ocredit=-1
|
||||
dcredit=-1
|
||||
ucredit=-1
|
||||
maxrepeat=3
|
||||
@@ -0,0 +1,5 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://pwquality.conf \
|
||||
"
|
||||
@@ -0,0 +1,2 @@
|
||||
deny=5
|
||||
unlock_time=1800
|
||||
@@ -0,0 +1,4 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " file://faillock.conf \
|
||||
"
|
||||
@@ -0,0 +1,91 @@
|
||||
#Host console log
|
||||
|
||||
module(load="imuxsock" SysSock.Use="off")
|
||||
|
||||
template(name="ConsoleTemplate" type="string" string="%rawmsg%")
|
||||
|
||||
ruleset(name="ConsoleCPURuleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-cpu.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleATFRuleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-atf.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleSECPRO0Ruleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-secpro0.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleSECPRO1Ruleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-secpro1.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleMPRO0Ruleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-mpro0.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleMPRO1Ruleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-mpro1.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleSCP0Ruleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-scp0.log" template="ConsoleTemplate")
|
||||
}
|
||||
ruleset(name="ConsoleSCP1Ruleset") {
|
||||
action(type="omfile" file="/var/log/obmc-console-scp1.log" template="ConsoleTemplate")
|
||||
}
|
||||
|
||||
# Custom socket for serial console logs.
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/cpu"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleCPURuleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/atf"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleATFRuleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/secpro0"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleSECPRO0Ruleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/secpro1"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleSECPRO1Ruleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/mpro0"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleMPRO0Ruleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/mpro1"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleMPRO1Ruleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/scp0"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleSCP0Ruleset")
|
||||
|
||||
input(type="imuxsock"
|
||||
Socket="/run/rsyslog/console/scp1"
|
||||
CreatePath="on"
|
||||
UseSpecialParser="off"
|
||||
ParseHostname="off"
|
||||
ruleset="ConsoleSCP1Ruleset")
|
||||
|
||||
$EscapeControlCharactersOnReceive off
|
||||
$DropTrailingLFOnReception off
|
||||
|
||||
@@ -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 2000 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,67 @@
|
||||
# /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 2 256k files for cpu console logs
|
||||
/var/log/obmc-console-cpu.log
|
||||
{
|
||||
copytruncate
|
||||
rotate 1
|
||||
size 256k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
# Keep up to 2 64k files for atf console logs
|
||||
/var/log/obmc-console-atf.log
|
||||
{
|
||||
copytruncate
|
||||
rotate 1
|
||||
size 64k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
# Keep up to 2 64k files for secpro and mpro console logs
|
||||
/var/log/obmc-console-*pro*.log
|
||||
{
|
||||
copytruncate
|
||||
rotate 1
|
||||
size 64k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
|
||||
# Keep up to 2 64k files for Mt.Jade's scp console logs
|
||||
/var/log/obmc-console-scp*.log
|
||||
{
|
||||
copytruncate
|
||||
rotate 1
|
||||
size 64k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += "file://rsyslog.conf \
|
||||
file://rsyslog.logrotate \
|
||||
file://rotate-event-logs.service \
|
||||
file://rotate-event-logs.sh \
|
||||
file://rsyslog-override.conf \
|
||||
file://hostconsole.conf \
|
||||
"
|
||||
|
||||
FILES:${PN} += "${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf"
|
||||
|
||||
PACKAGECONFIG:append = " imjournal"
|
||||
|
||||
do_install:append() {
|
||||
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
|
||||
install -m 0755 ${WORKDIR}/hostconsole.conf ${D}${sysconfdir}/rsyslog.d/hostconsole.conf
|
||||
rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf
|
||||
}
|
||||
|
||||
SYSTEMD_SERVICE:${PN} += " rotate-event-logs.service"
|
||||
@@ -0,0 +1 @@
|
||||
EXTRA_OEMESON:append = "-Dlong-press-time-ms=5000"
|
||||
@@ -0,0 +1,2 @@
|
||||
PACKAGECONFIG:remove = " intelcpusensor ipmbsensor"
|
||||
PACKAGECONFIG:append = " nvmesensor"
|
||||
@@ -0,0 +1,8 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
# To delay turning off host when fan sensors are not detected yet
|
||||
# To use CurrentHostState to decide host state for phosphor-fan-monitor
|
||||
|
||||
PACKAGECONFIG:append = " delay-host-control monitor-use-host-state"
|
||||
PACKAGECONFIG[delay-host-control] = "-Ddelay-host-control=20"
|
||||
PACKAGECONFIG[monitor-use-host-state] = "-Dmonitor-use-host-state=enabled"
|
||||
Executable
+104
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage () {
|
||||
echo "Usage:"
|
||||
echo " $(basename "$0") <image path> "
|
||||
echo "Where:"
|
||||
echo " <image path>: the path link to folder, which include image file and MANIFEST"
|
||||
echo "Example:"
|
||||
echo " $(basename "$0") /tmp/images/ghdh1393"
|
||||
}
|
||||
|
||||
|
||||
IMG_PATH="$1"
|
||||
if [ ! -d "$IMG_PATH" ]; then
|
||||
echo "The folder $IMG_PATH does not exist"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MANIFEST_PATH="${IMG_PATH}/MANIFEST"
|
||||
if [ ! -f "$MANIFEST_PATH" ]; then
|
||||
echo "The MANIFEST file $MANIFEST_PATH does not exist"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EXTENDED_VERSION=$(awk '/ExtendedVersion/ {print}' "${MANIFEST_PATH}" | cut -d "=" -f 2)
|
||||
|
||||
# If the ExtendedVersion is empty, set default to update UEFI/EDKII on primary device
|
||||
if [ -z "$EXTENDED_VERSION" ]
|
||||
then
|
||||
EXTENDED_VERSION="primary"
|
||||
fi
|
||||
|
||||
# Assign the command based on the ExtendedVersion
|
||||
case ${EXTENDED_VERSION} in
|
||||
"primary")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \))
|
||||
CMD="/usr/sbin/ampere_flash_bios.sh $IMAGE 1"
|
||||
;;
|
||||
|
||||
"secondary")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \))
|
||||
CMD="/usr/sbin/ampere_flash_bios.sh $IMAGE 2"
|
||||
;;
|
||||
|
||||
"scp-primary")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \))
|
||||
CMD="/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 1"
|
||||
;;
|
||||
|
||||
"scp-secondary")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \))
|
||||
CMD="/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 2"
|
||||
;;
|
||||
|
||||
"eeprom" | "eeprom-primary")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" -o -name "*.bin" \))
|
||||
CMD="/usr/sbin/ampere_firmware_upgrade.sh eeprom $IMAGE 1"
|
||||
;;
|
||||
|
||||
"eeprom-secondary")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" -o -name "*.bin" \))
|
||||
CMD="/usr/sbin/ampere_firmware_upgrade.sh eeprom $IMAGE 2"
|
||||
;;
|
||||
|
||||
"fru" | "mbfru")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.bin" \))
|
||||
CMD="/usr/sbin/ampere_firmware_upgrade.sh fru $IMAGE 1"
|
||||
;;
|
||||
|
||||
|
||||
"bmcfru")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.bin" \))
|
||||
CMD="/usr/sbin/ampere_firmware_upgrade.sh fru $IMAGE 2"
|
||||
;;
|
||||
|
||||
"mbcpld")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.jed" \))
|
||||
CMD="/usr/bin/ampere_firmware_upgrade.sh mb_cpld $IMAGE"
|
||||
;;
|
||||
"bmccpld")
|
||||
IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.jed" \))
|
||||
CMD="/usr/bin/ampere_firmware_upgrade.sh bmc_cpld $IMAGE"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid ExtendedVersion: ${EXTENDED_VERSION}. Please check MANIFEST file!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if [ -z "$IMAGE" ]
|
||||
then
|
||||
echo "ERROR: The image file: No such file or directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! eval "$CMD";
|
||||
then
|
||||
echo "ERROR: The firmware update not successfull"
|
||||
exit 1
|
||||
fi
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Ampere service for flashing the Host firmware image
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/usr/sbin/firmware_update.sh /tmp/images/%I
|
||||
TimeoutSec=300
|
||||
@@ -0,0 +1,18 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://firmware_update.sh \
|
||||
"
|
||||
|
||||
PACKAGECONFIG[flash_bios] = "-Dhost-bios-upgrade=enabled, -Dhost-bios-upgrade=disabled"
|
||||
|
||||
PACKAGECONFIG:append = " flash_bios static-dual-image"
|
||||
|
||||
SYSTEMD_SERVICE:${PN}:updater += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', 'obmc-flash-host-bios@.service', '', d)}"
|
||||
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}/usr/sbin
|
||||
install -m 0755 ${WORKDIR}/firmware_update.sh ${D}/usr/sbin/firmware_update.sh
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC host shutdown ACK
|
||||
Conflicts=obmc-chassis-poweron@0.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/ampere_power_util.sh mb shutdown_ack
|
||||
SyslogIdentifier=ampere_host_shutdown_ack
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC HighTempt event
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/usr/sbin/ampere_add_redfishevent.sh OpenBMC.0.1.AmpereEvent.Warning "CPU%i HighTemp asserted"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC HighTempt event
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/usr/sbin/ampere_add_redfishevent.sh OpenBMC.0.1.AmpereEvent.OK "CPU%i HighTemp deasserted"
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Ampere Computing LLC Overtemp event handling
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/bin/sh -c "touch /tmp/fault_overtemp && obmcutil chassisoff"
|
||||
ExecStartPost=/bin/sh -c "ampere_add_redfishevent.sh OpenBMC.0.1.CPUThermalTrip.Critical %i && sleep 10 && rm /tmp/fault_overtemp"
|
||||
@@ -0,0 +1,11 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SYSTEMD_SERVICE:${PN}-monitor += " \
|
||||
ampere-host-shutdown-ack@.service \
|
||||
ampere_overtemp@.service \
|
||||
ampere_hightemp_start@.service \
|
||||
ampere_hightemp_stop@.service \
|
||||
"
|
||||
|
||||
SYSTEMD_LINK:${PN}-monitor:append = " ../phosphor-multi-gpio-monitor.service:multi-user.target.requires/phosphor-multi-gpio-monitor.service"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
SNOOP_DEVICE = ""
|
||||
@@ -0,0 +1,10 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
EXTRA_OEMESON:append = " \
|
||||
-Dinsecure-tftp-update=disabled \
|
||||
-Dbmcweb-logging=enabled \
|
||||
-Dredfish-bmc-journal=enabled \
|
||||
-Dhttp-body-limit=65 \
|
||||
-Dredfish-new-powersubsystem-thermalsubsystem=enabled \
|
||||
-Dredfish-allow-deprecated-power-thermal=disabled \
|
||||
"
|
||||
@@ -0,0 +1,17 @@
|
||||
SUMMARY = "Copy the inventory cleanup yaml for inventory manager"
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit allarch
|
||||
inherit phosphor-inventory-manager
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
SRC_URI = "file://inventory-cleanup.yaml"
|
||||
|
||||
do_install() {
|
||||
install -D inventory-cleanup.yaml ${D}${base_datadir}/events.d/inventory-cleanup.yaml
|
||||
}
|
||||
|
||||
FILES:${PN} += "${base_datadir}/events.d/inventory-cleanup.yaml"
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
description: >
|
||||
Ampere inventory fixups
|
||||
|
||||
events:
|
||||
- name: Add Chassis interface
|
||||
description: >
|
||||
Add the chassis interface on the chassis inventory path
|
||||
type: startup
|
||||
actions:
|
||||
- name: createObjects
|
||||
objs:
|
||||
/system/chassis:
|
||||
xyz.openbmc_project.Inventory.Item.Chassis:
|
||||
Type:
|
||||
value: "xyz.openbmc_project.Inventory.Item.Chassis.ChassisType.RackMount"
|
||||
type: string
|
||||
@@ -0,0 +1,30 @@
|
||||
SUMMARY = "Ampere OEM IPMI commands"
|
||||
DESCRIPTION = "Ampere OEM IPMI commands"
|
||||
|
||||
LICENSE = "Apache-2.0"
|
||||
S = "${WORKDIR}"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
|
||||
|
||||
DEPENDS = "boost phosphor-ipmi-host phosphor-logging systemd"
|
||||
|
||||
inherit meson pkgconfig obmc-phosphor-ipmiprovider-symlink
|
||||
|
||||
LIBRARY_NAMES = "libzampoemcmds.so"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
SRC_URI = "git://github.com/openbmc/ampere-ipmi-oem.git;branch=master;protocol=https"
|
||||
SRCREV = "2a19152956defafd7d9c5344b376a428e878c507"
|
||||
|
||||
HOSTIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}"
|
||||
NETIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}"
|
||||
|
||||
FILES:${PN}:append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
|
||||
FILES:${PN}:append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
|
||||
FILES:${PN}:append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
|
||||
FILES:${PN}-dev:append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV}"
|
||||
|
||||
do_install:append(){
|
||||
install -d ${D}${includedir}/ampere-ipmi-oem
|
||||
install -m 0644 -D ${S}/include/*.hpp ${D}${includedir}/ampere-ipmi-oem
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"0" : {
|
||||
"name" : "IPMB",
|
||||
"is_valid" : true,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "ipmb",
|
||||
"protocol_type" : "ipmb-1.0",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"1" : {
|
||||
"name" : "eth0",
|
||||
"is_valid" : true,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "lan-802.3",
|
||||
"protocol_type" : "ipmb-1.0",
|
||||
"session_supported" : "multi-session",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"2" : {
|
||||
"name" : "eth1",
|
||||
"is_valid" : true,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "lan-802.3",
|
||||
"protocol_type" : "ipmb-1.0",
|
||||
"session_supported" : "multi-session",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"3" : {
|
||||
"name" : "usb0",
|
||||
"is_valid" : true,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "lan-802.3",
|
||||
"protocol_type" : "ipmb-1.0",
|
||||
"session_supported" : "multi-session",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"4" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"5" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"6" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"7" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"8" : {
|
||||
"name" : "INTRABMC",
|
||||
"is_valid" : true,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "oem",
|
||||
"protocol_type" : "oem",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"9" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"10" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"11" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"12" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"13" : {
|
||||
"name" : "RESERVED",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "reserved",
|
||||
"protocol_type" : "na",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"14" : {
|
||||
"name" : "SELF",
|
||||
"is_valid" : false,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "ipmb",
|
||||
"protocol_type" : "ipmb-1.0",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
},
|
||||
"15" : {
|
||||
"name" : "ipmi_ssif",
|
||||
"is_valid" : true,
|
||||
"active_sessions" : 0,
|
||||
"channel_info" : {
|
||||
"medium_type" : "smbus-v2.0",
|
||||
"protocol_type" : "ipmi-smbus",
|
||||
"session_supported" : "session-less",
|
||||
"is_ipmi" : true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"path": "/xyz/openbmc_project/sensors/power/total_power"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
HOSTIPMI_PROVIDER_LIBRARY:remove = "libstrgfnhandler.so"
|
||||
|
||||
do_install:append () {
|
||||
rm -rf ${D}${libdir}/ipmid-providers
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Usage of this utility
|
||||
echo "Trigger soft off the host."
|
||||
/usr/sbin/ampere_power_util.sh mb soft_off
|
||||
exit $?;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Ampere Soft power off of the host
|
||||
Wants=obmc-host-stop-pre@0.target
|
||||
Before=obmc-host-stop-pre@0.target
|
||||
Conflicts=obmc-host-start@0.target
|
||||
ConditionPathExists=!/run/openbmc/host@0-request
|
||||
ConditionPathExists=!/lib/systemd/system/pldmSoftPowerOff.service
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
ExecStart=/usr/bin/phosphor-softpoweroff
|
||||
SyslogIdentifier=phosphor-softpoweroff
|
||||
Type=oneshot
|
||||
@@ -0,0 +1,18 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
RRECOMMENDS:${PN} += "ipmitool"
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
SRC_URI += "\
|
||||
file://ampere-phosphor-softpoweroff \
|
||||
file://ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service \
|
||||
"
|
||||
|
||||
AMPERE_SOFTPOWEROFF_TMPL = "ampere.xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
|
||||
|
||||
do_install:append(){
|
||||
install -d ${D}${includedir}/phosphor-ipmi-host
|
||||
install -m 0644 -D ${S}/selutility.hpp ${D}${includedir}/phosphor-ipmi-host
|
||||
install -m 0755 ${WORKDIR}/ampere-phosphor-softpoweroff ${D}/${bindir}/phosphor-softpoweroff
|
||||
install -m 0644 ${WORKDIR}/${AMPERE_SOFTPOWEROFF_TMPL} ${D}${systemd_unitdir}/system/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
PACKAGECONFIG:append = " log-threshold"
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/xyz/openbmc_project/ipmi/sol/eth0:
|
||||
- Interface: xyz.openbmc_project.Ipmi.SOL
|
||||
Properties:
|
||||
Enable:
|
||||
Default: 'true'
|
||||
Privilege:
|
||||
Default: 4
|
||||
Progress:
|
||||
Default: 0
|
||||
RetryCount:
|
||||
Default: 7
|
||||
RetryIntervalMS:
|
||||
Default: 100
|
||||
Threshold:
|
||||
Default: 1
|
||||
|
||||
/xyz/openbmc_project/ipmi/sol/eth1:
|
||||
- Interface: xyz.openbmc_project.Ipmi.SOL
|
||||
Properties:
|
||||
Enable:
|
||||
Default: 'true'
|
||||
Privilege:
|
||||
Default: 4
|
||||
Progress:
|
||||
Default: 0
|
||||
RetryCount:
|
||||
Default: 7
|
||||
RetryIntervalMS:
|
||||
Default: 100
|
||||
Threshold:
|
||||
Default: 1
|
||||
|
||||
/xyz/openbmc_project/control/host0/power_restore_policy:
|
||||
- Interface: xyz.openbmc_project.Control.Power.RestorePolicy
|
||||
Properties:
|
||||
PowerRestorePolicy:
|
||||
Default: RestorePolicy::Policy::AlwaysOn
|
||||
@@ -0,0 +1,2 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
SRC_URI:append = " file://ampere_settings.override.yml"
|
||||
@@ -0,0 +1,3 @@
|
||||
PACKAGECONFIG:append = " smbios-ipmi-blob"
|
||||
|
||||
PACKAGECONFIG:remove = " cpuinfo"
|
||||
@@ -0,0 +1,25 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
DEPENDS += "gpioplus libgpiod"
|
||||
|
||||
EXTRA_OEMESON:append = " \
|
||||
-Dhost-gpios=enabled \
|
||||
-Dboot-count-max-allowed=1 \
|
||||
-Donly-run-apr-on-power-loss=true \
|
||||
"
|
||||
|
||||
FILES:${PN} += "${systemd_system_unitdir}/*"
|
||||
FILES:${PN}-host += "${bindir}/phosphor-host-condition-gpio"
|
||||
SYSTEMD_SERVICE:${PN}-host += "phosphor-host-condition-gpio@.service"
|
||||
|
||||
pkg_postinst:${PN}-obmc-targets:prepend() {
|
||||
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_prerm:${PN}-obmc-targets:prepend() {
|
||||
LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-host-condition-gpio@0.service"
|
||||
rm $LINK
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
#
|
||||
# Ampere Mt. Jade power control involves different action during
|
||||
# the course of action which does not involve rebooting the Host.
|
||||
# Thus disable the use of Host Power-On watchdog.
|
||||
#
|
||||
WATCHDOG_FMT = ""
|
||||
ENABLE_WATCHDOG_FMT = ""
|
||||
@@ -0,0 +1,10 @@
|
||||
# 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 += "jade-layer"
|
||||
BBFILE_PATTERN_jade-layer := "^${LAYERDIR}/"
|
||||
LAYERSERIES_COMPAT_jade-layer = "langdale mickledore"
|
||||
@@ -0,0 +1,44 @@
|
||||
KMACHINE = "aspeed"
|
||||
KERNEL_DEVICETREE = "${KMACHINE}-bmc-ampere-${MACHINE}.dtb"
|
||||
|
||||
UBOOT_MACHINE = "evb-ast2500_defconfig"
|
||||
UBOOT_DEVICETREE = "ast2500-evb"
|
||||
|
||||
require conf/machine/include/ast2500.inc
|
||||
require conf/machine/include/obmc-bsp-common.inc
|
||||
require conf/distro/include/phosphor-aspeed-spi-master-mode.inc
|
||||
|
||||
# Reformat SPI flash layout to 64MB
|
||||
FLASH_SIZE = "65536"
|
||||
|
||||
MACHINE_FEATURES += "\
|
||||
obmc-phosphor-chassis-mgmt \
|
||||
obmc-phosphor-flash-mgmt \
|
||||
obmc-phosphor-fan-mgmt \
|
||||
obmc-chassis-state-mgmt \
|
||||
obmc-host-state-mgmt \
|
||||
obmc-bmc-state-mgmt \
|
||||
obmc-host-ipmi \
|
||||
"
|
||||
|
||||
VOLATILE_LOG_DIR = "no"
|
||||
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append = "\
|
||||
ampere-utils \
|
||||
ampere-usbnet \
|
||||
ampere-mac-update \
|
||||
mtjade-gpio-config \
|
||||
ampere-platform-init \
|
||||
ampere-ipmi-oem \
|
||||
phosphor-ipmi-blobs \
|
||||
phosphor-ipmi-blobs-binarystore \
|
||||
ampere-driver-binder \
|
||||
ampere-fault-monitor \
|
||||
"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/obmc-chassis-mgmt = "packagegroup-ampere-apps"
|
||||
PREFERRED_PROVIDER_virtual/obmc-system-mgmt = "packagegroup-ampere-apps"
|
||||
PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw = "phosphor-ipmi-ssif"
|
||||
PREFERRED_PROVIDER_virtual/obmc-flash-mgmt = "packagegroup-ampere-apps"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-ipmi-fru-hostfw-config ?= "hostboot-inventory-config-native"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "mtjade-led-manager-config-native"
|
||||
@@ -0,0 +1,17 @@
|
||||
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
|
||||
# changes incompatibly
|
||||
LCONF_VERSION = "8"
|
||||
|
||||
BBPATH = "${TOPDIR}"
|
||||
BBFILES ?= ""
|
||||
|
||||
BBLAYERS ?= " \
|
||||
##OEROOT##/meta \
|
||||
##OEROOT##/meta-openembedded/meta-oe \
|
||||
##OEROOT##/meta-openembedded/meta-networking \
|
||||
##OEROOT##/meta-openembedded/meta-python \
|
||||
##OEROOT##/meta-phosphor \
|
||||
##OEROOT##/meta-aspeed \
|
||||
##OEROOT##/meta-ampere \
|
||||
##OEROOT##/meta-ampere/meta-jade \
|
||||
"
|
||||
@@ -0,0 +1,2 @@
|
||||
Common targets are:
|
||||
obmc-phosphor-image
|
||||
@@ -0,0 +1,214 @@
|
||||
#
|
||||
# This file is your local configuration file and is where all local user settings
|
||||
# are placed. The comments in this file give some guide to the options a new user
|
||||
# to the system might want to change but pretty much any configuration option can
|
||||
# be set in this file.
|
||||
#
|
||||
# Lines starting with the '#' character are commented out and in some cases the
|
||||
# default values are provided as comments to show people example syntax. Enabling
|
||||
# the option is a question of removing the # character and making any change to the
|
||||
# variable as required.
|
||||
|
||||
#
|
||||
# Machine Selection
|
||||
#
|
||||
MACHINE ??= "mtjade"
|
||||
|
||||
#
|
||||
# Where to place downloads
|
||||
#
|
||||
# During a first build the system will download many different source code tarballs
|
||||
# from various upstream projects. This can take a while, particularly if your network
|
||||
# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you
|
||||
# can preserve this directory to speed up this part of subsequent builds. This directory
|
||||
# is safe to share between multiple builds on the same machine too.
|
||||
#
|
||||
# The default is a downloads directory under TOPDIR which is the build directory.
|
||||
#
|
||||
#DL_DIR ?= "${TOPDIR}/downloads"
|
||||
|
||||
#
|
||||
# Where to place shared-state files
|
||||
#
|
||||
# BitBake has the capability to accelerate builds based on previously built output.
|
||||
# This is done using "shared state" files which can be thought of as cache objects
|
||||
# and this option determines where those files are placed.
|
||||
#
|
||||
# You can wipe out TMPDIR leaving this directory intact and the build would regenerate
|
||||
# from these files if no changes were made to the configuration. If changes were made
|
||||
# to the configuration, only shared state files where the state was still valid would
|
||||
# be used (done using checksums).
|
||||
#
|
||||
# The default is a sstate-cache directory under TOPDIR.
|
||||
#
|
||||
#SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
|
||||
|
||||
#
|
||||
# Where to place the build output
|
||||
#
|
||||
# This option specifies where the bulk of the building work should be done and
|
||||
# where BitBake should place its temporary files and output. Keep in mind that
|
||||
# this includes the extraction and compilation of many applications and the toolchain
|
||||
# which can use Gigabytes of hard disk space.
|
||||
#
|
||||
# The default is a tmp directory under TOPDIR.
|
||||
#
|
||||
#TMPDIR = "${TOPDIR}/tmp"
|
||||
|
||||
#
|
||||
# Default policy config
|
||||
#
|
||||
# The distribution setting controls which policy settings are used as defaults.
|
||||
# The default value is fine for general Yocto project use, at least initially.
|
||||
# Ultimately when creating custom policy, people will likely end up subclassing
|
||||
# these defaults.
|
||||
#
|
||||
DISTRO ?= "openbmc-phosphor"
|
||||
# As an example of a subclass there is a "bleeding" edge policy configuration
|
||||
# where many versions are set to the absolute latest code from the upstream
|
||||
# source control systems. This is just mentioned here as an example, its not
|
||||
# useful to most new users.
|
||||
# DISTRO ?= "poky-bleeding"
|
||||
|
||||
#
|
||||
# Package Management configuration
|
||||
#
|
||||
# This variable lists which packaging formats to enable. Multiple package backends
|
||||
# can be enabled at once and the first item listed in the variable will be used
|
||||
# to generate the root filesystems.
|
||||
# Options are:
|
||||
# - 'package_deb' for debian style deb files
|
||||
# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager)
|
||||
# - 'package_rpm' for rpm style packages
|
||||
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
|
||||
# We default to ipk:
|
||||
PACKAGE_CLASSES ?= "package_ipk"
|
||||
|
||||
#
|
||||
# SDK/ADT target architecture
|
||||
#
|
||||
# This variable specifies the architecture to build SDK/ADT items for and means
|
||||
# you can build the SDK packages for architectures other than the machine you are
|
||||
# running the build on (i.e. building i686 packages on an x86_64 host).
|
||||
# Supported values are i686 and x86_64
|
||||
#SDKMACHINE ?= "i686"
|
||||
|
||||
SANITY_TESTED_DISTROS:append ?= " *"
|
||||
|
||||
#
|
||||
# Extra image configuration defaults
|
||||
#
|
||||
# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated
|
||||
# images. Some of these options are added to certain image types automatically. The
|
||||
# variable can contain the following options:
|
||||
# "dbg-pkgs" - add -dbg packages for all installed packages
|
||||
# (adds symbol information for debugging/profiling)
|
||||
# "dev-pkgs" - add -dev packages for all installed packages
|
||||
# (useful if you want to develop against libs in the image)
|
||||
# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages
|
||||
# (useful if you want to run the package test suites)
|
||||
# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.)
|
||||
# "tools-debug" - add debugging tools (gdb, strace)
|
||||
# "eclipse-debug" - add Eclipse remote debugging support
|
||||
# "tools-profile" - add profiling tools (oprofile, exmap, lttng, valgrind)
|
||||
# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.)
|
||||
# "debug-tweaks" - make an image suitable for development
|
||||
# e.g. ssh root access has a blank password
|
||||
# There are other application targets that can be used here too, see
|
||||
# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details.
|
||||
# We default to enabling the debugging tweaks.
|
||||
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
|
||||
|
||||
#
|
||||
# Additional image features
|
||||
#
|
||||
# The following is a list of additional classes to use when building images which
|
||||
# enable extra features. Some available options which can be included in this variable
|
||||
# are:
|
||||
# - 'buildstats' collect build statistics
|
||||
# - 'image-swab' to perform host system intrusion detection
|
||||
# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink
|
||||
# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended
|
||||
USER_CLASSES ?= "buildstats"
|
||||
|
||||
#
|
||||
# Runtime testing of images
|
||||
#
|
||||
# The build system can test booting virtual machine images under qemu (an emulator)
|
||||
# after any root filesystems are created and run tests against those images. To
|
||||
# enable this uncomment this line. See classes/testimage(-auto).bbclass for
|
||||
# further details.
|
||||
#TEST_IMAGE = "1"
|
||||
#
|
||||
# Interactive shell configuration
|
||||
#
|
||||
# Under certain circumstances the system may need input from you and to do this it
|
||||
# can launch an interactive shell. It needs to do this since the build is
|
||||
# multithreaded and needs to be able to handle the case where more than one parallel
|
||||
# process may require the user's attention. The default is iterate over the available
|
||||
# terminal types to find one that works.
|
||||
#
|
||||
# Examples of the occasions this may happen are when resolving patches which cannot
|
||||
# be applied, to use the devshell or the kernel menuconfig
|
||||
#
|
||||
# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none
|
||||
# Note: currently, Konsole support only works for KDE 3.x due to the way
|
||||
# newer Konsole versions behave
|
||||
#OE_TERMINAL = "auto"
|
||||
# By default disable interactive patch resolution (tasks will just fail instead):
|
||||
PATCHRESOLVE = "noop"
|
||||
|
||||
#
|
||||
# Disk Space Monitoring during the build
|
||||
#
|
||||
# Monitor the disk space during the build. If there is less that 1GB of space or less
|
||||
# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully
|
||||
# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort
|
||||
# of the build. The reason for this is that running completely out of space can corrupt
|
||||
# files and damages the build in ways which may not be easily recoverable.
|
||||
# It's necessary to monitor /tmp, if there is no space left the build will fail
|
||||
# with very exotic errors.
|
||||
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"
|
||||
|
||||
#
|
||||
# Shared-state files from other locations
|
||||
#
|
||||
# As mentioned above, shared state files are prebuilt cache data objects which can
|
||||
# used to accelerate build time. This variable can be used to configure the system
|
||||
# to search other mirror locations for these objects before it builds the data itself.
|
||||
#
|
||||
# This can be a filesystem directory, or a remote url such as http or ftp. These
|
||||
# would contain the sstate-cache results from previous builds (possibly from other
|
||||
# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the
|
||||
# cache locations to check for the shared objects.
|
||||
# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH
|
||||
# at the end as shown in the examples below. This will be substituted with the
|
||||
# correct path within the directory structure.
|
||||
#SSTATE_MIRRORS ?= "\
|
||||
#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
|
||||
#file://.* file:///some/local/dir/sstate/PATH"
|
||||
|
||||
|
||||
#
|
||||
# Qemu configuration
|
||||
#
|
||||
# By default qemu will build with a builtin VNC server where graphical output can be
|
||||
# seen. The two lines below enable the SDL backend too. This assumes there is a
|
||||
# libsdl library available on your build system.
|
||||
#PACKAGECONFIG_append_pn-qemu-native = " sdl"
|
||||
#PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
|
||||
#ASSUME_PROVIDED += "libsdl-native"
|
||||
|
||||
|
||||
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
|
||||
# track the version of this file when it was generated. This can safely be ignored if
|
||||
# this doesn't mean anything to you.
|
||||
CONF_VERSION = "2"
|
||||
@@ -0,0 +1,51 @@
|
||||
SUMMARY = "OpenBMC for Ampere - Applications"
|
||||
PR = "r1"
|
||||
|
||||
inherit packagegroup
|
||||
inherit obmc-phosphor-utils
|
||||
|
||||
PROVIDES = "${PACKAGES}"
|
||||
PACKAGES = " \
|
||||
${PN}-chassis \
|
||||
${PN}-flash \
|
||||
${PN}-system \
|
||||
${PN}-fans \
|
||||
"
|
||||
|
||||
PROVIDES += "virtual/obmc-chassis-mgmt"
|
||||
PROVIDES += "virtual/obmc-flash-mgmt"
|
||||
PROVIDES += "virtual/obmc-system-mgmt"
|
||||
PROVIDES += "virtual/obmc-fan-mgmt"
|
||||
|
||||
RPROVIDES:${PN}-chassis += "virtual-obmc-chassis-mgmt"
|
||||
RPROVIDES:${PN}-flash += "virtual-obmc-flash-mgmt"
|
||||
RPROVIDES:${PN}-system += "virtual-obmc-system-mgmt"
|
||||
RPROVIDES:${PN}-fans += "virtual-obmc-fan-mgmt"
|
||||
|
||||
SUMMARY:${PN}-chassis = "Ampere Chassis"
|
||||
RDEPENDS:${PN}-chassis = " \
|
||||
obmc-phosphor-buttons-signals \
|
||||
obmc-phosphor-buttons-handler \
|
||||
phosphor-skeleton-control-power \
|
||||
ampere-hostctrl \
|
||||
phosphor-hostlogger \
|
||||
phosphor-sel-logger \
|
||||
phosphor-logging \
|
||||
ac01-boot-progress \
|
||||
phosphor-post-code-manager \
|
||||
phosphor-host-postd \
|
||||
"
|
||||
|
||||
SUMMARY:${PN}-system = "Ampere System"
|
||||
RDEPENDS:${PN}-system = " \
|
||||
smbios-mdr \
|
||||
"
|
||||
|
||||
SUMMARY:${PN}-flash = "Ampere Flash"
|
||||
RDEPENDS:${PN}-flash = " \
|
||||
phosphor-software-manager \
|
||||
"
|
||||
|
||||
SUMMARY:${PN}-fans = "Ampere Fans"
|
||||
RDEPENDS:${PN}-fans = " \
|
||||
"
|
||||
@@ -0,0 +1,14 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
RDEPENDS:${PN} = "bash"
|
||||
|
||||
SRC_URI += " \
|
||||
file://ampere_fault_monitor.sh \
|
||||
file://ampere_check_gpio_fault.sh \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}/${sbindir}
|
||||
install -m 755 ${WORKDIR}/ampere_fault_monitor.sh ${D}/${sbindir}/
|
||||
install -m 755 ${WORKDIR}/ampere_check_gpio_fault.sh ${D}/${sbindir}/
|
||||
}
|
||||
Executable
+205
@@ -0,0 +1,205 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script monitors S0/S1 fault GPIO and detects errors or warnings from CPUs
|
||||
#
|
||||
# According to OpenBMC_Software_Funcional_Specification, section 3.16,
|
||||
#
|
||||
# When the BMC detects the GPIO_FAULT signal indicating an SCP booting failure:
|
||||
# • If a non-critical error/warning from the SCP occurs, the BMC blinks the Fault LED once.
|
||||
# • If a critical error from the SCP occurs, the BMC turns on the Fault LED.
|
||||
# The BMC monitors the GPIO_FAULT signal from the SCP during SCP booting to determine whether
|
||||
# the error is non-critical or critical. A fatal error is indicated when the signal is On and then Off
|
||||
# continuously, followed by a “quiet” period of about three seconds, and this pattern repeats. If the “quiet”
|
||||
# period is longer than three seconds, the error is non-fatal. The BMC must set up appropriate debounce
|
||||
# times to detect such errors. The BMC is expected to turn on the Fault LED forever for fatal errors, or to
|
||||
# turn on the Fault LED and turn it off when the fault clears for non-fatal errors.
|
||||
#
|
||||
# Usage: <app_name> <socket 0/1>
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source /usr/sbin/gpio-lib.sh
|
||||
|
||||
# global variables
|
||||
error_flag='/tmp/fault_err'
|
||||
warning_flag='/tmp/fault_warning'
|
||||
|
||||
duty_cycle=250000
|
||||
scan_pulse=100000
|
||||
blank_num=8
|
||||
|
||||
curr_pattern=0
|
||||
prev_pattern=0
|
||||
|
||||
gpio_status=0
|
||||
repeat=0
|
||||
|
||||
socket=$1
|
||||
|
||||
socket1_present=15
|
||||
socket1_status=1
|
||||
|
||||
S0_fault_gpio=73
|
||||
S1_fault_gpio=201
|
||||
|
||||
map_event_name() {
|
||||
case $curr_pattern in
|
||||
1)
|
||||
event_name="RAS_GPIO_INVALID_LCS"
|
||||
;;
|
||||
2)
|
||||
event_name="RAS_GPIO_FILE_HDR_INVALID"
|
||||
;;
|
||||
3)
|
||||
event_name="RAS_GPIO_FILE_INTEGRITY_INVALID"
|
||||
;;
|
||||
4)
|
||||
event_name="RAS_GPIO_KEY_CERT_AUTH_ERR"
|
||||
;;
|
||||
5)
|
||||
event_name="RAS_GPIO_CNT_CERT_AUTH_ERR"
|
||||
;;
|
||||
6)
|
||||
event_name="RAS_GPIO_I2C_HARDWARE_ERR"
|
||||
;;
|
||||
7)
|
||||
event_name="RAS_GPIO_CRYPTO_ENGINE_ERR"
|
||||
;;
|
||||
8)
|
||||
event_name="RAS_GPIO_ROTPK_EFUSE_INVALID"
|
||||
;;
|
||||
9)
|
||||
event_name="RAS_GPIO_SEED_EFUSE_INVALID"
|
||||
;;
|
||||
10)
|
||||
event_name="RAS_GPIO_LCS_FROM_EFUSE_INVALID"
|
||||
;;
|
||||
11)
|
||||
event_name="RAS_GPIO_PRIM_ROLLBACK_EFUSE_INVALID"
|
||||
;;
|
||||
12)
|
||||
event_name="RAS_GPIO_SEC_ROLLBACK_EFUSE_INVALID"
|
||||
;;
|
||||
13)
|
||||
event_name="RAS_GPIO_HUK_EFUSE_INVALID"
|
||||
;;
|
||||
14)
|
||||
event_name="RAS_GPIO_CERT_DATA_INVALID"
|
||||
;;
|
||||
15)
|
||||
event_name="RAS_GPIO_INTERNAL_HW_ERR"
|
||||
;;
|
||||
*)
|
||||
event_name="NOT_SUPPORT"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
detect_patern_repeat() {
|
||||
local prev=0
|
||||
local curr=0
|
||||
local cnt=13
|
||||
|
||||
while true
|
||||
do
|
||||
usleep $scan_pulse
|
||||
gpio_status=$(cat /sys/class/gpio/gpio"$gpio_Id"/value)
|
||||
prev=$curr
|
||||
curr=$gpio_status
|
||||
if [ "$prev" == 0 ] && [ "$curr" == 1 ]; then
|
||||
# patern start repeating, check if previous and current pattern are the same
|
||||
repeat=1
|
||||
break
|
||||
fi
|
||||
if [ "$cnt" == 0 ]; then
|
||||
map_event_name
|
||||
echo "detected a warning from fault GPIO #$fault_gpio $socket, event $event_name"
|
||||
# pattern not repeat, this is a warning, turn on warning flag
|
||||
touch $warning_flag
|
||||
break
|
||||
fi
|
||||
cnt=$(( cnt - 1 ))
|
||||
done
|
||||
}
|
||||
|
||||
detect_pattern() {
|
||||
local cnt_falling_edge=0
|
||||
local cnt_blank=0
|
||||
|
||||
local prev=0
|
||||
local curr=0
|
||||
|
||||
while true
|
||||
do
|
||||
prev=$curr
|
||||
curr=$gpio_status
|
||||
# count the falling edges, if they appear, just reset cnt_blank
|
||||
if [ "$prev" == 1 ] && [ "$curr" == 0 ]; then
|
||||
cnt_falling_edge=$(( cnt_falling_edge + 1 ))
|
||||
cnt_blank=0
|
||||
continue
|
||||
# check if we are in the quite gap
|
||||
elif [ "$prev" == 0 ] && [ "$curr" == 0 ]; then
|
||||
cnt_blank=$(( cnt_blank + 1 ))
|
||||
if [ "$cnt_blank" == "$blank_num" ]; then
|
||||
# echo "pattern number falling_edge=$cnt_falling_edge blank=$cnt_blank"
|
||||
curr_pattern=$cnt_falling_edge
|
||||
# after count all falling edges, now check if patern repeat after 3s
|
||||
detect_patern_repeat
|
||||
break
|
||||
fi
|
||||
fi
|
||||
usleep $scan_pulse
|
||||
gpio_status=$(cat /sys/class/gpio/gpio"$gpio_Id"/value)
|
||||
done
|
||||
}
|
||||
|
||||
gpio_config_input() {
|
||||
echo "$gpio_Id" > /sys/class/gpio/export
|
||||
echo "in" > /sys/class/gpio/gpio"${gpio_Id}"/direction
|
||||
}
|
||||
|
||||
init_sysfs_fault_gpio() {
|
||||
gpio_Id=$(gpio_number "$fault_gpio")
|
||||
if [ -d /sys/class/gpio/gpio"$gpio_Id" ]; then
|
||||
return
|
||||
fi
|
||||
gpio_config_input "$fault_gpio"
|
||||
}
|
||||
|
||||
# init
|
||||
if [ "$socket" == "0" ]; then
|
||||
fault_gpio=$S0_fault_gpio
|
||||
else
|
||||
socket1_status=$(gpioget 0 "$socket1_present")
|
||||
if [ "$socket1_status" == 1 ]; then
|
||||
echo "socket 1 not present"
|
||||
exit 1
|
||||
fi
|
||||
fault_gpio=$S1_fault_gpio
|
||||
fi
|
||||
|
||||
init_sysfs_fault_gpio
|
||||
|
||||
# daemon start
|
||||
while true
|
||||
do
|
||||
# detect when pattern starts
|
||||
if [ "$gpio_status" == 1 ]; then
|
||||
# now, there is something on gpio, check if that is a pattern
|
||||
detect_pattern
|
||||
if [ "$repeat" == 1 ] && [ "$prev_pattern" == "$curr_pattern" ]; then
|
||||
map_event_name
|
||||
echo "detected an error from fault GPIO #$fault_gpio $socket, event#$curr_pattern $event_name"
|
||||
touch $error_flag
|
||||
repeat=0
|
||||
fi
|
||||
prev_pattern=$curr_pattern
|
||||
curr_pattern=0
|
||||
continue
|
||||
fi
|
||||
usleep $duty_cycle
|
||||
gpio_status=$(cat /sys/class/gpio/gpio"$gpio_Id"/value)
|
||||
|
||||
done
|
||||
|
||||
exit 1
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script monitors fan, over-temperature, PSU, CPU/SCP failure and update fault LED status
|
||||
|
||||
# shellcheck disable=SC2004
|
||||
# shellcheck disable=SC2046
|
||||
# shellcheck source=/dev/null
|
||||
|
||||
# common variables
|
||||
warning_fault_flag='/tmp/fault_warning'
|
||||
error_fault_flag='/tmp/fault_err'
|
||||
overtemp_fault_flag='/tmp/fault_overtemp'
|
||||
fault_RAS_UE_flag='/tmp/fault_RAS_UE'
|
||||
|
||||
blink_rate=100000
|
||||
|
||||
fault="false"
|
||||
|
||||
on="true"
|
||||
off="false"
|
||||
|
||||
gpio_fault="false"
|
||||
|
||||
# fan variables
|
||||
fan_failed="false"
|
||||
fan_failed_flag='/tmp/fan_failed'
|
||||
|
||||
# PSU variables
|
||||
psu_failed="false"
|
||||
psu_bus=6
|
||||
psu0_addr=0x58
|
||||
psu1_addr=0x59
|
||||
status_word_cmd=0x79
|
||||
# Following the PMBus Specification
|
||||
# Bit[1]: CML faults
|
||||
# Bit[2]: Over temperature faults
|
||||
# Bit[3]: Under voltage faults
|
||||
# Bit[4]: Over current faults
|
||||
# Bit[5]: Over voltage fault
|
||||
# Bit[10]: Fan faults
|
||||
psu_fault_bitmask=0x43e
|
||||
|
||||
# led variables
|
||||
led_service='xyz.openbmc_project.LED.GroupManager'
|
||||
led_fault_path='/xyz/openbmc_project/led/groups/system_fault'
|
||||
led_fault_interface='xyz.openbmc_project.Led.Group'
|
||||
fault_led_status=$off
|
||||
|
||||
# functions declaration
|
||||
check_fan_failed() {
|
||||
if [[ -f $fan_failed_flag ]]; then
|
||||
fan_failed="true"
|
||||
else
|
||||
fan_failed="false"
|
||||
fi
|
||||
}
|
||||
|
||||
turn_on_off_fault_led() {
|
||||
busctl set-property $led_service $led_fault_path $led_fault_interface Asserted b "$1" >> /dev/null
|
||||
}
|
||||
|
||||
check_psu_failed() {
|
||||
local psu0_presence
|
||||
local psu1_presence
|
||||
local psu0_value
|
||||
local psu1_value
|
||||
|
||||
psu0_presence=$(gpioget $(gpiofind PSU1_PRESENT))
|
||||
psu0_failed="true"
|
||||
if [ "$psu0_presence" == "0" ]; then
|
||||
# PSU0 presence, monitor the PSUs using pmbus, check the STATUS_WORD
|
||||
psu0_value=$(i2cget -f -y $psu_bus $psu0_addr $status_word_cmd w)
|
||||
psu0_bit_fault=$(($psu0_value & $psu_fault_bitmask))
|
||||
if [ "$psu0_bit_fault" == "0" ]; then
|
||||
psu0_failed="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
psu1_presence=$(gpioget $(gpiofind PSU2_PRESENT))
|
||||
psu1_failed="true"
|
||||
if [ "$psu1_presence" == "0" ]; then
|
||||
# PSU1 presence, monitor the PSUs using pmbus, check the STATUS_WORD
|
||||
psu1_value=$(i2cget -f -y $psu_bus $psu1_addr $status_word_cmd w)
|
||||
psu1_bit_fault=$(($psu1_value & $psu_fault_bitmask))
|
||||
if [ "$psu1_bit_fault" == "0" ]; then
|
||||
psu1_failed="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$psu0_failed" == "true" ] || [ "$psu1_failed" == "true" ]; then
|
||||
psu_failed="true"
|
||||
else
|
||||
psu_failed="false"
|
||||
fi
|
||||
}
|
||||
|
||||
check_fault() {
|
||||
if [[ "$fan_failed" == "true" ]] || [[ "$psu_failed" == "true" ]] \
|
||||
|| [[ "$gpio_fault" == "true" ]] \
|
||||
|| [[ "$RAS_UE_occured" == "true" ]] \
|
||||
|| [[ "$overtemp_occured" == "true" ]]; then
|
||||
fault="true"
|
||||
else
|
||||
fault="false"
|
||||
fi
|
||||
}
|
||||
|
||||
control_fault_led() {
|
||||
if [ "$fault" == "true" ]; then
|
||||
if [ "$fault_led_status" == $off ]; then
|
||||
turn_on_off_fault_led $on
|
||||
fault_led_status=$on
|
||||
fi
|
||||
else
|
||||
if [ "$fault_led_status" == $on ]; then
|
||||
turn_on_off_fault_led $off
|
||||
fault_led_status=$off
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
blink_fault_led() {
|
||||
if [ "$fault_led_status" == $off ]; then
|
||||
turn_on_off_fault_led $on
|
||||
usleep $blink_rate
|
||||
turn_on_off_fault_led $off
|
||||
else
|
||||
turn_on_off_fault_led $off
|
||||
usleep $blink_rate
|
||||
turn_on_off_fault_led $on
|
||||
fi
|
||||
}
|
||||
|
||||
check_gpio_fault() {
|
||||
if [[ -f $error_fault_flag ]]; then
|
||||
gpio_fault="true"
|
||||
else
|
||||
if [ -f $warning_fault_flag ]; then
|
||||
blink_fault_led
|
||||
rm $warning_fault_flag
|
||||
fi
|
||||
gpio_fault="false"
|
||||
fi
|
||||
}
|
||||
|
||||
check_RAS_UE_occured() {
|
||||
if [[ -f $fault_RAS_UE_flag ]]; then
|
||||
echo "RAS UE error occured, turn on fault LED"
|
||||
RAS_UE_occured="true"
|
||||
else
|
||||
RAS_UE_occured="false"
|
||||
fi
|
||||
}
|
||||
|
||||
check_overtemp_occured() {
|
||||
if [[ -f $overtemp_fault_flag ]]; then
|
||||
echo "Over temperature occured, turn on fault LED"
|
||||
overtemp_occured="true"
|
||||
else
|
||||
overtemp_occured="false"
|
||||
fi
|
||||
}
|
||||
|
||||
# daemon start
|
||||
while true
|
||||
do
|
||||
check_gpio_fault
|
||||
check_fan_failed
|
||||
check_overtemp_occured
|
||||
check_RAS_UE_occured
|
||||
|
||||
# Monitors PSU presence
|
||||
check_psu_failed
|
||||
|
||||
check_fault
|
||||
control_fault_led
|
||||
sleep 2
|
||||
done
|
||||
|
||||
exit 1
|
||||
@@ -0,0 +1,18 @@
|
||||
SUMMARY = "Ampere Computing LLC Update MAC Address from FRU Inventory Information"
|
||||
DESCRIPTION = "Update MAC Address from FRU Inventory Information for Ampere systems"
|
||||
PR = "r1"
|
||||
|
||||
LICENSE = "Apache-2.0"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit systemd
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
DEPENDS = "systemd"
|
||||
RDEPENDS:${PN} = "bash"
|
||||
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "ampere_update_mac.service"
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Updating MAC Address Service From FRU inventory
|
||||
Requires=xyz.openbmc_project.EntityManager.service
|
||||
After=xyz.openbmc_project.EntityManager.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/ampere_update_mac.sh eth1 3 80
|
||||
SyslogIdentifier=ampere_update_mac.sh
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy={SYSTEMD_DEFAULT_TARGET}
|
||||
@@ -0,0 +1,32 @@
|
||||
SUMMARY = "Phosphor OpenBMC Mt.Jade Platform Init Service"
|
||||
DESCRIPTION = "Phosphor OpenBMC Mt.Jade Platform Init Daemon"
|
||||
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit systemd
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
DEPENDS += "systemd"
|
||||
RDEPENDS:${PN} += "libsystemd"
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
SRC_URI = " \
|
||||
file://ampere_platform_init.sh \
|
||||
file://ampere_uart_console_setup.sh \
|
||||
file://ampere_uartmux_ctrl.sh \
|
||||
file://ampere-platform-init.service \
|
||||
"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN} = "ampere-platform-init.service"
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/ampere_platform_init.sh ${D}${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_uart_console_setup.sh ${D}${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir}/
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/ampere-platform-init.service ${D}${systemd_unitdir}/system
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description = Mt.Jade Platform Initialization
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
RemainAfterExit=true
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/ampere_platform_init.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-lib.sh
|
||||
source /usr/sbin/gpio-lib.sh
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-defs.sh
|
||||
source /usr/sbin/gpio-defs.sh
|
||||
source /usr/sbin/ampere_uart_console_setup.sh
|
||||
|
||||
# Configure to boot from MAIN SPI-HOST
|
||||
gpio_configure_output "$SPI0_BACKUP_SEL" 0
|
||||
|
||||
gpio_configure_input "$S0_I2C9_ALERT_L"
|
||||
gpio_configure_input "$S1_I2C9_ALERT_L"
|
||||
gpio_configure_input "$GPIO_BMC_VGA_FRONT_PRES_L"
|
||||
gpio_configure_input "$GPIO_S0_VRHOT_L"
|
||||
gpio_configure_input "$GPIO_S1_VRHOT_L"
|
||||
gpio_configure_output "$BMC_VGA_SEL" 1
|
||||
|
||||
# =======================================================
|
||||
# Below GPIOs are controlled by other services so just
|
||||
# initialize in A/C power only.
|
||||
bootstatus=$(cat /sys/class/watchdog/watchdog0/bootstatus)
|
||||
if [ "$bootstatus" == '32' ]; then
|
||||
gpio_configure_output "$BMC_GPIOR2_EXT_HIGHTEMP_L" 1
|
||||
gpio_configure_output "$GPIO_BMC_VR_PMBUS_SEL_L" 1
|
||||
gpio_configure_output "$GPIO_BMC_I2C6_RESET_L" 1
|
||||
|
||||
# Initialize OCP register
|
||||
gpio_configure_output "$OCP_MAIN_PWREN" 0
|
||||
|
||||
# Configure SPI-NOR/EEPROM switching
|
||||
gpio_configure_output "$SPI0_PROGRAM_SEL" 0
|
||||
gpio_configure_output "$BMC_I2C_BACKUP_SEL" 1
|
||||
gpio_configure_output "$SPI0_BACKUP_SEL" 0
|
||||
|
||||
# Initialize BMC_SYS_PSON_L, SHD_REQ_L, BMC_SYSRESET_L
|
||||
gpio_configure_output "$SYS_PSON_L" 1
|
||||
gpio_configure_output "$S0_SHD_REQ_L" 1
|
||||
gpio_configure_output "$S0_SYSRESET_L" 1
|
||||
gpio_configure_output "$S1_SYSRESET_L" 1
|
||||
|
||||
# RTC Lock, SPECIAL_BOOT
|
||||
gpio_configure_output "$RTC_LOCK" 0
|
||||
gpio_configure_output "$S0_SPECIAL_BOOT" 0
|
||||
gpio_configure_output "$S1_SPECIAL_BOOT" 0
|
||||
fi
|
||||
|
||||
gpio_configure_output "$BMC_READY" 1
|
||||
# =======================================================
|
||||
# Setting uart muxes to BMC as default
|
||||
uart_console_setup
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# 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.
|
||||
|
||||
# shellcheck disable=SC2039
|
||||
# shellcheck disable=SC2112
|
||||
# shellcheck disable=SC3010
|
||||
# shellcheck disable=SC3030
|
||||
# shellcheck disable=SC3054
|
||||
|
||||
export obmc_console_tty=("ttyS0" "ttyS1" "ttyS2" "ttyS3")
|
||||
|
||||
function get_uart_port()
|
||||
{
|
||||
tty=$1
|
||||
case "${tty}" in
|
||||
"ttyS0") uart=1
|
||||
;;
|
||||
"ttyS1") uart=2
|
||||
;;
|
||||
"ttyS2") uart=3
|
||||
;;
|
||||
"ttyS3") uart=4
|
||||
;;
|
||||
*) echo "Invalid tty passed to $0. Exiting!"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
echo $uart
|
||||
}
|
||||
|
||||
function uart_console_setup()
|
||||
{
|
||||
# Default the host routing through the mux to use the BMC (2)
|
||||
# This allows the SoL console in webui, and the ssh port 2200, to work
|
||||
# upon startup. If UART transcievers are installed on the header and required,
|
||||
# this value should be set to 1
|
||||
for tty in "${obmc_console_tty[@]}"; do
|
||||
uart=$(get_uart_port "$tty")
|
||||
if [ "${uart}" -ne 0 ]
|
||||
then
|
||||
/usr/sbin/ampere_uartmux_ctrl.sh "${uart}" 2
|
||||
fi
|
||||
done
|
||||
}
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2021 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: UART MUX/DEMUX for CPU0 UART0,1,4 and CPU1 UART1
|
||||
# Usage: ampere_uartmux_ctrl.sh <CPU UART port number> <UARTx_MODE>
|
||||
# <UARTx_MODE> of 1 sets CPU To HDR_CONN
|
||||
# <UARTx_MODE> of 2 sets BMC to CPU (eg dropbear ssh server on port 2200)
|
||||
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-lib.sh
|
||||
source /usr/sbin/gpio-lib.sh
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
1) GPIO_UARTx_MODE0=56
|
||||
;;
|
||||
2) GPIO_UARTx_MODE0=57
|
||||
;;
|
||||
3) GPIO_UARTx_MODE0=58
|
||||
;;
|
||||
4) GPIO_UARTx_MODE0=59
|
||||
;;
|
||||
*) echo "Invalid UART port selection"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Ampere UART MUX CTRL UART port $1 to mode $2"
|
||||
|
||||
case "$2" in
|
||||
1) gpio_configure_output "${GPIO_UARTx_MODE0}" 0
|
||||
exit 0
|
||||
;;
|
||||
2) gpio_configure_output "${GPIO_UARTx_MODE0}" 1
|
||||
exit 0
|
||||
;;
|
||||
*) echo "Invalid UART mode selection"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,20 @@
|
||||
FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append = " \
|
||||
file://gpio-defs.sh \
|
||||
file://gpio-lib.sh \
|
||||
file://ampere_power_util.sh \
|
||||
file://ampere_firmware_upgrade.sh \
|
||||
file://ampere_flash_bios.sh \
|
||||
file://ampere_driver_binder.sh \
|
||||
"
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}/usr/sbin
|
||||
install -m 0755 ${WORKDIR}/gpio-lib.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/gpio-defs.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_firmware_upgrade.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_flash_bios.sh ${D}/${sbindir}/
|
||||
install -m 0755 ${WORKDIR}/ampere_driver_binder.sh ${D}/${sbindir}/
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
DELAY_BEFORE_BIND=5000000
|
||||
# Each driver include driver name and driver path
|
||||
declare -a DRIVER_NAMEs=("2-004f"
|
||||
"2-004e"
|
||||
)
|
||||
# Driver path should include / at the end
|
||||
declare -a DRIVER_PATHs=("/sys/bus/i2c/drivers/smpro-core/"
|
||||
"/sys/bus/i2c/drivers/smpro-core/"
|
||||
)
|
||||
|
||||
# get length of an array
|
||||
arraylength=${#DRIVER_NAMEs[@]}
|
||||
|
||||
usleep $DELAY_BEFORE_BIND
|
||||
# use for loop to read all values and indexes
|
||||
for (( i=0; i<"${arraylength}"; i++ ));
|
||||
do
|
||||
bindFile="${DRIVER_PATHs[$i]}bind"
|
||||
driverDir="${DRIVER_PATHs[$i]}${DRIVER_NAMEs[$i]}"
|
||||
if [ -d "$driverDir" ]; then
|
||||
echo "Driver ${DRIVER_NAMEs[$i]} is already bound."
|
||||
continue;
|
||||
fi
|
||||
echo "${DRIVER_NAMEs[$i]}" > "$bindFile"
|
||||
done
|
||||
|
||||
exit 0
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
#!/bin/bash
|
||||
|
||||
do_fru_upgrade() {
|
||||
FRU_DEVICE="/sys/bus/i2c/devices/3-0050/eeprom"
|
||||
|
||||
if ! command -v ampere_fru_upgrade;
|
||||
then
|
||||
echo "Bypass fru update as no ampere_fru_upgrade available"
|
||||
exit
|
||||
fi
|
||||
ampere_fru_upgrade -d $FRU_DEVICE -f "$IMAGE"
|
||||
|
||||
systemctl restart xyz.openbmc_project.FruDevice.service
|
||||
systemctl restart phosphor-ipmi-host.service
|
||||
}
|
||||
|
||||
do_smpmpro_upgrade() {
|
||||
I2C_BUS_DEV="1"
|
||||
EEPROM_ADDR="0x50"
|
||||
|
||||
if ! command -v ampere_eeprom_prog;
|
||||
then
|
||||
echo "Bypass SCP firmware update as no ampere_eeprom_prog available"
|
||||
exit
|
||||
fi
|
||||
echo "SECPRO mode: $SECPRO"
|
||||
# Turn off the Host if it is currently ON
|
||||
chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}')
|
||||
echo "Current Chassis State: $chassisstate"
|
||||
if [ "$chassisstate" == 'On' ];
|
||||
then
|
||||
echo "Turning the Chassis off"
|
||||
obmcutil chassisoff
|
||||
|
||||
# Wait 60s until Chassis is off
|
||||
cnt=30
|
||||
while [ "$cnt" -gt 0 ];
|
||||
do
|
||||
cnt=$((cnt - 1))
|
||||
sleep 2
|
||||
# Check if HOST was OFF
|
||||
chassisstate_off=$(obmcutil chassisstate | awk -F. '{print $NF}')
|
||||
if [ "$chassisstate_off" != 'On' ];
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ "$cnt" == "0" ];
|
||||
then
|
||||
echo "--- Error : Failed turning the Chassis off"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $SECPRO == 1 ]]; then
|
||||
# 3 is S0_SPECIAL_BOOT
|
||||
gpioset 0 3=1
|
||||
# 66 is S1_SPECIAL_BOOT
|
||||
gpioset 0 66=1
|
||||
fi
|
||||
|
||||
# Switch EEPROM control to BMC AST2500 I2C
|
||||
# 226 is BMC_GPIOAC2_SPI0_PROGRAM_SEL
|
||||
gpioset 0 226=0
|
||||
|
||||
# 08 is BMC_GPIOB0_I2C_BACKUP_SEL
|
||||
if [[ $DEV_SEL == 1 ]]; then
|
||||
echo "Run update primary Boot EEPROM"
|
||||
gpioset 0 8=1 # Main EEPROM
|
||||
elif [[ $DEV_SEL == 2 ]]; then
|
||||
echo "Run update secondary Boot EEPROM"
|
||||
gpioset 0 8=0 # Second EEPROM
|
||||
else
|
||||
echo "Please choose Main (1) or Second EEPROM (2)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Write Firmware to EEPROM and read back for validation
|
||||
ampere_eeprom_prog -b $I2C_BUS_DEV -s $EEPROM_ADDR -p -f "$IMAGE"
|
||||
|
||||
# Switch EEPROM control to Host
|
||||
# 08 is BMC_GPIOB0_I2C_BACKUP_SEL
|
||||
gpioset 0 8=1
|
||||
# 226 is BMC_GPIOAC2_SPI0_PROGRAM_SEL
|
||||
gpioset 0 226=1
|
||||
|
||||
# Deassert SECPRO GPIO PINs
|
||||
if [[ $SECPRO == 1 ]]; then
|
||||
echo "De-asserting special GPIO PINs"
|
||||
# 3 is S0_SPECIAL_BOOT
|
||||
gpioset 0 3=0
|
||||
# 66 is S1_SPECIAL_BOOT
|
||||
gpioset 0 66=0
|
||||
fi
|
||||
|
||||
if [ "$chassisstate" == 'On' ];
|
||||
then
|
||||
sleep 5
|
||||
echo "Turn on the Host"
|
||||
obmcutil poweron
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage:"
|
||||
echo " $(basename "$0") <Type> <Image file> <DEV_SEL> [SECPRO]"
|
||||
echo "Where:"
|
||||
echo " <Type>: smpmpro or fru"
|
||||
echo " If Type is smpmpro, then DEV_SEL must is 1 (MAIN EEPROM), 2 (Failover)"
|
||||
echo " SECPRO: Optional, input '1' to enter & flash secpro mode. Default: 0"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TYPE=$1
|
||||
IMAGE=$2
|
||||
if [ -z "$3" ]
|
||||
then
|
||||
DEV_SEL="1" # by default, select Main image
|
||||
else
|
||||
DEV_SEL=$3
|
||||
fi
|
||||
|
||||
SECPRO=0
|
||||
if [ -n "$4" ]; then
|
||||
if [[ "$4" == "1" ]]; then
|
||||
SECPRO=1
|
||||
fi
|
||||
fi
|
||||
|
||||
MANIFEST="$(echo "$IMAGE" | cut -d'/' -f-4)/MANIFEST"
|
||||
if [ -f "$MANIFEST" ]; then
|
||||
echo "MANIFEST: $MANIFEST"
|
||||
if grep -qF "SECPRO" "$MANIFEST"; then
|
||||
SECPRO=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restrict to flash failover in case of SECPRO
|
||||
if [ $SECPRO == 1 ] && [ "$DEV_SEL" == 2 ]; then
|
||||
echo "Not allow to flash the failover with SECPRO image"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $TYPE == "smpmpro" ]]; then
|
||||
do_smpmpro_upgrade
|
||||
elif [[ $TYPE == "fru" ]]; then
|
||||
do_fru_upgrade
|
||||
fi
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2021 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.
|
||||
|
||||
do_flash () {
|
||||
# Check the PNOR partition available
|
||||
HOST_MTD=$(< /proc/mtd grep "pnor-uefi" | sed -n 's/^\(.*\):.*/\1/p')
|
||||
if [ -z "$HOST_MTD" ];
|
||||
then
|
||||
# Check the ASpeed SMC driver bound before
|
||||
HOST_SPI=/sys/bus/platform/drivers/spi-aspeed-smc/1e630000.spi
|
||||
if [ -d "$HOST_SPI" ]; then
|
||||
echo "Unbind the ASpeed SMC driver"
|
||||
echo 1e630000.spi > /sys/bus/platform/drivers/spi-aspeed-smc/unbind
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
# If the PNOR partition is not available, then bind again driver
|
||||
echo "--- Bind the ASpeed SMC driver"
|
||||
echo 1e630000.spi > /sys/bus/platform/drivers/spi-aspeed-smc/bind
|
||||
sleep 2
|
||||
|
||||
HOST_MTD=$(< /proc/mtd grep "pnor-uefi" | sed -n 's/^\(.*\):.*/\1/p')
|
||||
if [ -z "$HOST_MTD" ];
|
||||
then
|
||||
echo "Fail to probe Host SPI-NOR device"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "--- Flashing firmware to @/dev/$HOST_MTD"
|
||||
flashcp -v "$IMAGE" /dev/"$HOST_MTD"
|
||||
}
|
||||
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $(basename "$0") <BIOS image file>"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
IMAGE="$1"
|
||||
if [ ! -f "$IMAGE" ]; then
|
||||
echo "The image file $IMAGE does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
DEV_SEL="1" # by default, select primary device
|
||||
else
|
||||
DEV_SEL="$2"
|
||||
fi
|
||||
|
||||
# Turn off the Host if it is currently ON
|
||||
chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}')
|
||||
echo "--- Current Chassis State: $chassisstate"
|
||||
if [ "$chassisstate" == 'On' ];
|
||||
then
|
||||
echo "--- Turning the Chassis off"
|
||||
obmcutil chassisoff
|
||||
|
||||
# Wait 60s until Chassis is off
|
||||
cnt=30
|
||||
while [ "$cnt" -gt 0 ];
|
||||
do
|
||||
cnt=$((cnt - 1))
|
||||
sleep 2
|
||||
# Check if HOST was OFF
|
||||
chassisstate_off=$(obmcutil chassisstate | awk -F. '{print $NF}')
|
||||
if [ "$chassisstate_off" != 'On' ];
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ "$cnt" == "0" ];
|
||||
then
|
||||
echo "--- Error : Failed turning the Chassis off"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Switch the host SPI bus to BMC"
|
||||
echo "--- Switch the host SPI bus to BMC."
|
||||
if ! gpioset 0 226=0; then
|
||||
echo "ERROR: Switch the host SPI bus to BMC. Please check gpio state"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Switch the host SPI bus (between primary and secondary)
|
||||
# 227 is BMC_SPI0_BACKUP_SEL
|
||||
if [[ $DEV_SEL == 1 ]]; then
|
||||
echo "Run update primary Host SPI-NOR"
|
||||
gpioset 0 227=0 # Primary SPI
|
||||
elif [[ $DEV_SEL == 2 ]]; then
|
||||
echo "Run update secondary Host SPI-NOR"
|
||||
gpioset 0 227=1 # Second SPI
|
||||
else
|
||||
echo "Please choose primary SPI (1) or second SPI (2)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Flash the firmware
|
||||
do_flash
|
||||
|
||||
# Switch the host SPI bus to HOST."
|
||||
echo "--- Switch the host SPI bus to HOST."
|
||||
if ! gpioset 0 226=1; then
|
||||
echo "ERROR: Switch the host SPI bus to HOST. Please check gpio state"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$chassisstate" == 'On' ];
|
||||
then
|
||||
sleep 5
|
||||
echo "Turn on the Host"
|
||||
obmcutil poweron
|
||||
fi
|
||||
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-defs.sh
|
||||
source /usr/sbin/gpio-defs.sh
|
||||
|
||||
# Usage of this utility
|
||||
function usage() {
|
||||
echo "Usage:"
|
||||
echo " ampere_power_util.sh mb [status|shutdown_ack|force_reset|soft_off]";
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
shutdown_ack() {
|
||||
if [ -f "/run/openbmc/host@0-softpoweroff" ]; then
|
||||
echo "Receive shutdown ACK triggered after softportoff the host."
|
||||
touch /run/openbmc/host@0-softpoweroff-shutdown-ack
|
||||
else
|
||||
echo "Receive shutdown ACK triggered"
|
||||
sleep 3
|
||||
systemctl start obmc-chassis-poweroff@0.target
|
||||
fi
|
||||
}
|
||||
|
||||
soft_off() {
|
||||
# Trigger shutdown_req
|
||||
touch /run/openbmc/host@0-softpoweroff
|
||||
gpioset -l 0 "$S0_SHD_REQ_L"=1
|
||||
sleep 1s
|
||||
gpioset -l 0 "$S0_SHD_REQ_L"=0
|
||||
|
||||
# Wait for shutdown_ack from the host in 30 seconds
|
||||
cnt=30
|
||||
while [ $cnt -gt 0 ];
|
||||
do
|
||||
# Wait for SHUTDOWN_ACK and create the host@0-softpoweroff-shutdown-ack
|
||||
if [ -f "/run/openbmc/host@0-softpoweroff-shutdown-ack" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
cnt=$((cnt - 1))
|
||||
done
|
||||
# Softpoweroff is successed
|
||||
sleep 2
|
||||
rm -rf /run/openbmc/host@0-softpoweroff
|
||||
if [ -f "/run/openbmc/host@0-softpoweroff-shutdown-ack" ]; then
|
||||
rm -rf /run/openbmc/host@0-softpoweroff-shutdown-ack
|
||||
fi
|
||||
echo 0
|
||||
}
|
||||
|
||||
force_reset() {
|
||||
if [ -f "/run/openbmc/host@0-softpoweroff" ]; then
|
||||
# In graceful host reset, after trigger os shutdown,
|
||||
# the phosphor-state-manager will call force-warm-reset
|
||||
# in this case the force_reset should wait for shutdown_ack from host
|
||||
cnt=30
|
||||
while [ $cnt -gt 0 ];
|
||||
do
|
||||
if [ -f "/run/openbmc/host@0-softpoweroff-shutdown-ack" ]; then
|
||||
break
|
||||
fi
|
||||
echo "Waiting for shutdown-ack count down $cnt"
|
||||
sleep 1
|
||||
cnt=$((cnt - 1))
|
||||
done
|
||||
# The host OS is failed to shutdown
|
||||
if [ $cnt == 0 ]; then
|
||||
echo "Shutdown-ack time out after 30s."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "Triggering sysreset pin"
|
||||
gpioset -l 0 "$S0_SYSRESET_L"=1
|
||||
sleep 1
|
||||
gpioset -l 0 "$S0_SYSRESET_L"=0
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
mkdir -p /run/openbmc/
|
||||
|
||||
if [ "$2" == "shutdown_ack" ]; then
|
||||
shutdown_ack
|
||||
elif [ "$2" == "status" ]; then
|
||||
power_status
|
||||
elif [ "$2" == "force_reset" ]; then
|
||||
force_reset
|
||||
elif [ "$2" == "soft_off" ]; then
|
||||
ret=$(soft_off)
|
||||
if [ "$ret" == 0 ]; then
|
||||
echo "The host is already softoff"
|
||||
else
|
||||
echo "Failed to softoff the host"
|
||||
fi
|
||||
exit "$ret";
|
||||
else
|
||||
echo "Invalid parameter2=$2"
|
||||
usage;
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
# Index of GPIO device in gpioget/gpioset
|
||||
GPIO_CHIP0_IDX=0
|
||||
GPIO_CHIP1_IDX=1
|
||||
|
||||
# Base of GPIO chip in /sys/class/gpio
|
||||
GPIO_CHIP0_BASE=792
|
||||
GPIO_CHIP1_BASE=780
|
||||
|
||||
### Power control configuration
|
||||
# Power control gpios
|
||||
S0_SHD_REQ_L=49
|
||||
S0_SHD_ACK_L=50
|
||||
S0_REBOOT_ACK_L=75
|
||||
S0_SYSRESET_L=91
|
||||
S1_SYSRESET_L=92
|
||||
|
||||
|
||||
### Table 1: GPIO Assignments
|
||||
BMC_I2C_BACKUP_SEL=8
|
||||
S0_CPU_FW_BOOT_OK=48
|
||||
CPU_BMC_OVERTEMP_L=51
|
||||
CPU_BMC_HIGHTEMP_L=72
|
||||
CPU_FAULT_ALERT=73
|
||||
S1_CPU_FW_BOOT_OK=202
|
||||
S0_SPECIAL_BOOT=3
|
||||
S1_SPECIAL_BOOT=66
|
||||
RTC_LOCK=203
|
||||
|
||||
### Table 2: Alert and Additional Miscellaneous Signals
|
||||
S0_SCP_AUTH_FAILURE=74
|
||||
S1_SCP_AUTH_FAILURE=205
|
||||
BMC_OK=228
|
||||
SLAVE_PRESENT_L=230
|
||||
|
||||
### Common GPIOs
|
||||
SYS_PSON_L=42
|
||||
BMC_READY=229
|
||||
|
||||
### OCP power selection
|
||||
OCP_AUX_PWREN=139
|
||||
OCP_MAIN_PWREN=140
|
||||
|
||||
### SPI0 Mode selection
|
||||
SPI0_PROGRAM_SEL=226
|
||||
SPI0_BACKUP_SEL=227
|
||||
|
||||
### Mt.Jade specific GPIOs
|
||||
S0_I2C9_ALERT_L=100
|
||||
S1_I2C9_ALERT_L=101
|
||||
GPIO_BMC_VGA_FRONT_PRES_L=135
|
||||
GPIO_S0_VRHOT_L=144
|
||||
GPIO_S1_VRHOT_L=145
|
||||
BMC_VGA_SEL=195
|
||||
BMC_GPIOR2_EXT_HIGHTEMP_L=138
|
||||
GPIO_BMC_VR_PMBUS_SEL_L=149
|
||||
GPIO_BMC_I2C6_RESET_L=63
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-defs.sh
|
||||
source /usr/sbin/gpio-defs.sh
|
||||
|
||||
function gpio_number() {
|
||||
GPIO_BASE=$(cat /sys/class/gpio/gpiochip"$GPIO_CHIP0_BASE"/base)
|
||||
echo $((GPIO_BASE + $1))
|
||||
}
|
||||
|
||||
# Configure GPIO as output and set its value
|
||||
function gpio_configure_output() {
|
||||
gpioId=$(gpio_number "$1")
|
||||
echo "$gpioId" > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio"${gpioId}"/direction
|
||||
echo "$2" > /sys/class/gpio/gpio"${gpioId}"/value
|
||||
echo "$gpioId" > /sys/class/gpio/unexport
|
||||
}
|
||||
|
||||
function gpio_get_val() {
|
||||
gpioId=$(gpio_number "$1")
|
||||
echo "$gpioId" > /sys/class/gpio/export
|
||||
cat /sys/class/gpio/gpio"$gpioId"/value
|
||||
echo "$gpioId" > /sys/class/gpio/unexport
|
||||
}
|
||||
|
||||
# Configure GPIO as input
|
||||
function gpio_configure_input() {
|
||||
gpioId=$(gpio_number "$1")
|
||||
echo "$gpioId" > /sys/class/gpio/export
|
||||
echo "in" > /sys/class/gpio/gpio"${gpioId}"/direction
|
||||
echo "$gpioId" > /sys/class/gpio/unexport
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
SUMMARY = "Ampere Computing LLC Utilities"
|
||||
DESCRIPTION = "Ampere Utilities for Mt.Jade 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_gpio_utils.sh \
|
||||
"
|
||||
|
||||
DEPENDS = "systemd"
|
||||
RDEPENDS:${PN} = "bash"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = " \
|
||||
ampere-gpio-poweroff@.service \
|
||||
ampere-gpio-poweron@.service \
|
||||
"
|
||||
|
||||
# chassis power on
|
||||
CHASSIS_POWERON_SVC = "ampere-gpio-poweron@.service"
|
||||
CHASSIS_POWERON_INSTMPL = "ampere-gpio-poweron@{0}.service"
|
||||
CHASSIS_POWERON_TGTFMT = "obmc-chassis-poweron@{0}.target"
|
||||
CHASSIS_POWERON_FMT = "../${CHASSIS_POWERON_SVC}:${CHASSIS_POWERON_TGTFMT}.requires/${CHASSIS_POWERON_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWERON_FMT', 'OBMC_CHASSIS_INSTANCES')}"
|
||||
|
||||
# chassis power off
|
||||
CHASSIS_POWEROFF_SVC = "ampere-gpio-poweroff@.service"
|
||||
CHASSIS_POWEROFF_INSTMPL = "ampere-gpio-poweroff@{0}.service"
|
||||
CHASSIS_POWEROFF_TGTFMT = "obmc-chassis-poweroff@{0}.target"
|
||||
CHASSIS_POWEROFF_FMT = "../${CHASSIS_POWEROFF_SVC}:${CHASSIS_POWEROFF_TGTFMT}.requires/${CHASSIS_POWEROFF_INSTMPL}"
|
||||
SYSTEMD_LINK:${PN} += "${@compose_list_zip(d, 'CHASSIS_POWEROFF_FMT', 'OBMC_CHASSIS_INSTANCES')}"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}/usr/sbin
|
||||
install -m 0755 ${WORKDIR}/ampere_gpio_utils.sh ${D}/${sbindir}/
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Ampere set GPIOs before power off
|
||||
Before=phosphor-wait-power-off@%i.service
|
||||
Conflicts=obmc-chassis-poweron@%i.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/ampere_gpio_utils.sh power off
|
||||
SyslogIdentifier=ampere_gpio_utils
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Ampere set GPIOs before power on
|
||||
Before=phosphor-wait-power-on@%i.service
|
||||
After=obmc-power-start-pre@%i.target
|
||||
Conflicts=obmc-chassis-poweroff@%i.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/ampere_gpio_utils.sh power on
|
||||
SyslogIdentifier=ampere_gpio_utils
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-lib.sh
|
||||
source /usr/sbin/gpio-defs.sh
|
||||
# shellcheck source=meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/gpio-defs.sh
|
||||
source /usr/sbin/gpio-lib.sh
|
||||
|
||||
function usage() {
|
||||
echo "usage: ampere_gpio_utils.sh [power] [on|off]";
|
||||
}
|
||||
|
||||
set_gpio_power_off() {
|
||||
echo "Setting GPIO before Power off"
|
||||
}
|
||||
|
||||
set_gpio_power_on() {
|
||||
echo "Setting GPIO before Power on"
|
||||
val=$(gpio_get_val "$S0_CPU_FW_BOOT_OK")
|
||||
if [ "$val" == 1 ]; then
|
||||
exit
|
||||
fi
|
||||
gpio_configure_output "$SPI0_PROGRAM_SEL" 1
|
||||
gpio_configure_output "$SPI0_BACKUP_SEL" 0
|
||||
}
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Total number of parameter=$#"
|
||||
echo "Insufficient parameter"
|
||||
usage;
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
if [ "$1" == "power" ]; then
|
||||
if [ "$2" == "on" ]; then
|
||||
set_gpio_power_on
|
||||
elif [ "$2" == "off" ]; then
|
||||
set_gpio_power_off
|
||||
fi
|
||||
exit 0;
|
||||
else
|
||||
echo "Invalid parameter1=$1"
|
||||
usage;
|
||||
exit 0;
|
||||
fi
|
||||
@@ -0,0 +1,4 @@
|
||||
CONFIG_PHY_NCSI=n
|
||||
CONFIG_CMD_MMC=n
|
||||
CONFIG_MMC_SDHCI_ASPEED=n
|
||||
CONFIG_SYS_DCACHE_OFF=n
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user