feat(script : nicsensor.sh) update to version 1.2Intest Rev6

1.适配千岛湖服务器
This commit is contained in:
marcinlei 2024-11-28 12:58:49 +08:00
parent c58f8fc96f
commit 89aae7feb0

@ -47,7 +47,7 @@ EMC1413_Channel2_name="Channel 2"
fru_offset="0x00 0x00" fru_offset="0x00 0x00"
# 应用的服务器产品,根据服务器产品手动修改这个变量 # 应用的服务器产品,根据服务器产品手动修改这个变量
# 当前适配的服务器产品 5280m7 5468m7 donghu yichun # 当前适配的服务器产品 5280m7 5468m7 donghu yichun qiandaohu
server_type="5280m7" server_type="5280m7"
# --------------------------------------------------------- # ---------------------------------------------------------
@ -138,7 +138,7 @@ ina3221_ch2_volt="0"
ina3221_ch0_current="0" ina3221_ch0_current="0"
ina3221_ch1_current="0" ina3221_ch1_current="0"
ina3221_ch2_current="0" ina3221_ch2_current="0"
SCRIPT_VERSION="1.2 InTest Rev5" SCRIPT_VERSION="1.2 InTest Rev6"
fru_file_name=$option_data2 fru_file_name=$option_data2
fru_write_size=0 fru_write_size=0
@ -161,7 +161,7 @@ print_usage(){
echo "" echo ""
echo " To Auto detect i2c slave on server, please use:" echo " To Auto detect i2c slave on server, please use:"
echo " ./nicsensor.sh detect" echo " ./nicsensor.sh detect"
echo " This function now only support on server 5280m7, 5468m7, donghu" echo " This function now only support on server 5280m7, 5468m7, donghu, qiandaohu"
echo "" echo ""
echo " If want to read/write chip register, use the below format" echo " If want to read/write chip register, use the below format"
echo " ./nicsensor.sh [slot] chip [slave] [i2c_command]" echo " ./nicsensor.sh [slot] chip [slave] [i2c_command]"
@ -321,6 +321,45 @@ set_configuration_yichun(){
fi fi
} }
set_configuration_qiandaohu(){
is_have_pca9641=0
if [ $pcie_slot -le 7 ];then
i2c_bus=3
pca9548_slave=0x70
else
i2c_bus=6
pca9548_slave=0x71
fi
# set pca9548 switch channel
if [ $pcie_slot -eq 0 ];then
pca9548_channel="0x08"
elif [ $pcie_slot -eq 1 ];then
pca9548_channel="0x04"
elif [ $pcie_slot -eq 2 ];then
pca9548_channel="0x01"
elif [ $pcie_slot -eq 3 ];then
pca9548_channel="0x02"
elif [ $pcie_slot -eq 4 ];then
pca9548_channel="0x80"
elif [ $pcie_slot -eq 5 ];then
pca9548_channel="0x40"
elif [ $pcie_slot -eq 6 ];then
pca9548_channel="0x10"
elif [ $pcie_slot -eq 7 ];then
pca9548_channel="0x20"
elif [ $pcie_slot -eq 8 ];then
pca9548_channel="0x08"
elif [ $pcie_slot -eq 9 ];then
pca9548_channel="0x04"
elif [ $pcie_slot -eq 10 ];then
pca9548_channel="0x01"
elif [ $pcie_slot -eq 11 ];then
pca9548_channel="0x02"
fi
}
# 根据输入信息调整选通芯片的配置(PCA9641 PCA9548) # 根据输入信息调整选通芯片的配置(PCA9641 PCA9548)
# 20240912 - 更新脚本:支持通过服务器型号进行配置 # 20240912 - 更新脚本:支持通过服务器型号进行配置
set_configuration(){ set_configuration(){
@ -336,6 +375,8 @@ set_configuration(){
set_configuration_donghu set_configuration_donghu
elif [ $server_type == "yichun" ];then elif [ $server_type == "yichun" ];then
set_configuration_yichun set_configuration_yichun
elif [ $server_type == "qiandaohu" ];then
set_configuration_qiandaohu
else else
format_print $ERROR "Error: Unsupport Server Type !!! - $server_type" format_print $ERROR "Error: Unsupport Server Type !!! - $server_type"
exit 1 exit 1
@ -1034,6 +1075,58 @@ detect_on_yichun(){
i2cdetect -y $i2c_bus i2cdetect -y $i2c_bus
} }
detect_on_qiandaohu(){
i2c_bus=3
format_print $INFO "PCIe slot 0 : bus3 9548channel 3"
i2ctransfer -y $i2c_bus w1@0x70 0x08
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 1 : bus3 9548channel 2"
i2ctransfer -y $i2c_bus w1@0x70 0x04
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 2 : bus3 9548channel 0"
i2ctransfer -y $i2c_bus w1@0x70 0x01
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 3 : bus3 9548channel 1"
i2ctransfer -y $i2c_bus w1@0x70 0x02
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 4 : bus3 9548channel 7"
i2ctransfer -y $i2c_bus w1@0x70 0x80
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 5 : bus3 9548channel 6"
i2ctransfer -y $i2c_bus w1@0x70 0x40
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 6 : bus3 9548channel 4"
i2ctransfer -y $i2c_bus w1@0x70 0x10
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 7 : bus3 9548channel 5"
i2ctransfer -y $i2c_bus w1@0x70 0x20
i2cdetect -y $i2c_bus
i2c_bus=6
format_print $INFO "PCIe slot 8 : bus6 9548channel 3"
i2ctransfer -y $i2c_bus w1@0x71 0x08
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 9 : bus6 9548channel 2"
i2ctransfer -y $i2c_bus w1@0x71 0x04
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 10 : bus6 9548channel 0"
i2ctransfer -y $i2c_bus w1@0x71 0x01
i2cdetect -y $i2c_bus
format_print $INFO "PCIe slot 11 : bus6 9548channel 3"
i2ctransfer -y $i2c_bus w1@0x71 0x02
i2cdetect -y $i2c_bus
}
# 搜索服务器所有PCIE插槽的I2C设备信息,当前仅支持特定Riser卡上的设备 # 搜索服务器所有PCIE插槽的I2C设备信息,当前仅支持特定Riser卡上的设备
# change list : 20240912-支持服务器器型号5280m7,5468m7 # change list : 20240912-支持服务器器型号5280m7,5468m7
start_detect_device(){ start_detect_device(){
@ -1054,6 +1147,8 @@ start_detect_device(){
detect_on_donghu detect_on_donghu
elif [ $server_type == "yichun" ];then elif [ $server_type == "yichun" ];then
detect_on_yichun detect_on_yichun
elif [ $server_type == "qiandaohu" ];then
detect_on_qiandaohu
else else
format_print $ERROR "Unsupport Server Type !!!" format_print $ERROR "Unsupport Server Type !!!"
fi fi