From 89aae7feb0e9e9851ce1163e0e6b0ff4f87dcd1d Mon Sep 17 00:00:00 2001 From: marcinlei Date: Thu, 28 Nov 2024 12:58:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(script=20:=20nicsensor.sh)=20update=20to?= =?UTF-8?q?=20version=201.2Intest=20Rev6=201.=E9=80=82=E9=85=8D=E5=8D=83?= =?UTF-8?q?=E5=B2=9B=E6=B9=96=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02.nicsensor/nicsensor.sh | 101 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/02.nicsensor/nicsensor.sh b/02.nicsensor/nicsensor.sh index 0d76a16..ff13105 100644 --- a/02.nicsensor/nicsensor.sh +++ b/02.nicsensor/nicsensor.sh @@ -47,7 +47,7 @@ EMC1413_Channel2_name="Channel 2" fru_offset="0x00 0x00" # 应用的服务器产品,根据服务器产品手动修改这个变量 -# 当前适配的服务器产品 5280m7 5468m7 donghu yichun +# 当前适配的服务器产品 5280m7 5468m7 donghu yichun qiandaohu server_type="5280m7" # --------------------------------------------------------- @@ -138,7 +138,7 @@ ina3221_ch2_volt="0" ina3221_ch0_current="0" ina3221_ch1_current="0" ina3221_ch2_current="0" -SCRIPT_VERSION="1.2 InTest Rev5" +SCRIPT_VERSION="1.2 InTest Rev6" fru_file_name=$option_data2 fru_write_size=0 @@ -161,7 +161,7 @@ print_usage(){ echo "" echo " To Auto detect i2c slave on server, please use:" 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 " If want to read/write chip register, use the below format" echo " ./nicsensor.sh [slot] chip [slave] [i2c_command]" @@ -321,6 +321,45 @@ set_configuration_yichun(){ 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) # 20240912 - 更新脚本:支持通过服务器型号进行配置 set_configuration(){ @@ -336,6 +375,8 @@ set_configuration(){ set_configuration_donghu elif [ $server_type == "yichun" ];then set_configuration_yichun + elif [ $server_type == "qiandaohu" ];then + set_configuration_qiandaohu else format_print $ERROR "Error: Unsupport Server Type !!! - $server_type" exit 1 @@ -1034,6 +1075,58 @@ detect_on_yichun(){ 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卡上的设备 # change list : 20240912-支持服务器器型号5280m7,5468m7 start_detect_device(){ @@ -1054,6 +1147,8 @@ start_detect_device(){ detect_on_donghu elif [ $server_type == "yichun" ];then detect_on_yichun + elif [ $server_type == "qiandaohu" ];then + detect_on_qiandaohu else format_print $ERROR "Unsupport Server Type !!!" fi