feat(master : readme) 更新readme

This commit is contained in:
leimingsheng 2025-04-09 18:05:28 +08:00
parent 48300473d9
commit 132b128881
2 changed files with 118 additions and 0 deletions

118
readme.md Normal file

@ -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> <sensor_tpye> <sensor_slave>
```
**参数说明**
- `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 <pcie_slot> fru <eeprom_slave>
# 写入FRU
./nicsensor.sh <pcie_slot> fru <eeprom_slave> write <filename>
```
**参数说明**
- `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 <pcie_slot> chip <chip slave> <command>
```
**参数说明**
- `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>
```
**参数说明**
- `nic type`:需要指定pcie/ocp, 不指定时默认为pcie类型
**命令示例**
``` shell
./nicsensor.sh detect pcie
```
### 2_5_调试模式使用
## 3_常见问题