其他分享
首页 > 其他分享> > 通过setpci配置MRS脚本

通过setpci配置MRS脚本

作者:互联网

配置脚本

其中第一个变量是pci设备ID
第二个是MPS变量值(128、256、512、1024、2048、4096)
第三个是MRS变量值(128、256、512、1024、2048、4096)

例:

sh setmrs.sh 01:00.0 512 512 配置设备ID 01:00.0的MPS大小为512,MRS为512

if [ "$#" == "3" ]; then
        if [[ "$2" == "128" ]];then
                a="0f"
        elif [[ "$2" == "256" ]];then
                a="2f"
        elif [[ "$2" == "512" ]];then
                a="4f"
        elif [[ "$2" == "1024" ]];then
                a="6f"
        elif [[ "$2" == "2048" ]];then
                a="8f"
        elif [[ "$2" == "4096" ]];then
                a="9f"
        else
                echo "Fail"
                exit
        fi
        
        if [[ "$3" == "128" ]];then
                b="09"
        elif [[ "$3" == "256" ]];then
                b="19"
        elif [[ "$3" == "512" ]];then
                b="29"
        elif [[ "$3" == "1024" ]];then
                b="39"
        elif [[ "$3" == "2048" ]];then
                b="49"
        elif [[ "$3" == "4096" ]];then
                b="59"
        else
                echo "Fail"
                exit
        fi
        
        echo "setpci -s "$1" CAP_EXP+08.W=0x"$b$a
        setpci -s $1 CAP_EXP+08.W=0x$b$a
        echo ""
        echo "lspci -vvv -s "$1"|grep Max"
        lspci -vvv -s $1|grep Max
else
                echo "Fail"
fi

标签:脚本,elif,4096,echo,setpci,128,MRS,512,256
来源: https://blog.csdn.net/qq_28440017/article/details/121498215