From de522bcdf9ea26e52a81b9a4a69326774bb87a07 Mon Sep 17 00:00:00 2001 From: Ben Wei Date: Thu, 16 Apr 2020 17:12:33 -0700 Subject: [PATCH] fby3: PFR: send CHKPT_COMPLETE when BMC boot complete (#1014) Summary: - send CHKPT_COMPLETE when BMC boot complete. It could clear the watchdog timeout in CPLD in order to stop doing recovery. Pull Request resolved: https://github.com/facebookexternal/openbmc.wiwynn/pull/1014 Test Plan: - Build and test pass on fbyv3. root@bmc-oob:/# bash /etc/init.d/setup-pfr.sh Bus: 12 Device address: 0x38 To write 2 bytes: 0xf 0x9 root@bmc-oob:~# i2craw 12 0x38 -r 1 -w "0x03" Bus: 12 Device address: 0x38 To write 1 bytes: 0x3 To read 1 bytes. Received: 0xe root@bmc-oob:~# Reviewed By: williamspatrick fbshipit-source-id: 3b6372dfb7 --- .../plat-utils/files/setup-pfr.sh | 35 +++++++++++++++++++ .../recipes-fby3/plat-utils/plat-utils_0.1.bb | 6 ++++ 2 files changed, 41 insertions(+) create mode 100755 meta-facebook/meta-fby3/recipes-fby3/plat-utils/files/setup-pfr.sh diff --git a/meta-facebook/meta-fby3/recipes-fby3/plat-utils/files/setup-pfr.sh b/meta-facebook/meta-fby3/recipes-fby3/plat-utils/files/setup-pfr.sh new file mode 100755 index 000000000000..7b7e9649b46f --- /dev/null +++ b/meta-facebook/meta-fby3/recipes-fby3/plat-utils/files/setup-pfr.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Copyright 2019-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +. /usr/local/fbpackages/utils/ast-functions + +# CHKPT_COMPLETE + +BOARD_ID=$(get_bmc_board_id) +# NIC EXP BMC +if [ $BOARD_ID -eq 9 ]; then + /usr/sbin/i2craw 9 0x38 -w "0x0F 0x09" +# Baseboard BMC +elif [ $BOARD_ID -eq 14 ] || [ $BOARD_ID -eq 7 ]; then + /usr/sbin/i2craw 12 0x38 -w "0x0F 0x09" +else + echo "Is board id correct(id=$BOARD_ID)?" +fi diff --git a/meta-facebook/meta-fby3/recipes-fby3/plat-utils/plat-utils_0.1.bb b/meta-facebook/meta-fby3/recipes-fby3/plat-utils/plat-utils_0.1.bb index 9ce29a8bddae..f27cd0aa50e1 100644 --- a/meta-facebook/meta-fby3/recipes-fby3/plat-utils/plat-utils_0.1.bb +++ b/meta-facebook/meta-fby3/recipes-fby3/plat-utils/plat-utils_0.1.bb @@ -28,6 +28,7 @@ SRC_URI = "file://ast-functions \ file://COPYING \ file://setup-dev.sh \ file://sol-util \ + file://setup-pfr.sh \ " pkgdir = "utils" @@ -71,6 +72,11 @@ do_install() { # install power-on.sh install -m 755 power-on.sh ${D}${sysconfdir}/init.d/power-on.sh update-rc.d -r ${D} power-on.sh start 70 5 . + + # install setup-pfr.sh + install -m 755 setup-pfr.sh ${D}${sysconfdir}/init.d/setup-pfr.sh + update-rc.d -r ${D} setup-pfr.sh start 99 5 . + } FILES_${PN} += "/usr/local ${sysconfdir}"