zoukankan      html  css  js  c++  java
  • pci 设备 vendor device subsystem 驱动

    Then to get the ids, use:
    
    $ lspci -v -n -s 03:00.0
    03:00.0 0280: 8086:0085 (rev 34)
        Subsystem: 8086:1311
        Flags: bus master, fast devsel, latency 0, IRQ 52
    You can also find the same information in /sys:
    
    $ cd /sys/bus/pci/devices/0000:03:00.0 
    $ cat vendor device 
    0x8086
    0x0085
    $ cat subsystem_vendor subsystem_device 
    0x8086
    0x1311
    [root@localhost memzone]# lspci | grep -i ether
    05:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    06:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    7d:00.0 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    7d:00.1 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    7d:00.2 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    7d:00.3 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    [root@localhost memzone]# cd /sys/bus/pci/devices/0000:05:00.0
    [root@localhost 0000:05:00.0]# pwd
    /sys/bus/pci/devices/0000:05:00.0
    [root@localhost 0000:05:00.0]# ls 
    broken_parity_status      device           iommu_group     msi_bus    resource0                sriov_totalvfs
    class                     devspec          irq             numa_node  resource2                subsystem
    config                    dma_mask_bits    local_cpulist   power      resource4                subsystem_device
    consistent_dma_mask_bits  driver           local_cpus      remove     revision                 subsystem_vendor
    current_link_speed        driver_override  max_link_speed  rescan     rom                      uevent
    current_link_width        enable           max_link_width  reset      sriov_drivers_autoprobe  vendor
    d3cold_allowed            iommu            modalias        resource   sriov_numvfs             vpd
    [root@localhost 0000:05:00.0]# cat vendor device 
    0x19e5
    0x0200
    [root@localhost 0000:05:00.0]# cat subsystem_vendor subsystem_device
    0x19e5
    0xd139
    [root@localhost 0000:05:00.0]# ls -v -n -d 05:00.0
    ls: cannot access 05:00.0: No such file or directory
    [root@localhost 0000:05:00.0]# ls -v -n -s 05:00.0
    ls: cannot access 05:00.0: No such file or directory
    [root@localhost 0000:05:00.0]# lspci -v -n -s 05:00.0
    05:00.0 0200: 19e5:0200 (rev 45)
            Subsystem: 19e5:d139
            Flags: fast devsel, NUMA node 0
            [virtual] Memory at 80007b00000 (64-bit, prefetchable) [size=128K]
            [virtual] Memory at 80008a20000 (64-bit, prefetchable) [size=32K]
            [virtual] Memory at 80000200000 (64-bit, prefetchable) [size=1M]
            Expansion ROM at e9200000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-eb
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel driver in use: vfio-pci
            Kernel modules: hinic
    
    [root@localhost 0000:05:00.0]# 

     PCI-E设备配置空间修改

    修改PCIE配置空间的命令为:setpci

    NAME

    setpci – configure PCI devices

       
     

    SYNOPSIS

    setpci [options] devices

       
     

    对于setpci命令来说,主要的参数如下:

    -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]

       
     

    就是我们要指定设备,然后修改其配置空间。常用命令格式和参数如下:

    setpci -s BUSID:DEVID.FUNCID REGISTEROFFSET.B=NEWVALUE

    setpci -s BUSID:DEVID.FUNCID REGISTEROFFSET.W=NEWVALUE

    setpci -s BUSID:DEVID.FUNCID REGISTEROFFSET.L=NEWVALUE

       
     

    如:

    setpci -s 0:14.0 60.B=6

    是将设备0:14.0设备,PCI配置空间便宜量为0x60,写入新的字节值为6。查看PCI配置空间修改是否生效,可以通过lspci命令来查看,如设置0:14.0后,读取命令为lspci –s 0:14.0 –xxx。

     
     

    4 扫描PCI设备

    扫描或探测PCI/PCI-E设备的命令为:scanpci

    NAME

    scanpci – scan/probe PCI buses

       
     

    SYNOPSIS

    scanpci [-v12OfV]

       
     

    参数:

    -v 打印所有设备的配置空间信息。

    -1 使用PCI配置Type 1。

    -2 使用PCI配置Type 2。

    -f 与-1或-2参数结合,强制使用某种类型。

    -O:使用OS的PCI配置空间访问方式访问。

  • 相关阅读:
    ASP.NET MVC5+EF6+EasyUI 后台管理系统--任务调度系统解析
    ueditor插入自定义内容和样式
    PHP跨页面传递时session失效
    apache 错误:The system cannot find the file specified.
    Thinkphp5 使用odbc连接到sqlserver
    thinkphp5在URL地址里隐藏模块名
    wamp设置自定义域名访问php网站
    wamp因配置错误而导致apache无法启动的问题
    Jquery 实现input回车时跳转到下一个input元素
    PHP ERROR : Call to undefined function curl_init()
  • 原文地址:https://www.cnblogs.com/dream397/p/13603939.html
Copyright © 2011-2022 走看看