diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..8f637e5 --- /dev/null +++ b/readme.md @@ -0,0 +1,118 @@ +# nicsensor工具使用说明 + +> 本说明仅针对 nicsensorv1.x系列脚本 + +## 目录 + +- [1_简介](#1_简介) +- [2_使用方法](#2_使用方法) + - [2_1_传感器读取](#2_1_传感器读取) + - [2_2_fru相关操作](#2_2_fru相关操作) + - [2_3_命令透传](#2_3_命令透传) + - [2_4_插槽i2c信息遍历](#2_4_插槽i2c信息遍历) + - [2_5_调试模式使用](#2_5_调试模式使用) +- [3_常见问题](#3_常见问题) + +## 1_简介 + +nicsensor工具是在带有i2ctool工具(i2ctransfer、i2cdetect)的BMC下用于测试网卡I2C功能的工具。 + +**当前支持的功能有:** +- 读取网卡上的I2C传感器 +- 读取并修改网卡上的FRU +- 透传I2C命令到网卡的芯片上 +- 遍历服务器上的PCIE插槽的I2C信息 +- 部分服务器类型支持读取OCP卡 + +**当前支持测试的传感器类型** +- adc128 +- ina3221 +- emc1413 +- tmp468 +- tmp112 + +> [!tip] +> 每次执行脚本都可以在 `/tmp/nicsensor_debug.log` 查询详细的命令执行记录 + +## 2_使用方法 + +> [!warning] +> 在使用时针对网卡的硬件特性需要定制化修改脚本的 `Project Varible` + +### 2_1_传感器读取 + +**命令格式** +``` shell +./nicsensor.sh +``` +**参数说明** +- `pcie slot`:网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型 +- `sensor type`:传感器类型 +- `sensor slave`:传感器的slave地址 + +**命令示例** +``` shell +# 读取pcie2槽位上的adc128的信息, adc128芯片的地址为0x1f(7bit) +./nicsensor.sh pcie2 adc128 0x1f +``` + +### 2_2_FRU相关操作 + +**命令格式** +``` shell +# 读取FRU +./nicsensor.sh fru + +# 写入FRU +./nicsensor.sh fru write +``` + +**参数说明** +- `pcie slot`:网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型 +- `eeprom slave`: FRU所在的eeprom芯片的slave地址 +- `filename`: 仅在写入FRU时提供, 要写入的FRU bin文件 + +**命令示例** +``` shell +# 读取pcie2槽位上的fru信息, eeprom的芯片地址为0x50(7bit) +./nicsensor.sh pcie2 fru 0x50 + +# 写入pcie2槽位上网卡的fru +./nicsensor.sh pcie2 fru 0x50 write fru.bin +``` + +### 2_3_命令透传 + +**命令格式** +``` shell +./nicsensor.sh chip +``` +**参数说明** +- `pcie slot`:网卡位于的PCIE SLOT槽位,需要指定pcie/ocp, 不指定时默认为pcie类型 +- `chip slave`: 芯片的slave地址 +- `command`: 要透传执行的I2C命令 + +**命令示例** +``` shell +# 对pcie2槽位上的chip透传命令 i2ctransfer -y 12 w2@0x11 0x00 0x00 r2 , 芯片地址为0x11(7bit) +./nicsensor.sh pcie2 chip 0x11 "i2ctransfer -y 12 w2@0x11 0x00 0x00 r2" +``` + +### 2_4_插槽I2C信息遍历 + +**命令格式** +``` shell +./nicsensor.sh detect +``` + +**参数说明** +- `nic type`:需要指定pcie/ocp, 不指定时默认为pcie类型 + +**命令示例** +``` shell +./nicsensor.sh detect pcie +``` + +### 2_5_调试模式使用 + +## 3_常见问题 \ No newline at end of file diff --git a/readme.txt b/readme_old.txt similarity index 100% rename from readme.txt rename to readme_old.txt