forked from openbmc/openbmc
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta-ampere: mtmitchell: support IPMI OEM command enable Scan Dump
Support Enable/Disable scandump mode, this mode will stop SoC monitorring mode. This mode will be recoved after A/C the system. Tested: 1. Get scandump mode status $ ipmitool raw 0x3c 0x26 00 2. Enable scandump mode $ ipmitool raw 0x3c 0x25 0x01 3. Get scandump mode status $ ipmitool raw 0x3c 0x26 01 4. Check if system firmware hang service is disabled. 5. Check there is no Eventlog from Host is created 6. Disable scandump mode $ ipmitool raw 0x3c 0x25 0x00 7. Check if system firmware hang service is enabled 8. This will be recoved after A/C the system. Signed-off-by: Hieu Huynh <[email protected]>
- Loading branch information
1 parent
7abcb6e
commit 9198120
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-utils/ampere_scandump_mode.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/bin/bash | ||
|
||
# Helper script to support enable/disable Scandump Mode | ||
# Author : Hieu Huynh ([email protected]) | ||
# | ||
# To enable Scandump mode: | ||
# ampere_scandump_mode.sh enable | ||
# | ||
# To disable Scandump mode: | ||
# ampere_scandump_mode.sh disable | ||
# | ||
# To get Scandump mode status: | ||
# ampere_scandump_mode.sh getstatus | ||
|
||
enable_scandump_mode() { | ||
echo "Enable Scandump mode" | ||
# Disable Mpro hang detection | ||
systemctl stop ampere-sysfw-hang-handler.service | ||
|
||
# Disable PLDM service | ||
systemctl stop pldmd.service | ||
|
||
# Enable scandump mode in CPLD | ||
# Get Port0 value | ||
p0_val=$(i2cget -f -y 15 0x22 0x02) | ||
p0_val=$(("$p0_val" | (1 << 4))) | ||
# Set Port0[4] value to "1" to mask all CPU’s GPIOs, set Port0[4]. | ||
i2cset -f -y 15 0x22 0x02 $p0_val | ||
|
||
p0_IOexp_val=$(i2cget -f -y 15 0x22 0x06) | ||
p0_IOexp_val=$(("$p0_IOexp_val" & ~(1 << 4))) | ||
# Config CPLD's IOepx Port0[4] from input to output, clear IOepx Port0[4]. | ||
i2cset -f -y 15 0x22 0x06 $p0_IOexp_val | ||
} | ||
|
||
diable_scandump_mode() { | ||
echo "Disable Scandump mode" | ||
|
||
# Disable scandump mode in CPLD | ||
# Get Port0 value | ||
p0_val=$(i2cget -f -y 15 0x22 0x02) | ||
p0_val=$(("$p0_val" & ~(1 << 4))) | ||
# Set Port0[4] value to "0" to unmask all CPU’s GPIOs, clear Port0[4]. | ||
i2cset -f -y 15 0x22 0x02 $p0_val | ||
|
||
p0_IOexp_val=$(i2cget -f -y 15 0x22 0x06) | ||
p0_IOexp_val=$(("$p0_IOexp_val" | (1 << 4))) | ||
# Config CPLD's IOepx Port0[4] from output to input, set IOepx Port0[4]. | ||
i2cset -f -y 15 0x22 0x06 $p0_IOexp_val | ||
|
||
# Enable Mpro hang detection | ||
systemctl start ampere-sysfw-hang-handler.service | ||
|
||
# Enable PLDM service | ||
systemctl start pldmd.service | ||
} | ||
|
||
getstatus() { | ||
# Get CPLD's IOepx Port0[4], if this bit is "0" scandump mode is enabled. | ||
p0_IOexp_val=$(i2cget -f -y 15 0x22 0x06) | ||
p0_IOexp_val=$(("$p0_IOexp_val" & (1 << 4))) | ||
if [[ "$p0_IOexp_val" == "0" ]]; then | ||
echo "Scandump mode is enabled" | ||
exit 1 | ||
else | ||
echo "Scandump mode is disabled" | ||
exit 0 | ||
fi | ||
} | ||
|
||
# Usage of this utility | ||
usage() { | ||
echo "Usage:" | ||
echo " - To enable Scandump mode" | ||
echo " $(basename "$0") enable" | ||
echo " - To disable Scandump mode" | ||
echo " $(basename "$0") disable" | ||
echo " - To get Scandump mode status" | ||
echo " $(basename "$0") getstatus" | ||
exit 0 | ||
} | ||
|
||
if [[ $1 == "enable" ]]; then | ||
enable_scandump_mode | ||
elif [[ $1 == "disable" ]]; then | ||
diable_scandump_mode | ||
elif [[ $1 == "getstatus" ]]; then | ||
getstatus | ||
else | ||
echo "Invalid mode" | ||
usage | ||
fi | ||
|
||
exit 0 |