From e3a01c1ad3c065732ae186815cc0795bfd345f70 Mon Sep 17 00:00:00 2001 From: Missing Date: Tue, 15 Oct 2024 13:55:26 +0800 Subject: [PATCH] feat( script : nicsensor ) update to version 1.2 Intest --- 02.nicsensor/change_list.txt | 14 +- 02.nicsensor/nicsensor.sh | 288 +++++++++++++++++++++++++++-------- 02.nicsensor/readme.txt | 53 +++++-- 3 files changed, 277 insertions(+), 78 deletions(-) diff --git a/02.nicsensor/change_list.txt b/02.nicsensor/change_list.txt index 4368cf6..817bbf5 100644 --- a/02.nicsensor/change_list.txt +++ b/02.nicsensor/change_list.txt @@ -1,8 +1,16 @@ +# Script Version 1.2 + Release Note: + 1.[新增功能]支持写入板卡FRU + 2.[功能优化]修复一些交互类bug,增强脚本健壮性 + 3.[功能优化]更便捷的支持脚本传感器名称本地化 + # Script Version 1.1 20240912 Release Note: - 1.添加根据服务器类型适配 pcie slot 和 i2c对应关系的接口。当前可应用的服务器, 5280M7,5468M7. - 2.添加debug模式, 当启用debug模式时, 不会执行选通9641和9548的操作,仅执行读取传感器的操作 - 3.考虑到读取寄存器时可能也会操作fpga芯片, 为防止混淆, 修改命令cpld, 名称更改为 chip + 1.[新增功能]添加根据服务器类型适配 pcie slot 和 i2c对应关系的接口逻辑。当前可应用的服务器, 5280M7,5468M7. + 2.[新增功能]添加debug模式,通过修改变量启用debug模式: + 2.1 debug模式下, 不会执行选通9641和9548的操作,仅执行读取传感器的操作 + 2.2 debug模式下, 执行detect操作仅会针对当前配置的I2C bus进行一次detect + 3.[功能优化]考虑到读取寄存器时可能也会操作fpga芯片, 为防止混淆, 修改命令cpld, 名称更改为 chip # Script Version 1.0 20240614 Release Mote: diff --git a/02.nicsensor/nicsensor.sh b/02.nicsensor/nicsensor.sh index fe02143..414cd82 100644 --- a/02.nicsensor/nicsensor.sh +++ b/02.nicsensor/nicsensor.sh @@ -2,6 +2,8 @@ # script Version 1.1 20240912 # 支持测试的传感器芯片 emc1413 ina3221 adc128 +# 支持通过 chip 参数直接做I2C命令透传来访问芯片寄存器 +# 支持通过 fru 参数读取FRU十六进制内容 # --------------------------------------------------------- # Project Feature Varible (按照项目需要修改) @@ -17,17 +19,32 @@ votage_division_factor_5="0.6" votage_division_factor_6="0.2326" votage_division_factor_7="1" +# ADC128 channel名称定制(可更换为对应的 电压/电流/温度 的名称) +ADC128_Channel0_name="Channel 0" +ADC128_Channel1_name="Channel 1" +ADC128_Channel2_name="Channel 2" +ADC128_Channel3_name="Channel 3" +ADC128_Channel4_name="Channel 4" +ADC128_Channel5_name="Channel 5" +ADC128_Channel6_name="Channel 6" +ADC128_Channel7_name="Channel 7" + # INA3221 分流电阻, 单位(毫欧姆)(Ravel) shunt_resistor_0="2" shunt_resistor_1="2" shunt_resistor_2="5" +# EMC1413 channel名称定制(可更换为对应的 电压/电流/温度 的名称) +EMC1413_Channel0_name="Channel 0" +EMC1413_Channel1_name="Channel 1" +EMC1413_Channel2_name="Channel 2" + # fru 烧录的起始地址 fru_offset="0x00 0x00" # 应用的服务器产品,根据服务器产品手动修改这个变量 # 当前适配的服务器产品 5280m7 5468m7 -server_type="5468m7" +server_type="5280m7" # --------------------------------------------------------- # Common Varible (请勿随意修改) @@ -44,6 +61,10 @@ chip_slave=$3 # 被发到chip上,一个例子:"i2ctransfer -y 12 w2@0x10 0x90 0x00 r9" option_data=$4 +# Introduction of option_data2 +# 1.仅用于fru write操作,代表即将写入的fru文件名 +option_data2=$5 + # CHIP REGISTER REG_pca9641_controll="0x01" @@ -78,27 +99,36 @@ REG_ina3221_bus3="0x06" # --------------------------------------------------------- # DEBUG MODE=0 : Disable debug mode -# DEBUG MODE=1 : Enable debug mode +# =1 : Enable debug mode +# 启用debug模式后需要手动配置 i2c_bus DEBUG_MODE=0 -# 选通网卡I2C通路的关键变量 +# 选通网卡I2C通路的关键变量 pca9641_slave=0x41 i2c_bus=12 pca9548_channel=0x04 pca9548_slave=0x72 log="/tmp/nicsensor_debug.log" -fru_raw_file="/tmp/fru.bin" INA3221_SHUNT_VOLT=0 INA3221_BUS_VOLT=1 INA3221_POWER=2 +INFO="Info" +WARNING="Warning" +ERROR="Error" + ina3221_ch0_volt="0" ina3221_ch1_volt="0" ina3221_ch2_volt="0" ina3221_ch0_current="0" ina3221_ch1_current="0" ina3221_ch2_current="0" -SCRIPT_VRESION="1.1" +SCRIPT_VRESION="1.2 InTest" + +fru_file_name=$option_data2 +fru_write_size=0 +fru_write_data="" + # --------------------------------------------------------- # Script Function Defination # --------------------------------------------------------- @@ -107,21 +137,54 @@ SCRIPT_VRESION="1.1" print_usage(){ echo "" echo "================>>> nicsensor script usage <<<=================" - echo " format : ./nicsensor.sh [slot] [sensor tpye] [slave]" - echo " slot : 0 1 2 3 4 5 ..." - echo " sensor type : emc1413, adc128, ina3221" - echo " slave : chip slave address , please provide 7 bit address" - echo " E.G. : ./nicsensor.sh 0 adc128 0x1f" + echo " Command Format : ./nicsensor.sh [slot] [sensor tpye] [slave]" + echo " Option Detail" + echo " [slot] : 0 1 2 3 4 5 ..." + echo " [sensor type] : emc1413, adc128, ina3221" + echo " [slave] : chip slave address , please provide 7 bit address" + echo " E.G. : ./nicsensor.sh 0 adc128 0x1f" echo "" echo " If want to read/write chip register, use the below format" echo " ./nicsensor.sh [slot] chip [slave] [i2c_command]" echo " i2c_command : such as [i2ctransfer -y 13 w1@0x10 0x00 r2]" echo "" echo " If want to use debug mode, please modify the DEBUG_MODE to 1" - echo " now status : [Line 82] debug mode = $DEBUG_MODE" + echo " now status : DEBUG_MODE = $DEBUG_MODE" echo "" } +print_chip_command_format(){ + echo "Command Format : ./nicsensor.sh [slot] chip [slave] [i2c_command]" +} + +print_fru_command_format(){ + echo "Command Format : ./nicsensor.sh [slot] fru [slave] write [fru_file]" +} + +# 格式化输出信息 +# @Param1 信息等级 [Info/Warning/Error] +# @Param2 信息内容 +format_print(){ + echo ">>> [$1] $2" +} + +# 格式化输出信息到日志文件 +# @Param1 信息等级 [Info/Warning/Error] +# @Param2 信息内容 +format_log_print(){ + echo "[$1] $2" >> $log +} + +# 自查一些脚本中的属性配置 +conf_pre_check(){ + + # 校验debug mode的值 + if [ $DEBUG_MODE -ne 0 && $DEBUG_MODE -ne 1 ];then + format_print $ERROR "Invalid conf value, DEBUG_MODE: $DEBUG_MODE" + exit 1 + fi +} + # 根据5280m7 pcie slot 和 i2c 对对应关系调整变量 set_configuration_5280m7(){ # set pca9641 address && I2C BUS @@ -192,7 +255,7 @@ set_configuration_5468m7(){ # 20240912 - 更新脚本:支持通过服务器型号进行配置 set_configuration(){ - echo "Server Type : $server_type" >> $log + format_log_print $INFO "Server Type : $server_type" # 根据服务器型号执行对应的配置策略 if [ $server_type == "5280m7" ];then @@ -200,13 +263,13 @@ set_configuration(){ elif [ $server_type == "5468m7" ];then set_configuration_5468m7 else - echo " Unsupport Server Type !!! - $server_type" + format_print $ERROR "Error: Unsupport Server Type !!! - $server_type" exit 1 fi } # 初始化调试日志 -prepare_start_info(){ +init_debuglog(){ # 只保留一次日志读取记录 if [ -e $log ];then rm $log @@ -214,15 +277,23 @@ prepare_start_info(){ # print time header res_date=`date` - echo "=========================== $res_date" >> $log - echo "Script Version : $SCRIPT_VERSION" + format_log_print $INFO "=========================== $res_date" + format_log_print $INFO "Script Version : $SCRIPT_VERSION" + + if [ $DEBUG_MODE -ne 0 ];then + format_log_print $WARNING "Enable debug mode : $DEBUG_MODE" + fi +} + +# 记录配置信息日志 +prepare_start_info(){ # 记录单次配置信息到调试日志中去 - echo "PCIE slot : $pcie_slot" >> $log - echo "I2C Bus: $i2c_bus" >> $log - echo "PCA9641 slave: $pca9641_slave" >> $log - echo "PCA9548 slave: $pca9548_slave" >> $log - echo "PCA9548 channel: $pca9548_channel" >> $log + format_log_print $INFO "PCIE slot : $pcie_slot" + format_log_print $INFO "I2C Bus: $i2c_bus" + format_log_print $INFO "PCA9641 slave: $pca9641_slave" + format_log_print $INFO "PCA9548 slave: $pca9548_slave" + format_log_print $INFO "PCA9548 channel: $pca9548_channel" # Record i2c device info to log res_info=`i2cdetect -y $i2c_bus` @@ -234,18 +305,18 @@ get_pca9641_controll(){ # Request 9641 lock res_lock=`i2ctransfer -y $i2c_bus w2@$pca9641_slave $REG_pca9641_controll 0x81 r1` - echo "After request 9641 lock, The REG value is $res_lock" >> $log + format_log_print $INFO "After request 9641 lock, The REG value is $res_lock" # Build 9641 Connection res_build=`i2ctransfer -y $i2c_bus w2@$pca9641_slave $REG_pca9641_controll 0x85 r1` - echo "After Build 9641 connection, The REG value is $res_build" >> $log + format_log_print $INFO "After Build 9641 connection, The REG value is $res_build" # After get 9641 controll, Record i2c device info to log res_after=`i2cdetect -y $i2c_bus` echo $res_after >> $log if [ "$res_build" != "0x87" ];then - echo "Cannot establish connection with pca9641 !!!" + format_print $ERROR "Cannot establish connection with pca9641 !!!" exit 1 fi } @@ -255,7 +326,7 @@ switch_pca9548_channel(){ # set 9548 channel res_setchannel=`i2ctransfer -y $i2c_bus w1@$pca9548_slave $pca9548_channel` - echo "After switch channel" >> $log + format_log_print $INFO "After switch channel" # After set 9548 channel , record i2c device info res_after=`i2cdetect -y $i2c_bus` @@ -269,15 +340,31 @@ switch_pca9548_channel(){ # 处理EMC1413读到的数据并输出结果 # @Param1 emc1413读取数据高位 # @Param2 emc1413读取数据低位 -# @Param3 channel号 +# @Param3 channel号/定制化名称 convert_emc1413_data(){ # 将读取到的两位数据去掉 0x 前缀 hex_value1=$(echo "$1" | awk '{sub(/^0x/,""); print}') hex_value2=$(echo "$2" | awk '{sub(/^0x/,""); print}') # 由于 bc 计算器只能识别大写的 十六进制数据,将小写的十六进制数据全部转化为大写的数据 - upper_hex_value1=$(echo "$hex_value1" | awk '{ for(i=1; i<=length($0); i++){ if(tolower(substr($0,i,1)) ~ /^[a-f]$/) printf toupper(substr($0,i,1)); else printf substr($0,i,1); } print "" }') - upper_hex_value2=$(echo "$hex_value2" | awk '{ for(i=1; i<=length($0); i++){ if(tolower(substr($0,i,1)) ~ /^[a-f]$/) printf toupper(substr($0,i,1)); else printf substr($0,i,1); } print "" }') + upper_hex_value1=$(echo "$hex_value1" | awk '{ + for(i=1; i<=length($0); i++){ + if(tolower(substr($0,i,1)) ~ /^[a-f]$/) + printf toupper(substr($0,i,1)); + else + printf substr($0,i,1); + } + print "" + }') + upper_hex_value2=$(echo "$hex_value2" | awk '{ + for(i=1; i<=length($0); i++){ + if(tolower(substr($0,i,1)) ~ /^[a-f]$/) + printf toupper(substr($0,i,1)); + else + printf substr($0,i,1); + } + print "" + }') # 转化为10进制数据 dec_value1=$(echo "ibase=16; $upper_hex_value1" | bc) @@ -289,7 +376,7 @@ convert_emc1413_data(){ # 格式化输出数据 format_temp=$(echo "$temp" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') - echo "channel $3 : $format_temp C, hex value : $hex_value1 $hex_value2" + echo "$3 : $format_temp C, hex value : $hex_value1 $hex_value2" } @@ -312,9 +399,9 @@ read_emc1413_channel_value(){ # start parse raw data echo ">>> The emc1413 value is:" - convert_emc1413_data $res_td1_h $res_td1_l 1 - convert_emc1413_data $res_td2_h $res_td2_l 2 - convert_emc1413_data $res_td3_h $res_td3_l 3 + convert_emc1413_data $res_td1_h $res_td1_l $EMC1413_Channel0_name + convert_emc1413_data $res_td2_h $res_td2_l $EMC1413_Channel1_name + convert_emc1413_data $res_td3_h $res_td3_l $EMC1413_Channel2_name } @@ -350,7 +437,7 @@ check_adc128_init(){ # 处理ADC128读到的数据并输出结果 # @Param 1 ADC128读取数据高位 # @Param 2 ADC128读取数据低位 -# @Param 3 channel号 +# @Param 3 channel号/定制化名称 # @Param 4 分压系数 convert_adc128_data(){ # 将读取到的两位数据拼接起来 @@ -359,14 +446,22 @@ convert_adc128_data(){ merge_value="${hex_value1}${hex_value2}" # 由于 bc 计算器只能识别大写的 十六进制数据,这里将小写的十六进制数据全部转化为大写的数据 - upper_hex_value=$(echo "$merge_value" | awk '{ for(i=1; i<=length($0); i++){ if(tolower(substr($0,i,1)) ~ /^[a-f]$/) printf toupper(substr($0,i,1)); else printf substr($0,i,1); } print "" }') + upper_hex_value=$(echo "$merge_value" | awk '{ + for(i=1; i<=length($0); i++){ + if(tolower(substr($0,i,1)) ~ /^[a-f]$/) + printf toupper(substr($0,i,1)); + else + printf substr($0,i,1); + } + print "" + }') # 利用bc计算器进行运算,并将返回值格式化后输出 dec_val=$(echo "ibase=16; $upper_hex_value" | bc) volt=$(echo "scale=4; $dec_val / 16 / 4096 * 2.65 / $4" | bc) format_volt=$(echo "$volt" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }') - echo "Channel $3 : $format_volt v, hex value: $upper_hex_value" + echo "$3 : $format_volt v, hex value: $upper_hex_value" } # 读取ADC128芯片每个通道的数据,随后调用数据处理函数进行数据解析并输出 @@ -394,14 +489,14 @@ read_adc128_channel_value(){ # start parse raw data echo ">>> The ADC128 value is :" - convert_adc128_data $res_ch0 0 $votage_division_factor_0 - convert_adc128_data $res_ch1 1 $votage_division_factor_1 - convert_adc128_data $res_ch2 2 $votage_division_factor_2 - convert_adc128_data $res_ch3 3 $votage_division_factor_3 - convert_adc128_data $res_ch4 4 $votage_division_factor_4 - convert_adc128_data $res_ch5 5 $votage_division_factor_5 - convert_adc128_data $res_ch6 6 $votage_division_factor_6 - convert_adc128_data $res_ch7 7 $votage_division_factor_7 + convert_adc128_data $res_ch0 $ADC128_Channel0_name $votage_division_factor_0 + convert_adc128_data $res_ch1 $ADC128_Channel1_name $votage_division_factor_1 + convert_adc128_data $res_ch2 $ADC128_Channel2_name $votage_division_factor_2 + convert_adc128_data $res_ch3 $ADC128_Channel3_name $votage_division_factor_3 + convert_adc128_data $res_ch4 $ADC128_Channel4_name $votage_division_factor_4 + convert_adc128_data $res_ch5 $ADC128_Channel5_name $votage_division_factor_5 + convert_adc128_data $res_ch6 $ADC128_Channel6_name $votage_division_factor_6 + convert_adc128_data $res_ch7 $ADC128_Channel7_name $votage_division_factor_7 } # ADC128处理逻辑 @@ -430,7 +525,15 @@ convert_ina3221_data(){ merge_value="${hex_value1}${hex_value2}" # 由于 bc 计算器只能识别大写的 十六进制数据,这里将小写的十六进制数据全部转化为大写的数据 - upper_hex_value=$(echo "$merge_value" | awk '{ for(i=1; i<=length($0); i++){ if(tolower(substr($0,i,1)) ~ /^[a-f]$/) printf toupper(substr($0,i,1)); else printf substr($0,i,1); } print "" }') + upper_hex_value=$(echo "$merge_value" | awk '{ + for(i=1; i<=length($0); i++){ + if(tolower(substr($0,i,1)) ~ /^[a-f]$/) + printf toupper(substr($0,i,1)); + else + printf substr($0,i,1); + } + print "" + }') # 将16进制数据转化为10进制 dec_val=$(echo "ibase=16; $upper_hex_value" | bc) @@ -557,7 +660,7 @@ write_read_chip(){ echo ">>> The Result : $res_wr" } -# cpld处理逻辑 +# chip处理逻辑 process_chip(){ # cpld no need to init first @@ -570,7 +673,40 @@ process_chip(){ # --------------------------------------------------------- # FRU # --------------------------------------------------------- -# 临时支持FRU读取 +# 将传入的fru文件解析为可被i2cransfer直接写入的数据 +parse_fru_write_data(){ + # 判断fru文件是否存在于当前目录 + if [ -e $fru_file_name ];then + echo "Fru file exist!" >> $log + else + echo "Fru file not exist!" >> $log + echo "Fru file not exist in current directory!" + echo "Error: Operation Failed!" + exit 1 + fi + + # 计算需要写入的fru文件大小 + fru_write_size=`ls -lht | grep $fru_file_name | awk '{print $5}'` + echo "Fru File [$fru_file_name] size = $fru_write_size Bytes" + echo "Fru File [$fru_file_name] size = $fru_write_size Bytes" >> $log + + # 获取fru文件的 raw data + fru_raw_data=`hexdump -C $fru_file_name | awk '{ + for(i=2;i<18;i++){ + print $i + } + }'` + echo "Fru Raw Data: $fru_raw_data" >> $log + + # 将raw data解析为可被 i2ctransfer 写入的数据 + fru_write_data=`echo $fru_raw_data | awk -v size=$fru_write_size '{ + for(i=1;i<=size;i++){ + printf "0x%s ",$i + } + }'` +} + +# 支持FRU读取 read_fru(){ res_fru=`i2ctransfer -y $i2c_bus w2@$chip_slave $fru_offset r256` @@ -605,18 +741,15 @@ read_fru(){ } -# 暂时不支持FRU写入,预留接口 +# 20240926 支持写板卡FRU write_fru(){ - current_byte=0 + + i2c_write_byte=$(($fru_write_size+2)) + # 组装command并发送 + write_command="i2ctransfer -y $i2c_bus w$i2c_write_byte@$chip_slave $fru_offset $fru_write_data" + write_res=`$write_command` + echo "Exec Command: $write_command" >> $log - echo "Not support write fru now ..." - exit 0 - - while IFS= read -r -n 1 byte || [[ -n "$byte" ]];do - i2cset -y $i2c_bus $chip_slave $current_byte $byte w - - current_byte=$(($current_byte+1)) - done < "$fru_raw_file" } # fru 处理逻辑 @@ -644,7 +777,7 @@ start_get_sensor(){ # set global varible by server type set_configuration - # print start info in log + # 记录开始执行脚本前的I2C配置信息 prepare_start_info # 从9641获取I2C控制权 @@ -666,7 +799,7 @@ start_get_sensor(){ elif [ "$sensor_type" == "fru" ];then process_fru else - echo "Error Sensor Type !!!" + echo "Error: Unsupport Sensor Type !!!" print_usage fi } @@ -769,9 +902,10 @@ detect_on_5468m7(){ # change list : 20240912-支持服务器器型号5280m7,5468m7 start_detect_device(){ - # debug mode下不支持进行detect操作 + # debug mode下进行detect操作仅对当前链路进行detect if [ $DEBUG_MODE -ne 0 ];then - echo "Can't do this action in debug mode" + echo "In debug mode now, only detect i2c_bus$i2c_bus:" + i2cdetect -y $i2c_bus exit 0 fi @@ -780,7 +914,7 @@ start_detect_device(){ elif [ $server_type == "5468m7" ];then detect_on_5468m7 else - echo "Unsupport Server Type !!!" + echo "Error: Unsupport Server Type !!!" fi } @@ -788,11 +922,43 @@ start_detect_device(){ # Start Execute Script # --------------------------------------------------------- +# 配置校验 +conf_pre_check + +# 参数合法校验 +if [ "$sensor_type" == "chip" ];then + if [ $# -le 3 ];then + format_print $ERROR "Command Format illegal" + print_chip_command_format + exit 1 + fi +fi + if [ "$1" == "detect" ];then start_detect_device exit 0 fi +# 在正式执行脚本之前初始化调试日志 +init_debuglog + +# 如果是fru write操作, 需要对即将写入的bin文件进行数据预处理 +if [ "$sensor_type" == "fru" ];then + if [ "$option_data" == "write" ];then + format_log_print $INFO "Opreation FRU Write" + + # 在fru write操作下要求必须有 option_data2, 做参数检查 + if [ "$option_data2" == "" ];then + format_print $ERROR "Please provide fru file name" + print_fru_command_format + exit 1 + fi + + # 解析fru bin文件 + parse_fru_write_data + fi +fi + if [ $# -le 2 ];then print_usage else diff --git a/02.nicsensor/readme.txt b/02.nicsensor/readme.txt index a123464..ad60749 100644 --- a/02.nicsensor/readme.txt +++ b/02.nicsensor/readme.txt @@ -1,14 +1,37 @@ ### 重要说明 : 脚本仅用于M7服务器,带有i2c standard tool工具的BMC使用 ### 仅限用于实验室调试使用 + + ### 大纲 + 一、脚本使用方法 + 1.1 修改项目专属配置(必做) + 1.2 增加脚本可执行权限 + 1.3 脚本命令格式 + 1.4 特殊命令 + 1.4.1 Detect命令 + 1.4.2 fru命令 + 1.4.3 读取芯片寄存器 + 1.5 debug模式 + 二、服务器PCIE槽位和PCA9548的channel关系 + 三、M7 sysadmin用户 SSH打开方法 + 四、常见问题 + + ### 正文 - 一、脚本使用方法 V1.1 + 一、脚本使用方法 Version1.2 - 1、针对不同项目,请先修改脚本中的部分变量(ADC128电压传感器的分压系数,INA3221的分流精密电阻阻值) - 针对不同服务器产品,请对应修改server_type变量 + 1.1、修改项目专属配置 + 针对不同项目,请先修改脚本中的部分变量(ADC128电压传感器的分压系数,INA3221的分流精密电阻阻值) + 针对不同服务器产品,请对应修改server_type变量, 当前支持设置的服务器型号: + 5280m7 + 5468m7 - 2、为脚本增加可执行权限 chmod +x ./nicsensor.sh + 1.2、增加脚本可执行权限 + + 在脚本目录下执行命令: chmod +x ./nicsensor.sh - 3、脚本命令格式 ./nicsensor.sh + 1.3、脚本命令格式 + + ./nicsensor.sh 参数说明: pcie_slot : 网卡所在的PCIE槽位, 填数字0,1,2,3,4,5 @@ -18,32 +41,34 @@ 举例说明:读取PCIE 1 上网卡的adc128芯片, 芯片slave地址为0x1f ./nicsensor.sh 1 adc128 0x1f - 4、特殊命令 + 1.4、特殊命令 - 4.1 扫描服务器的PCIE slot 0 - 5上所有的I2C设备 + 1.4.1 Detect命令 + + 扫描服务器的PCIE slot 0 - 5上所有的I2C设备 命令: ./nicsensor.sh detect - 4.2 读取fru信息 + 1.4.2 fru命令 命令: ./nicsensor.sh fru read 举例说明:读取Ravel板卡的EEPROM中的FRU(0x57) - ./nicsensor.sh 5 fru 0x57 read - 4.3 读取芯片寄存器 + 1.4.3 读取芯片寄存器 命令: ./nicsensor.sh chip 举例说明: 读取cpld的寄存器 0x00 ,读2个byte - ./nicsensor.sh 5 chip 0x10 "i2ctransfer -y 13 w1@0x10 0x00 r2" - 5、DEBUG模式 + 1.5、DEBUG模式 - 可通过配置脚本中的 DEBUG_MODE 变量来使用debug模式,在debug模式下,不会执行选通9641,9548的操作, - 仅执行读取传感器的操作,因此需要手动配置的变量有: + 可通过配置脚本中的 DEBUG_MODE 变量(In Srcipt Line:84)来使用debug模式,在debug模式下,不会执行选通 + 9641,9548的操作,仅执行读取传感器的操作,因此启用debug模式后需要手动配置的变量有: i2c_bus - 二、服务器 PCIE槽位和PCA9548的channel关系 + 二、服务器PCIE槽位和PCA9548的channel关系 5280M7的PCIE槽位和PCA9548/9546没有确定的对应关系,取决于使用的riser卡.根据一般情况选择的Riser卡, 对应 情况如下: @@ -104,7 +129,7 @@ 1、脚本执行时出现大量的 Error 由于M7服务器的I2C设计有PCA9641作为I2C仲裁器, 脚本执行过程中可能会被9641强行断开I2C连接, 造成大量的 - 脚本Error, 这种时候重新执行脚本即可 + 脚本Error, 这种情况在实际运行中是不可避免的, 直接重新执行脚本即可 2、不建议使用该脚本进行压力测试