From a7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Jul 2014 18:04:32 +0200 Subject: Imported Upstream version 2.9.3 --- scripts/ipmi_if.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 scripts/ipmi_if.sh (limited to 'scripts/ipmi_if.sh') diff --git a/scripts/ipmi_if.sh b/scripts/ipmi_if.sh new file mode 100755 index 0000000..4068717 --- /dev/null +++ b/scripts/ipmi_if.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# ipmi_if.sh +# detect IPMI Interface type, usually KCS or SSIF +# +# Future: also include preferred Driver type on another line +# +# ifdir=/usr/share/ipmiutil +ifdir=/var/lib/ipmiutil +ifout=$ifdir/ipmi_if.txt +dmiout=/tmp/dmi.out.$$ + +mkdir -p $ifdir +which dmidecode >/dev/null 2>&1 +if [ $? -ne 0 ] +then + # if no dmidecode, old, so assume KCS + echo "Interface type: KCS" >$ifout + exit 0 +fi +dmidecode >$dmiout +# dmidecode |grep IPMI >/dev/null 2>&1 +grep IPMI $dmiout >/dev/null 2>&1 +if [ $? -ne 0 ] +then + echo "Interface type: None" >$ifout + exit 0 +fi +iftype=`grep "Interface Type:" $dmiout |cut -f2 -d':'` +echo $iftype |grep KCS >/dev/null 2>&1 +if [ $? -eq 0 ] +then + echo "Interface type: KCS" >$ifout +else + echo $iftype |grep "OUT OF SPEC" >/dev/null 2>&1 + if [ $? -eq 0 ] + then + echo "Interface type: SSIF" >$ifout + else + echo "Interface type: $iftype" >$ifout + fi +fi +# echo "IPMI `cat $ifout` interface found" + +sa=`grep "I2C Slave Address:" $dmiout |cut -f2 -d':'` +echo "I2C Slave Address: $sa" >>$ifout +base=`grep "Base Address:" $dmiout |tail -n1 |cut -f2 -d':'` +echo "Base Address: $base" >>$ifout + +spacing=1 +spac_str=`grep "Register Spacing:" $dmiout |cut -f2 -d':'` +echo $spac_str | grep "Successive Byte" >/dev/null 2>&1 +if [ $? -eq 0 ]; then + spacing=1 +else + echo $spac_str | grep "32-bit" >/dev/null 2>&1 + if [ $? -eq 0 ]; then + spacing=4 + else + spacing=2 + fi +fi +echo "Register Spacing: $spacing" >>$ifout + +biosver=`grep "Version: " $dmiout |head -n1 |cut -f2 -d':'` +echo "BIOS Version: $biosver" >>$ifout +exit 0 -- cgit v1.2.3