diff options
author | Alistair Popple <alistair@popple.id.au> | 2014-11-13 17:16:05 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-12-02 18:43:26 +1100 |
commit | dd173e4beaf1da11db3bcfb2ccdfe8a623f26e53 (patch) | |
tree | f9524e195ecb3ee70032a204089260bc61706588 /external | |
parent | f8a0bb99bb6879124f153a161339bbfdef2049bf (diff) | |
download | skiboot-dd173e4beaf1da11db3bcfb2ccdfe8a623f26e53.zip skiboot-dd173e4beaf1da11db3bcfb2ccdfe8a623f26e53.tar.gz skiboot-dd173e4beaf1da11db3bcfb2ccdfe8a623f26e53.tar.bz2 |
esel: Add a logging backend for bmc based machines
This patch adds a backend for bmc based machines running AMI firmware
supporting the OEM extended sel commands. Errors are logged in pel
format to the bmc.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/read_esel.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/external/read_esel.sh b/external/read_esel.sh new file mode 100644 index 0000000..492fbce --- /dev/null +++ b/external/read_esel.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Copyright 2013-2014 IBM Corp. +# +# 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. +set -e + +BMC_HOST=$1 +RECORD_ID=$2 + +BMC_USER=admin +BMC_PASS=admin + +if [ -z "$BMC_HOST" -o -z "$RECORD_ID" ]; then + echo "Usage: $0 <bmc hostname> <record id>" + echo "Example: $0 bmc 0xa > pel.bin" + echo '' + echo 'Record ids can be found using ipmitool with the "sel list" command. Records with' + echo 'a description of "OEM record df" contain extended SEL information (in PEL' + echo 'format) which can be extracted with this tool.' + exit -1 +fi + +# Convert a number into 2 hex-bytes in little-endian order +function conv_le { + echo $(for i in $(printf %04x $1 | grep -o .. | tac); do echo -n "0x$i "; done) +} + +function conv_native { + echo -n "0x${2}${1}" +} + +record=$(conv_le $2) +offset=0 +progress=0 + +while [ $progress = 0 ]; do + result=$(ipmitool -H ${BMC_HOST} -I lan -U ${BMC_USER} -P ${BMC_PASS} raw 0x32 0xf1 ${record} $(conv_le ${offset})) + len=$(conv_native $(echo ${result} | cut -d " " -f 1-2)) + progress=$(($(echo ${result} | cut -d " " -f 3))) + data="$data "$(echo -n ${result} | cut -d " " -f 6-) + offset=$(($offset + ${#data}/3)) +done + +echo -n ${data} | cut -d " " -f 1-$(($len)) | xxd -r -p |