feat(script : nicsensor.sh)添加对OCP卡槽的支持
This commit is contained in:
parent
fcaa50bd0b
commit
b4169ce1f5
@ -1,3 +1,7 @@
|
|||||||
|
# Script Version 1.3
|
||||||
|
Release Note
|
||||||
|
1.[新增功能]支持5280m7的OCP卡的使用
|
||||||
|
|
||||||
# Script Version 1.2 20241102
|
# Script Version 1.2 20241102
|
||||||
Release Note:
|
Release Note:
|
||||||
1.[新增功能]支持写入板卡FRU
|
1.[新增功能]支持写入板卡FRU
|
||||||
|
|||||||
@ -50,7 +50,7 @@ server_type="5280m7"
|
|||||||
# Common Varible (Don't Change)
|
# Common Varible (Don't Change)
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Input Param
|
# Input Param
|
||||||
pcie_slot=$1
|
nic_slot=$1
|
||||||
sensor_type=$2
|
sensor_type=$2
|
||||||
|
|
||||||
# Introduction of chip_slave
|
# Introduction of chip_slave
|
||||||
@ -117,11 +117,13 @@ 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 Standard"
|
SCRIPT_VERSION="1.3 Intest Rev1"
|
||||||
|
|
||||||
fru_file_name=$option_data2
|
fru_file_name=$option_data2
|
||||||
fru_write_size=0
|
fru_write_size=0
|
||||||
fru_write_data=""
|
fru_write_data=""
|
||||||
|
nic_type=""
|
||||||
|
slot_number=""
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# Script Function Defination
|
# Script Function Defination
|
||||||
@ -198,30 +200,46 @@ conf_pre_check(){
|
|||||||
# 根据5280m7 pcie slot 和 i2c 对对应关系调整变量
|
# 根据5280m7 pcie slot 和 i2c 对对应关系调整变量
|
||||||
set_configuration_5280m7(){
|
set_configuration_5280m7(){
|
||||||
|
|
||||||
is_have_pca9641=1
|
|
||||||
|
|
||||||
# set pca9641 address && I2C BUS
|
# set pca9641 address && I2C BUS
|
||||||
if [ $pcie_slot -le 2 ];then
|
if [ $nic_type == "ocp" ];then
|
||||||
pca9641_slave="0x41"
|
is_have_pca9641=0
|
||||||
i2c_bus=12
|
pca9548_slave="0x70"
|
||||||
else
|
else
|
||||||
pca9641_slave="0x42"
|
is_have_pca9641=1
|
||||||
i2c_bus=13
|
if [ $slot_number -le 2 ];then
|
||||||
|
pca9641_slave="0x41"
|
||||||
|
pca9548_slave=0x72
|
||||||
|
i2c_bus=12
|
||||||
|
else
|
||||||
|
pca9641_slave="0x42"
|
||||||
|
pca9548_slave=0x72
|
||||||
|
i2c_bus=13
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set pca9548 switch channel
|
# set pca9548 switch channel
|
||||||
if [ $pcie_slot -eq 0 ];then
|
if [ $nic_type == "ocp" ];then
|
||||||
pca9548_channel="0x02"
|
if [ $slot_number -eq 0 ];then
|
||||||
elif [ $pcie_slot -eq 1 ];then
|
pca9548_channel="0x01"
|
||||||
pca9548_channel="0x04"
|
elif [ $slot_number -eq 1 ];then
|
||||||
elif [ $pcie_slot -eq 2 ];then
|
pca9548_channel="0x02"
|
||||||
pca9548_channel="0x08"
|
elif [ $slot_number -eq 2 ];then
|
||||||
elif [ $pcie_slot -eq 3 ];then
|
pca9548_channel="0x04"
|
||||||
pca9548_channel="0x02"
|
fi
|
||||||
elif [ $pcie_slot -eq 4 ];then
|
else
|
||||||
pca9548_channel="0x04"
|
if [ $slot_number -eq 0 ];then
|
||||||
elif [ $pcie_slot -eq 5 ];then
|
pca9548_channel="0x02"
|
||||||
pca9548_channel="0x08"
|
elif [ $slot_number -eq 1 ];then
|
||||||
|
pca9548_channel="0x04"
|
||||||
|
elif [ $slot_number -eq 2 ];then
|
||||||
|
pca9548_channel="0x08"
|
||||||
|
elif [ $slot_number -eq 3 ];then
|
||||||
|
pca9548_channel="0x02"
|
||||||
|
elif [ $slot_number -eq 4 ];then
|
||||||
|
pca9548_channel="0x04"
|
||||||
|
elif [ $slot_number -eq 5 ];then
|
||||||
|
pca9548_channel="0x08"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +249,7 @@ set_configuration_5468m7(){
|
|||||||
is_have_pca9641=1
|
is_have_pca9641=1
|
||||||
|
|
||||||
# set pca9641 address && I2C BUS
|
# set pca9641 address && I2C BUS
|
||||||
if [ $pcie_slot -le 4 ];then
|
if [ $slot_number -le 4 ];then
|
||||||
pca9641_slave="0x31"
|
pca9641_slave="0x31"
|
||||||
pca9548_slave="0x70"
|
pca9548_slave="0x70"
|
||||||
i2c_bus=13
|
i2c_bus=13
|
||||||
@ -242,27 +260,27 @@ set_configuration_5468m7(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# set pca9548 switch channel
|
# set pca9548 switch channel
|
||||||
if [ $pcie_slot -eq 0 ];then
|
if [ $slot_number -eq 0 ];then
|
||||||
pca9548_channel="0x01"
|
pca9548_channel="0x01"
|
||||||
elif [ $pcie_slot -eq 1 ];then
|
elif [ $slot_number -eq 1 ];then
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
elif [ $pcie_slot -eq 2 ];then
|
elif [ $slot_number -eq 2 ];then
|
||||||
pca9548_channel="0x04"
|
pca9548_channel="0x04"
|
||||||
elif [ $pcie_slot -eq 3 ];then
|
elif [ $slot_number -eq 3 ];then
|
||||||
pca9548_channel="0x08"
|
pca9548_channel="0x08"
|
||||||
elif [ $pcie_slot -eq 4 ];then
|
elif [ $slot_number -eq 4 ];then
|
||||||
pca9548_channel="0x10"
|
pca9548_channel="0x10"
|
||||||
elif [ $pcie_slot -eq 5 ];then
|
elif [ $slot_number -eq 5 ];then
|
||||||
pca9548_channel="0x01"
|
pca9548_channel="0x01"
|
||||||
elif [ $pcie_slot -eq 6 ];then
|
elif [ $slot_number -eq 6 ];then
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
elif [ $pcie_slot -eq 7 ];then
|
elif [ $slot_number -eq 7 ];then
|
||||||
pca9548_channel="0x04"
|
pca9548_channel="0x04"
|
||||||
elif [ $pcie_slot -eq 8 ];then
|
elif [ $slot_number -eq 8 ];then
|
||||||
pca9548_channel="0x08"
|
pca9548_channel="0x08"
|
||||||
elif [ $pcie_slot -eq 9 ];then
|
elif [ $slot_number -eq 9 ];then
|
||||||
pca9548_channel="0x10"
|
pca9548_channel="0x10"
|
||||||
elif [ $pcie_slot -eq 10 ];then
|
elif [ $slot_number -eq 10 ];then
|
||||||
pca9548_channel="0x20"
|
pca9548_channel="0x20"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -274,21 +292,21 @@ set_configuration_donghu(){
|
|||||||
i2c_bus=3
|
i2c_bus=3
|
||||||
pca9548_slave="0x70"
|
pca9548_slave="0x70"
|
||||||
# set pca9548 switch channel
|
# set pca9548 switch channel
|
||||||
if [ $pcie_slot -eq 0 ];then
|
if [ $slot_number -eq 0 ];then
|
||||||
pca9548_channel="0x80"
|
pca9548_channel="0x80"
|
||||||
elif [ $pcie_slot -eq 1 ];then
|
elif [ $slot_number -eq 1 ];then
|
||||||
pca9548_channel="0x40"
|
pca9548_channel="0x40"
|
||||||
elif [ $pcie_slot -eq 2 ];then
|
elif [ $slot_number -eq 2 ];then
|
||||||
pca9548_channel="0x20"
|
pca9548_channel="0x20"
|
||||||
elif [ $pcie_slot -eq 3 ];then
|
elif [ $slot_number -eq 3 ];then
|
||||||
pca9548_channel="0x10"
|
pca9548_channel="0x10"
|
||||||
elif [ $pcie_slot -eq 4 ];then
|
elif [ $slot_number -eq 4 ];then
|
||||||
pca9548_channel="0x08"
|
pca9548_channel="0x08"
|
||||||
elif [ $pcie_slot -eq 5 ];then
|
elif [ $slot_number -eq 5 ];then
|
||||||
pca9548_channel="0x04"
|
pca9548_channel="0x04"
|
||||||
elif [ $pcie_slot -eq 6 ];then
|
elif [ $slot_number -eq 6 ];then
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
elif [ $pcie_slot -eq 7 ];then
|
elif [ $slot_number -eq 7 ];then
|
||||||
pca9548_channel="0x01"
|
pca9548_channel="0x01"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -300,13 +318,13 @@ set_configuration_yichun(){
|
|||||||
pca9548_slave="0x74"
|
pca9548_slave="0x74"
|
||||||
|
|
||||||
# set pca9548 switch channel
|
# set pca9548 switch channel
|
||||||
if [ $pcie_slot -eq 0 ];then
|
if [ $slot_number -eq 0 ];then
|
||||||
i2c_bus=12
|
i2c_bus=12
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
elif [ $pcie_slot -eq 1 ];then
|
elif [ $slot_number -eq 1 ];then
|
||||||
i2c_bus=13
|
i2c_bus=13
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
elif [ $pcie_slot -eq 2 ];then
|
elif [ $slot_number -eq 2 ];then
|
||||||
i2c_bus=14
|
i2c_bus=14
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
fi
|
fi
|
||||||
@ -316,7 +334,7 @@ set_configuration_yichun(){
|
|||||||
set_configuration_qiandaohu(){
|
set_configuration_qiandaohu(){
|
||||||
is_have_pca9641=0
|
is_have_pca9641=0
|
||||||
|
|
||||||
if [ $pcie_slot -le 7 ];then
|
if [ $slot_number -le 7 ];then
|
||||||
i2c_bus=3
|
i2c_bus=3
|
||||||
pca9548_slave=0x70
|
pca9548_slave=0x70
|
||||||
else
|
else
|
||||||
@ -325,41 +343,73 @@ set_configuration_qiandaohu(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# set pca9548 switch channel
|
# set pca9548 switch channel
|
||||||
if [ $pcie_slot -eq 0 ];then
|
if [ $slot_number -eq 0 ];then
|
||||||
pca9548_channel="0x08"
|
pca9548_channel="0x08"
|
||||||
elif [ $pcie_slot -eq 1 ];then
|
elif [ $slot_number -eq 1 ];then
|
||||||
pca9548_channel="0x04"
|
pca9548_channel="0x04"
|
||||||
elif [ $pcie_slot -eq 2 ];then
|
elif [ $slot_number -eq 2 ];then
|
||||||
pca9548_channel="0x01"
|
pca9548_channel="0x01"
|
||||||
elif [ $pcie_slot -eq 3 ];then
|
elif [ $slot_number -eq 3 ];then
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
elif [ $pcie_slot -eq 4 ];then
|
elif [ $slot_number -eq 4 ];then
|
||||||
pca9548_channel="0x80"
|
pca9548_channel="0x80"
|
||||||
elif [ $pcie_slot -eq 5 ];then
|
elif [ $slot_number -eq 5 ];then
|
||||||
pca9548_channel="0x40"
|
pca9548_channel="0x40"
|
||||||
elif [ $pcie_slot -eq 6 ];then
|
elif [ $slot_number -eq 6 ];then
|
||||||
pca9548_channel="0x10"
|
pca9548_channel="0x10"
|
||||||
elif [ $pcie_slot -eq 7 ];then
|
elif [ $slot_number -eq 7 ];then
|
||||||
pca9548_channel="0x20"
|
pca9548_channel="0x20"
|
||||||
elif [ $pcie_slot -eq 8 ];then
|
elif [ $slot_number -eq 8 ];then
|
||||||
pca9548_channel="0x08"
|
pca9548_channel="0x08"
|
||||||
elif [ $pcie_slot -eq 9 ];then
|
elif [ $slot_number -eq 9 ];then
|
||||||
pca9548_channel="0x04"
|
pca9548_channel="0x04"
|
||||||
elif [ $pcie_slot -eq 10 ];then
|
elif [ $slot_number -eq 10 ];then
|
||||||
pca9548_channel="0x01"
|
pca9548_channel="0x01"
|
||||||
elif [ $pcie_slot -eq 11 ];then
|
elif [ $slot_number -eq 11 ];then
|
||||||
pca9548_channel="0x02"
|
pca9548_channel="0x02"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get nic type and slot number
|
||||||
|
parse_nic_slot(){
|
||||||
|
fullname=0
|
||||||
|
case $nic_slot in
|
||||||
|
ocp*)
|
||||||
|
nic_type="ocp"
|
||||||
|
;;
|
||||||
|
pcie*)
|
||||||
|
nic_type="pcie"
|
||||||
|
fullname=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
nic_type="pcie"
|
||||||
|
fullname=0;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ $nic_type == "ocp" ];then
|
||||||
|
slot_number=$(echo $nic_slot | cut -c 4)
|
||||||
|
else
|
||||||
|
if [ $fullname -eq 1 ];then
|
||||||
|
slot_number=$(echo $nic_slot | cut -c 5)
|
||||||
|
else
|
||||||
|
slot_number=$nic_slot
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
format_log_print $INFO "Nic Type : $nic_type"
|
||||||
|
format_log_print $INFO "Slot Num : $slot_number"
|
||||||
|
}
|
||||||
|
|
||||||
# 根据输入信息调整选通芯片的配置(PCA9641 PCA9548)
|
# 根据输入信息调整选通芯片的配置(PCA9641 PCA9548)
|
||||||
set_configuration(){
|
set_configuration(){
|
||||||
|
|
||||||
format_log_print $INFO "Server Type : $server_type"
|
format_log_print $INFO "Server Type : $server_type"
|
||||||
|
parse_nic_slot
|
||||||
|
|
||||||
# 根据服务器型号执行对应的配置策略
|
# 根据服务器型号执行对应的配置策略
|
||||||
case $server_type in
|
case $server_type in
|
||||||
"5280m7")
|
"5280m7")
|
||||||
|
# Support PCIe and OCP configuration
|
||||||
set_configuration_5280m7
|
set_configuration_5280m7
|
||||||
;;
|
;;
|
||||||
"5468m7")
|
"5468m7")
|
||||||
@ -402,7 +452,7 @@ init_debuglog(){
|
|||||||
prepare_start_info(){
|
prepare_start_info(){
|
||||||
|
|
||||||
# 记录单次配置信息到调试日志中去
|
# 记录单次配置信息到调试日志中去
|
||||||
format_log_print $INFO "PCIE slot : $pcie_slot"
|
format_log_print $INFO "PCIE slot : $nic_slot"
|
||||||
format_log_print $INFO "I2C Bus: $i2c_bus"
|
format_log_print $INFO "I2C Bus: $i2c_bus"
|
||||||
if [ $is_have_pca9641 -eq 1];then
|
if [ $is_have_pca9641 -eq 1];then
|
||||||
format_log_print $INFO "PCA9641 slave: $pca9641_slave"
|
format_log_print $INFO "PCA9641 slave: $pca9641_slave"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user