PCIE桥的配置空间

参考文档:

  • PCI Express Base_r5_1.pdf P7.5.1.3节
  • PCI+EXPRESS体系结构导读.pdf P2.3.3节

注:因为配置太多,持续更新中

配置空间格式

image.png

ID相关

查看ID表(复习)

获取厂家信息:
pci.ids中进行对比,来查找厂家信息和设备信息。 pci的id表收录在 pci-ids.ucw.cz

PCI ID Project at The PCI ID Repository, 注册登陆后(公司是PCI-SIG组织成员),可以增加修改对应device id的描述信息,需要maintainer审批合入后,展示在PCI ID网站上 sudo update-pciids 命令可以更新pci.ids 在此位置/usr/share/misc/pci.ids可以查看更新后pci.ids文件

注:这里边也有Class code表,可以搜索下边关键字

  1. # List of known device classes, subclasses and programming interfaces
  2. # Syntax:
  3. # C class class_name
  4. # subclass subclass_name <-- single tab
  5. # prog-if prog-if_name <-- two tabs

Class Code

桥设备的Class Code 在lspci查看时,为: xx xx 06

  1. C 06 Bridge
  2. 00 Host bridge ###
  3. 01 ISA bridge
  4. 02 EISA bridge
  5. 03 MicroChannel bridge
  6. 04 PCI bridge ###
  7. 00 Normal decode
  8. 01 Subtractive decode
  9. 05 PCMCIA bridge
  10. 06 NuBus bridge
  11. 07 CardBus bridge
  12. 08 RACEway bridge
  13. 00 Transparent mode
  14. 01 Endpoint mode
  15. 09 Semi-transparent PCI-to-PCI bridge
  16. 40 Primary bus towards host CPU
  17. 80 Secondary bus towards host CPU
  18. 0a InfiniBand to PCI host bridge
  19. 80 Bridge

Bus Number相关

sec - secondary bus,下一级bus
pri - primary bus, 上一级bus
sub - subordinate bus,当前总线树的最末级bus号。
2.PCIE桥的配置空间 - 图2

IO/MEM BASE/Limit

存放PCI子树中 所有IO/MEM设备的基地址和大小。 MEM的空间大小至少为1M

IO BASE Upper 16BIT/ IO Limit Upper 16BIT

如果PCI仅仅支持16位的IO端口,那么这两个配置只读
如果PCI支持32位的IO端口,那么这两个配置提供了高16位地址。

Bridge Control Register

image.png

Master Abort Mode

是以前得pci-to-pci bridge, PCIE 必须是是0b, 软件只读

实战解析

  1. (base) baiy@inno-MS-7B89:~$ sudo lspci -s 00:01.1 -vvvvxxxx
  2. 00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 1483 (prog-if 00 [Normal decode])
  3. Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
  4. Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
  5. Latency: 0, Cache Line Size: 64 bytes
  6. Interrupt: pin ? routed to IRQ 26
  7. Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
  8. I/O behind bridge: 0000f000-00000fff
  9. Memory behind bridge: f7900000-f79fffff
  10. Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
  11. Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ <SERR- <PERR-
  12. BridgeCtl: Parity- SERR+ NoISA- VGA- MAbort- >Reset- FastB2B-
  13. PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
  14. Capabilities: [50] Power Management version 3
  15. Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
  16. Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
  17. Capabilities: [58] Express (v2) Root Port (Slot+), MSI 00
  18. DevCap: MaxPayload 512 bytes, PhantFunc 0
  19. ExtTag+ RBE+
  20. DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+
  21. RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
  22. MaxPayload 512 bytes, MaxReadReq 512 bytes
  23. DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
  24. LnkCap: Port #1, Speed 8GT/s, Width x4, ASPM L1, Exit Latency L0s <512ns, L1 <64us
  25. ClockPM- Surprise- LLActRep+ BwNot+ ASPMOptComp+
  26. LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
  27. ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
  28. LnkSta: Speed 8GT/s, Width x4, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
  29. SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
  30. Slot #0, PowerLimit 0.000W; Interlock- NoCompl+
  31. SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
  32. Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
  33. SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
  34. Changed: MRL- PresDet- LinkState+
  35. RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible+
  36. RootCap: CRSVisible+
  37. RootSta: PME ReqID 0000, PMEStatus- PMEPending-
  38. DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Not Supported ARIFwd-
  39. DevCtl2: Completion Timeout: 65ms to 210ms, TimeoutDis-, LTR+, OBFF Disabled ARIFwd-
  40. LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
  41. Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
  42. Compliance De-emphasis: -6dB
  43. LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
  44. EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
  45. Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
  46. Address: 00000000fee00000 Data: 0000
  47. Capabilities: [c0] Subsystem: Advanced Micro Devices, Inc. [AMD] Device 1234
  48. Capabilities: [c8] HyperTransport: MSI Mapping Enable+ Fixed+
  49. Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
  50. Capabilities: [150 v2] Advanced Error Reporting
  51. UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
  52. UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
  53. UESvrt: DLP- SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP- ECRC- UnsupReq- ACSViol-
  54. CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
  55. CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
  56. AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
  57. Capabilities: [270 v1] #19
  58. Capabilities: [2a0 v1] Access Control Services
  59. ACSCap: SrcValid+ TransBlk+ ReqRedir+ CmpltRedir+ UpstreamFwd+ EgressCtrl- DirectTrans+
  60. ACSCtl: SrcValid+ TransBlk- ReqRedir+ CmpltRedir+ UpstreamFwd+ EgressCtrl- DirectTrans-
  61. Capabilities: [370 v1] L1 PM Substates
  62. L1SubCap: PCI-PM_L1.2- PCI-PM_L1.1+ ASPM_L1.2- ASPM_L1.1+ L1_PM_Substates+
  63. L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
  64. L1SubCtl2:
  65. Capabilities: [3c4 v1] #23
  66. Capabilities: [400 v1] #25
  67. Capabilities: [410 v1] #26
  68. Capabilities: [440 v1] #27
  69. Kernel driver in use: pcieport
  70. 00: 22 10 83 14 07 04 10 00 00 00 04 06 10 00 81 00
  71. 10: 00 00 00 00 00 00 00 00 00 01 01 00 f1 01 00 20
  72. 20: 90 f7 90 f7 f1 ff 01 00 00 00 00 00 00 00 00 00
  73. 30: 00 00 00 00 50 00 00 00 00 00 00 00 ff 00 12 00
  74. 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  75. 50: 01 58 03 c8 00 00 00 00 10 a0 42 01 22 80 00 00
  76. 60: 5f 29 00 00 43 38 73 01 40 00 43 70 00 00 04 00
  77. 70: 00 00 40 01 10 00 01 00 00 00 00 00 df 19 70 00
  78. 80: 06 04 00 00 0e 00 00 00 03 00 1f 00 00 00 00 00
  79. 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  80. a0: 05 c0 81 00 00 00 e0 fe 00 00 00 00 00 00 00 00
  81. b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  82. c0: 0d c8 00 00 22 10 34 12 08 00 03 a8 00 00 00 00
  83. d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  84. e0: 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00
  85. f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00