精华内容
下载资源
问答
  • setpci命令 配置PCI设备

    2021-01-09 18:53:17
    setpci命令是一个查询和配置PCI设备的实用工具。 命令中使用的数字都是十六进制数。 由于setpci命令需要修改硬件的配置参数,所以必须具有“root”用户权限。 通常使用setpci命令配置PCI设备之前,为了防止操作系统...
  • setpci 命令的使用

    千次阅读 2019-05-09 00:19:44
    Usage: setpci [<options>] (<device>+ <reg>[=<values>]*)* Setting commands: <device>: -s [[[<domain>]:][<bus>]:][<slot>][.[<func>]] -d [<...

    Usage: setpci [<options>] (<device>+ <reg>[=<values>]*)*

    Setting commands:
    <device>: -s [[[<domain>]:][<bus>]:][<slot>][.[<func>]]
    -d [<vendor>]:[<device>]
    <reg>: <base>[+<offset>][.(B|W|L)]
    <base>: <address>
    <named-register>
    [E]CAP_<capability-name>
    [E]CAP<capability-number>
    <values>: <value>[,<value>…]
    <value>: <hex>
    <hex>:<mask>

    一般的操作命令如下:

    setpci -s 03:00.0 [reg].[b|w|l] 读 pcie 配置空间内容查看

    setpci -s 03:00.0 [reg].[b|w|l]=value 写 pcie 配置空间寄存器

    展开全文
  • setpci命令是一个查询和配置PCI设备的使用工具。语法setpci(选项)(参数)选项-v:显示指令执行的细节信息;-f:当没有任何操作需要完成时,不显示任何信息;-D:测试模式,并不真正将配置信息写入寄存器;-d:仅显示...

    setpci命令是一个查询和配置PCI设备的使用工具。

    语法setpci(选项)(参数)

    选项-v:显示指令执行的细节信息;

    -f:当没有任何操作需要完成时,不显示任何信息;

    -D:测试模式,并不真正将配置信息写入寄存器;

    -d:仅显示给定厂商和设备的信息;

    -s:仅显示指定总线、插槽上的设备或设备上的功能块信息。

    参数PCI设备:指定要配置的PCI设备;

    操作:指定要完成的配置操作。

    实例

    Linux下调节笔记本屏幕亮度方法:

    首先进入终端输入lspci

    00:00.0

    发现00:02.0是VGA设备,于是我们修改它的属性:

    解释一下:setpci 是修改设备属性的命令。

    -s 表示接下来输入的是设备的地址。

    00:02.0 VGA设备地址(:.)。

    F4 要修改的属性的地址,这里应该表示“亮度”。

    .B 修改的长度(B应该是字节(Byte),还有

    =FF 要修改的值(可以改)。

    我这里00是最暗,FF是最亮,不同的电脑可能不一样。比如说我嫌FF太闪眼了,我就可以:sudo setpci -s 00:02.0 F4.B=CC

    展开全文
  • PCIe userspace tools: lspci, setpci and sysfs

    千次阅读 2017-09-10 09:39:56
    PCIe userspace tools: lspci, setpci and sysfs

    PCIe userspace tools: lspci, setpci and sysfs

    -v0.1 2017.9.5 Sherlock init

    From mj.ucw.cz/sw/pciutils we can get the code of lspci/setpci, which are two
    useful tools to debug PCIe related problems. This doc just introduces these
    two tools and also the sysfs interfaces which can be used in PCIe problem debug.

    lspci

    lspci

    00:00.0 Host bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 DMI2 (rev 02)
    00:01.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 1 (rev 02)
    00:02.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 2 (rev 02)
    00:02.2 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 2 (rev 02)
    00:03.0 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 3 (rev 02)
    00:03.2 PCI bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 PCI Express Root Port 3 (rev 02)

    A general show of PCIe devices in system.

    lspci -t

    [...]
     \-[0000:00]-+-00.0
                 +-01.0-[01]----00.0
                 +-02.0-[02]--+-00.0
                 |            +-00.1
                 |            +-00.2
                 |            \-00.3
                 +-02.2-[03]--
                 +-03.0-[04]--
                 +-03.2-[05]--
    [...]

    Show PCIe topology in tree picture. As showed in above picture, 0000:00 means
    domain 0 bus 0; 01.0 means a device under bus 0, so its BDF should be 0000:00:01.0;
    01.0-[01] here [01] means the bus number under device 00:01.0, some times we may
    get [xx-yy] which means the bus range under this device, apparently this device
    is a PCIe bridge; 01.0-[01]—-00.0 here 00.0 means a device which device:function
    is 00.0, so together with its father bus, its BDF should be 0000:01:00.0.

    lspci -s ff:0f.1

    ff:0f.1 System peripheral: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 Buffered Ring Agent (rev 02)

    To see the specific device information, use lspci -s BDF

    lspci -vvv

    80:05.4 PIC: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 I/O APIC (rev 02) (prog-if 20 [IO(X)-APIC])
        Subsystem: Device 19e5:2060
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Region 0: Memory at c8000000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: <access denied>

    To see more information, use -vvv/-vv/-v. You can see BAR in “Region”, different
    bridge window range and different capabilities.

    lspci -xxx

    7f:13.1 System peripheral: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 Integrated Memory Controller 0 Target Address, Thermal & RAS Registers (rev 02)
    00: 86 80 71 2f 00 00 10 00 02 00 80 08 00 00 80 00
    10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    20: 00 00 00 00 00 00 00 00 00 00 00 00 e5 19 60 20
    30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    To see configure space as bit value, use -xxx/-xx/-x

    setpci

    setpci -s BDF 20.L=0x12345678

    Above command set 0x20 offset of configure space of a device which BDF is BDF
    to 0x12345678. L here means 32bit, W will mean 16bit, B will mean 8bit.

    sysfs

    • remove

      We can remove a device by writing 1 to its remove file.

    • rescan

      We can rescan a device/bus by writing 1 to its rescan file, we can also rescan
      whole PCIe system by echo 1 > /sys/bus/pci/rescan (need to check…).

      When we do rescan a device, we find its father bus, and pass this bus to PCIe
      enumeration process.

      However, if we rescan a RP or PCIe bridge, as the structure of related RP or
      PCIe bridge is still there, Linux kernel will do nothing about MEM/IO window
      of related RP or PCIe bridge.(however, writing/reading MEM/IO operation will
      be done to checkout if this bridge’s MEM/IO window register is working)

    • reset

      (to do…)

    展开全文
  • Linux command --- lspci and setpci

    千次阅读 2019-01-30 16:14:24
    1. lspci it reads the information of the pci bus and device. &gt;sudo lspci -vvv with parameter -vvv , it will show the device configure space and capabilities....Here is a bridge....

    1. lspci

    it reads the information of the pci bus and device.

    >sudo lspci -vvv

    with parameter -vvv , it will show the device configure space and capabilities. For example:

    Here is a bridge. First it has type1 configure space header as:

    pci configure space type1 header

    64:00.0 PCI bridge: Intel Corporation Sky Lake-E PCI Express Root Port 1A (rev 04) (prog-if 00 [Normal decode])
    	Physical Slot: 6
    	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    	Latency: 0, Cache Line Size: 64 bytes
    	Interrupt: pin A routed to IRQ 30
    	NUMA node: 0
    	Bus: primary=64, secondary=65, subordinate=65, sec-latency=0
    	I/O behind bridge: 0000f000-00000fff
    	Memory behind bridge: b6000000-b61fffff
    	Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
    	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ <SERR- <PERR-
    	BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
    		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
    	Capabilities: [40] Subsystem: Intel Corporation Sky Lake-E PCI Express Root Port A
    	Capabilities: [60] MSI: Enable+ Count=1/2 Maskable+ 64bit-
    		Address: fee01000  Data: 4021
    		Masking: 00000002  Pending: 00000000
    	Capabilities: [90] Express (v2) Root Port (Slot+), MSI 00
    		DevCap:	MaxPayload 256 bytes, PhantFunc 0
    			ExtTag+ RBE+
    		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
    			RlxdOrd- ExtTag+ PhantFunc- AuxPwr- NoSnoop-
    			MaxPayload 256 bytes, MaxReadReq 128 bytes
    		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
    		LnkCap:	Port #5, Speed 8GT/s, Width x16, ASPM L1, Exit Latency L0s <512ns, L1 <16us
    			ClockPM- Surprise+ LLActRep+ BwNot+ ASPMOptComp+
    		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+
    			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
    		LnkSta:	Speed 8GT/s, Width x4, TrErr- Train- SlotClk+ DLActive+ BWMgmt- ABWMgmt-
    		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
    			Slot #6, PowerLimit 0.000W; Interlock- NoCompl-
    		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
    			Control: AttnInd Off, PwrInd Off, Power- Interlock-
    		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
    			Changed: MRL- PresDet- LinkState+
    		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible+
    		RootCap: CRSVisible+
    		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
    		DevCap2: Completion Timeout: Range BCD, TimeoutDis+, LTR-, OBFF Not Supported ARIFwd+
    		DevCtl2: Completion Timeout: 260ms to 900ms, TimeoutDis-, LTR-, OBFF Disabled ARIFwd+
    		LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
    			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
    			 Compliance De-emphasis: -6dB
    		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
    			 EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
    	Capabilities: [e0] Power Management version 3
    		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
    		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
    	Capabilities: [100 v1] Vendor Specific Information: ID=0002 Rev=0 Len=00c <?>
    	Capabilities: [110 v1] Access Control Services
    		ACSCap:	SrcValid+ TransBlk+ ReqRedir+ CmpltRedir+ UpstreamFwd+ EgressCtrl- DirectTrans-
    		ACSCtl:	SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
    	Capabilities: [148 v1] Advanced Error Reporting
    		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
    		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
    		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
    		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
    	Capabilities: [1d0 v1] Vendor Specific Information: ID=0003 Rev=1 Len=00a <?>
    	Capabilities: [250 v1] #19
    	Capabilities: [280 v1] Vendor Specific Information: ID=0005 Rev=3 Len=018 <?>
    	Capabilities: [300 v1] Vendor Specific Information: ID=0008 Rev=0 Len=038 <?>
    	Kernel driver in use: pcieport
    

    Here is a device, it has the pci configure space type0 header as:

    pci configure space type0 header

    65:00.0 Non-Volatile memory controller: XXX Technology Group Ltd. Device xxx (rev 02) (prog-if 02 [NVM Express])
    	Subsystem: XXX Technology Group Ltd. Device 0100
    	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+
    	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    	Latency: 0, Cache Line Size: 32 bytes
    	Interrupt: pin A routed to IRQ 31
    	NUMA node: 0
    	Region 0: Memory at b6000000 (64-bit, non-prefetchable) [size=16K]
    	Capabilities: [40] Power Management version 3
    		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
    		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
    	Capabilities: [70] Express (v2) Endpoint, MSI 00
    		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
    			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
    		DevCtl:	Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+
    			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop- FLReset-
    			MaxPayload 256 bytes, MaxReadReq 512 bytes
    		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
    		LnkCap:	Port #0, Speed 8GT/s, Width x4, ASPM not supported, Exit Latency L0s unlimited, L1 <64us
    			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
    		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
    			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
    		LnkSta:	Speed 8GT/s, Width x4, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
    		DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Not Supported
    		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
    		LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
    			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
    			 Compliance De-emphasis: -6dB
    		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
    			 EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
    	Capabilities: [b0] MSI-X: Enable+ Count=2 Masked-
    		Vector table: BAR=0 offset=00002000
    		PBA: BAR=0 offset=00003000
    	Capabilities: [100 v2] Advanced Error Reporting
    		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
    		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
    		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
    		AERCap:	First Error Pointer: 00, GenCap+ CGenEn+ ChkCap+ ChkEn+
    	Capabilities: [148 v1] Device Serial Number 00-00-00-00-00-00-00-00
    	Capabilities: [158 v1] Power Budgeting <?>
    	Capabilities: [168 v1] Alternative Routing-ID Interpretation (ARI)
    		ARICap:	MFVC- ACS-, Next Function: 0
    		ARICtl:	MFVC- ACS-, Function Group: 0
    	Capabilities: [178 v1] #19
    	Capabilities: [198 v1] Single Root I/O Virtualization (SR-IOV)
    		IOVCap:	Migration-, Interrupt Message Number: 000
    		IOVCtl:	Enable- Migration- Interrupt- MSE- ARIHierarchy+
    		IOVSta:	Migration-
    		Initial VFs: 64, Total VFs: 64, Number of VFs: 0, Function Dependency Link: 00
    		VF offset: 1, stride: 1, Device ID: 109a
    		Supported Page Size: 00000553, System Page Size: 00000001
    		Region 0: Memory at 00000000b6004000 (64-bit, non-prefetchable)
    		VF Migration: offset: 00000000, BIR: 0
    	Kernel driver in use: nvme
    

    as we know, pci capabilities is chain structure link by pointers as:

    pci_capabilities_link

    And pcie has 3 types of capabilities: 1) pci capabilities 2) pci express capabilities 3) pci express extended capabilites.

    Why 3? maybe need more functions. Here is the layout of all three types of capabilities in the configure space:

    pcie cap layout

    1) pci capabilities . it has ID table:

    capabilities id1

    pci capabilities id2

    Can we find some pci capabilities in lspci information?

    Yes, For bridge:

    Capabilities: [40] Subsystem: Intel Corporation Sky Lake-E PCI Express Root Port A
    Capabilities: [60] MSI: Enable+ Count=1/2 Maskable+ 64bit-
    	Address: fee01000  Data: 4021
    	Masking: 00000002  Pending: 00000000
    Capabilities: [e0] Power Management version 3
    	Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
    	Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-

    2) pci express capabilities . it is in pci capabilities id table 0x10.

    Here is its structure:

    pcie capabilities struct

    For bridge, it is:

    Capabilities: [90] Express (v2) Root Port (Slot+), MSI 00
    		DevCap:	MaxPayload 256 bytes, PhantFunc 0
    			ExtTag+ RBE+
    		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
    			RlxdOrd- ExtTag+ PhantFunc- AuxPwr- NoSnoop-
    			MaxPayload 256 bytes, MaxReadReq 128 bytes
    		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
    		LnkCap:	Port #5, Speed 8GT/s, Width x16, ASPM L1, Exit Latency L0s <512ns, L1 <16us
    			ClockPM- Surprise+ LLActRep+ BwNot+ ASPMOptComp+
    		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+
    			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
    		LnkSta:	Speed 8GT/s, Width x4, TrErr- Train- SlotClk+ DLActive+ BWMgmt- ABWMgmt-
    		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
    			Slot #6, PowerLimit 0.000W; Interlock- NoCompl-
    		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
    			Control: AttnInd Off, PwrInd Off, Power- Interlock-
    		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
    			Changed: MRL- PresDet- LinkState+
    		RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible+
    		RootCap: CRSVisible+
    		RootSta: PME ReqID 0000, PMEStatus- PMEPending-
    		DevCap2: Completion Timeout: Range BCD, TimeoutDis+, LTR-, OBFF Not Supported ARIFwd+
    		DevCtl2: Completion Timeout: 260ms to 900ms, TimeoutDis-, LTR-, OBFF Disabled ARIFwd+
    		LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
    			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
    			 Compliance De-emphasis: -6dB
    		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
    			 EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-

    3) pci express extended capabilities

    it's struct is:

    pcie extended cap structeach extended capability has version number, so we can know them for bridge:

    Capabilities: [100 v1] Vendor Specific Information: ID=0002 Rev=0 Len=00c <?>
    	Capabilities: [110 v1] Access Control Services
    		ACSCap:	SrcValid+ TransBlk+ ReqRedir+ CmpltRedir+ UpstreamFwd+ EgressCtrl- DirectTrans-
    		ACSCtl:	SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
    	Capabilities: [148 v1] Advanced Error Reporting
    		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
    		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
    		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
    		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
    	Capabilities: [1d0 v1] Vendor Specific Information: ID=0003 Rev=1 Len=00a <?>
    	Capabilities: [250 v1] #19
    	Capabilities: [280 v1] Vendor Specific Information: ID=0005 Rev=3 Len=018 <?>
    	Capabilities: [300 v1] Vendor Specific Information: ID=0008 Rev=0 Len=038 <?>

    So how many kind of pci express extended capabilities? Good question! Count them in the spec, looks like 26. You can count them.

    And now you should be able to find all 3 types of capabilities of the device.

    2. setpci

    It is a tool to help us to access the pci/pcie configure space regitsters.

    Here list all the registers and registers base.

    xxx@YYYY:~$ setpci --dumpregs
    cap pos w name
         00 W VENDOR_ID            -- type 0 header --
         02 W DEVICE_ID
         04 W COMMAND
         06 W STATUS
         08 B REVISION
         09 B CLASS_PROG
         0a W CLASS_DEVICE
         0c B CACHE_LINE_SIZE
         0d B LATENCY_TIMER
         0e B HEADER_TYPE
         0f B BIST
         10 L BASE_ADDRESS_0
         14 L BASE_ADDRESS_1
         18 L BASE_ADDRESS_2
         1c L BASE_ADDRESS_3
         20 L BASE_ADDRESS_4
         24 L BASE_ADDRESS_5
         28 L CARDBUS_CIS
         2c W SUBSYSTEM_VENDOR_ID
         2e W SUBSYSTEM_ID
         30 L ROM_ADDRESS
         3c B INTERRUPT_LINE
         3d B INTERRUPT_PIN
         3e B MIN_GNT
         3f B MAX_LAT
         18 B PRIMARY_BUS        -- type 1 header -- 
         19 B SECONDARY_BUS
         1a B SUBORDINATE_BUS
         1b B SEC_LATENCY_TIMER
         1c B IO_BASE
         1d B IO_LIMIT
         1e W SEC_STATUS
         20 W MEMORY_BASE
         22 W MEMORY_LIMIT
         24 W PREF_MEMORY_BASE
         26 W PREF_MEMORY_LIMIT
         28 L PREF_BASE_UPPER32
         2c L PREF_LIMIT_UPPER32
         30 W IO_BASE_UPPER16
         32 W IO_LIMIT_UPPER16
         38 L BRIDGE_ROM_ADDRESS
         3e W BRIDGE_CONTROL
         10 L CB_CARDBUS_BASE        --card bus --
         14 W CB_CAPABILITIES
         16 W CB_SEC_STATUS
         18 B CB_BUS_NUMBER
         19 B CB_CARDBUS_NUMBER
         1a B CB_SUBORDINATE_BUS
         1b B CB_CARDBUS_LATENCY
         1c L CB_MEMORY_BASE_0
         20 L CB_MEMORY_LIMIT_0
         24 L CB_MEMORY_BASE_1
         28 L CB_MEMORY_LIMIT_1
         2c W CB_IO_BASE_0
         2e W CB_IO_BASE_0_HI
         30 W CB_IO_LIMIT_0
         32 W CB_IO_LIMIT_0_HI
         34 W CB_IO_BASE_1
         36 W CB_IO_BASE_1_HI
         38 W CB_IO_LIMIT_1
         3a W CB_IO_LIMIT_1_HI
         40 W CB_SUBSYSTEM_VENDOR_ID
         42 W CB_SUBSYSTEM_ID
         44 L CB_LEGACY_MODE_BASE
      01 00 - CAP_PM                -- pci express caps --
      02 00 - CAP_AGP
      03 00 - CAP_VPD
      04 00 - CAP_SLOTID
      05 00 - CAP_MSI
      06 00 - CAP_CHSWP
      07 00 - CAP_PCIX
      08 00 - CAP_HT
      09 00 - CAP_VNDR
      0a 00 - CAP_DBG
      0b 00 - CAP_CCRC
      0c 00 - CAP_HOTPLUG
      0d 00 - CAP_SSVID
      0e 00 - CAP_AGP3
      0f 00 - CAP_SECURE
      10 00 - CAP_EXP
      11 00 - CAP_MSIX
      12 00 - CAP_SATA
      13 00 - CAP_AF
    0001 00 - ECAP_AER        -- pci express extended caps , not 26 types ??--
    0002 00 - ECAP_VC
    0003 00 - ECAP_DSN
    0004 00 - ECAP_PB
    0005 00 - ECAP_RCLINK
    0006 00 - ECAP_RCILINK
    0007 00 - ECAP_RCECOLL
    0008 00 - ECAP_MFVC
    000a 00 - ECAP_RBCB
    000b 00 - ECAP_VNDR
    000d 00 - ECAP_ACS
    000e 00 - ECAP_ARI
    000f 00 - ECAP_ATS
    0010 00 - ECAP_SRIOV
    001d 00 - ECAP_DPC

    You can check all the registers refer to the configure header and capabilities struct.

    To read a register:

    xxx@YYYY:~$ sudo setpci -s 0000:64:00.0 CAP_EXP+0x02.w
    0142

    0000:64:00.0 is the pcie address (domain:bus:device.function) of bridge. 0142 is the register value.

    To write a register:

    xxx@YYYY:~$ sudo setpci -s 0000:64:00.0 CAP_EXP+0x18.w=0x03c8
    xxx@YYYY:~$ sudo setpci -s 0000:64:00.0 CAP_EXP+0x18.w
    03c8

    This enables slot control register bit 3 -- presence detect changed enabled.

    SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet+ CmdCplt- HPIrq- LinkChg-
    			Control: AttnInd Off, PwrInd Off, Power- Interlock-

    PresDet+ is bit 3.

    The end.

    展开全文
  • 发现00:02.0是VGA设备,于是我们修改它的属性 sudo setpci -s 00:02.0 F4.B=FF 解释一下: setpci是 修改设备属性的命令 -s表示接下来输入的是设备的地址 00:02.0 VGA设备地址(:.) F4 要修改的属性的地址,这里应该...
  • pci_driver_study.rar

    2011-07-19 22:15:00
    本资料详细介绍了PCI驱动开卡相关知识,以及PCI工具lspci和setpci的源码和使用方法
  • pcis lspci setpci /bin/lspci /bin/setpci /etc/pci/pci.ids
  • 仍然是bresenham算法代码 public void pcircle(int x,int y,int r){ int p=3-2*r,x0=0,y0=r...pics[x0+x][y0+y]=setpci;//忽略一步 pics[-x0+x][y0+y]=setpci; pics[x0+x][-y0+y]=setpci; pics[-x0+x][-y0+y]=setp
  • coolrun-开源

    2021-05-01 19:54:19
    coolrun是一个shell脚本,可通过setpci实用程序直接使用硬件来启用/禁用AMD Duron / Athlon / Athlon XP / Sempron处理器的节能功能。 支持许多芯片组,但并非全部都是因为缺少信息
  • pciutils-2.2.9.tar

    2013-03-09 22:17:01
    pciutils 软件包包含lspci和setpci.这些软件用于PCI总线(bus)的配置.
  • Linux下C如何调用PCI Lib函数

    千次阅读 2018-08-16 08:11:43
    在Linux下,可以通过”setpci”和”setpci”命令来访问PCI设备的配置空间,那么能否用程序来访问PCI 配置空间呢?答案当然是肯定的,linux下提供了多个pci库以供应用程序访问。下面就以最常见的为例,从安装、使用和...
  • Linux下C如何调用PCI Lib函数在Linux下,可以通过"setpci"和"setpci"命令来访问PCI设备的配置空间,那么能否用程序来访问PCI 配置空间呢?答案当然是肯定的,linux下提供了多个pci库以供应用程序访问。下面就以最常见...
  • 之前的博文已经说了怎么让系统识别wifi硬件。但是还是有个问题,wifi不定时就断了。观察了几天也没有发现规律。尝试用windows的驱动也没有成功。google一下,发现别人也有这个问题...sudo setpci -s00:1c.1 0x50.W=0...
  • lspci

    千次阅读 2019-11-12 00:21:53
    lspci 显示Linux系统的pci设备最简单的方法就是使用lspci命令,前提是要安装pciutils包(centos在最小化安装时不会自带该包,...从该项目的README文件可以知道,其主要提供三个命令:lspci、setpci和update-pciids。...
  • PCIe总结--配置空间

    2020-04-05 16:59:32
    如果系统里有一个PCIe设备了,我们想对这个PCIe设备的PCIe层进行控制,最常见的方式就是配置这个设备PCIe配置空间的寄存器了。... 在linux下对配置空间进行寄存器读写的命令是setpci,具体用法可...
  • 2种方法: 1. 调节屏幕对比度参数gamma值 > xgamma -gamma .75   如果不理想可以尝试将.75修改成0.5~1.0之间测试一下。... sudo setpci -s 00:02.0 F4.B=xx  xx就是16进制表示的屏幕亮度值,范...
  • 今天刚在闲置的笔记本上将原来的win10重装成了ubuntu系统。在我写这些文字时ubuntu官网放出的最新版本是18.04。在装完后把玩的时候发现屏幕的亮度没有... 在cmd中用命令行调节亮度:格式:sudo setpci -s 00:02.0 F...
  • 该算法效果可以从win系统画图程序中得到。 public void pfill(int x,int y){ if(x>=0&&x=0&&y if(pics[x][y] ...pics[x][y]=setpci; pfill(x-1,y); pfill(x,y-1); pfill(x+1,y); pfill(x,y+1); } } }
  • linux基础学习(1)

    2015-02-28 11:32:06
    (1) 显示器设置 笔记本屏幕亮度调节的方式。  2种方法:  1....  > xgamma -gamma .75 ... 如果不理想可以尝试将.75修改成0.5~1.0之间测试一下。我用1.0后感觉和Vista下亮度一致。... > sudo setpci -s 00:02.0 F4.B
  • /bin/bash a="setpci -s 00:02.0 F4.B`=`" read -p "Display brightness adjustment? 50 100 200 255?:" b case $b in 30) $a="1E" ;; 50) $a="32" ;; 100) $a="64" ;; 200) $a="C8" ;; 255) $a="FF" ;...
  • linux调节显示屏

    2013-11-22 15:34:52
    1. 调节屏幕对比度参数gamma值  > xgamma -gamma .75  如果不理想可以尝试将.75修改成... > sudo setpci -s 00:02.0 F4.B=xx  xx就是16进制表示的屏幕亮度值,范围0(最亮)~FF(最暗)。  00:02.0是你的显示器
  • elementary os体验记

    2013-10-06 13:27:00
    好吧。我又折腾系统了。 好吧先写一个关于笔记本亮度调节问题。 我得是acer本本。...然后在终端输入命令:sudo setpci -s 01:00.0 F4.B=XX XX这里是你要调节得亮度值。16进制。从00到FF。。00最亮...

空空如也

空空如也

1 2 3 4 5 ... 11
收藏数 219
精华内容 87
关键字:

setpci