标签:debugging
刚刚在看WinDbg在硬件调试方面有哪些扩展命令的时候,让我回想起一个工作中的实际事务。
在xHCI USB3.0/3.1 IP项目开发过程中,需要得到类似实际产品的PCIe配置空间信息,以作对比参考。
当时的做法是,将类似产品的xHCI host controller通过PCIe口接到SoC系统中, 通过编写ARM SoC的Bare metal代码来读取每一个产口的PCIe配置空间。
现在发现,WinDbg在KERNEL MODE(双机与LOCAL)下支持与PCI、PCIe的命令: !pci, ! pcitree.
通过该命令,就能方便,快速地读取接到X86/X64系统上的PCI/PCIe EP设备的配置空间信息。
具体的命令参数,请参考WinDbg Help.
这里列举一下在我的实验平台上的两个xHCI controller的配置空间信息:
0: kd> !pcitree
Bus 0x0 (FDO Ext fffffa8006bc97e0)
(d=0, f=0) 80860150 devext 0xfffffa8006bc39d0 devstack 0xfffffa8006bc3880 0600 Bridge/HOST to PCI
(d=2, f=0) 80860162 devext 0xfffffa8006bc21b0 devstack 0xfffffa8006bc2060 0300 Display Controller/VGA
(d=14, f=0) 80861e31 devext 0xfffffa8006bc29d0 devstack 0xfffffa8006bc2880 0c03 Serial Bus Controller/USB
(d=16, f=0) 80861e3a devext 0xfffffa8006bc11b0 devstack 0xfffffa8006bc1060 0780 Simple Serial Communications Controller/‘Other‘
(d=19, f=0) 80861503 devext 0xfffffa8006bc19d0 devstack 0xfffffa8006bc1880 0200 Network Controller/Ethernet
(d=1a, f=0) 80861e2d devext 0xfffffa8006bb01b0 devstack 0xfffffa8006bb0060 0c03 Serial Bus Controller/USB
(d=1b, f=0) 80861e20 devext 0xfffffa8006bb09d0 devstack 0xfffffa8006bb0880 0403 Multimedia Device/Unknown Sub Class
(d=1c, f=0) 80861e10 devext 0xfffffa8006bf11b0 devstack 0xfffffa8006bf1060 0604 Bridge/PCI to PCI
Bus 0x1 (FDO Ext fffffa8006beb190)
(d=0, f=0) 19120015 devext 0xfffffa8006be11b0 devstack 0xfffffa8006be1060 0c03 Serial Bus Controller/USB
(d=1c, f=7) 80861e1e devext 0xfffffa8006bf19d0 devstack 0xfffffa8006bf1880 0604 Bridge/PCI to PCI
Bus 0x2 (FDO Ext fffffa8006beb830)
(d=0, f=0) 12838892 devext 0xfffffa8006bbd1b0 devstack 0xfffffa8006bbd060 0604 Bridge/PCI to PCI
Bus 0x3 (FDO Ext fffffa8006bbdce0)
No devices have been enumerated on this bus.
(d=1d, f=0) 80861e26 devext 0xfffffa8006bf01b0 devstack 0xfffffa8006bf0060 0c03 Serial Bus Controller/USB
(d=1f, f=0) 80861e44 devext 0xfffffa8006bf09d0 devstack 0xfffffa8006bf0880 0601 Bridge/PCI to ISA
(d=1f, f=2) 80861e02 devext 0xfffffa8006bef1b0 devstack 0xfffffa8006bef060 0106 Mass Storage Controller/Unknown Sub Class
(d=1f, f=3) 80861e22 devext 0xfffffa8006bef9d0 devstack 0xfffffa8006bef880 0c05 Serial Bus Controller/Unknown Sub Class
Total PCI Root busses processed = 1
Total PCI Segments processed = 1
0: kd> !pci 0x101 0 0x14 0
PCI Configuration Space (Segment:0000 Bus:00 Device:14 Function:00)
Common Header:
00: VendorID 8086 Intel Corporation
02: DeviceID 1e31
04: Command 0406 MemSpaceEn BusInitiate InterruptDis
06: Status 0290 CapList FB2BCapable DEVSELTiming:1
08: RevisionID 04
09: ProgIF 30
0a: SubClass 03
0b: BaseClass 0c
0c: CacheLineSize 0000
0d: LatencyTimer 00
0e: HeaderType 00
0f: BIST 00
10: BAR0 f7d20004
14: BAR1 00000000
18: BAR2 00000000
1c: BAR3 00000000
20: BAR4 00000000
24: BAR5 00000000
28: CBCISPtr 00000000
2c: SubSysVenID 8086
2e: SubSysID 2030
30: ROMBAR 00000000
34: CapPtr 70
3c: IntLine 00
3d: IntPin 01
3e: MinGnt 00
3f: MaxLat 00
Device Private:
40: 800e07fd 8003c239 00000000 00000000
50: 00000017 00000000 00000000 00000000
60: 00002030 00000000 00000000 00000000
70: c1c28001 00000008 00000000 00000000
80: 00b70005 fee0f00c 00000000 000049b8
90: 00000000 00000000 00000000 00000000
a0: 00000000 00000000 00000000 00000000
b0: 0000008f 00000000 00000000 00000000
c0: 00000c03 00000000 00000000 00000000
d0: 0000000f 0000000f 0000000f 0000000f
e0: 00000000 00000000 00000000 00000000
f0: 00000000 00000000 08040f87 00000000
Capabilities:
70: CapID 01 PwrMgmt Capability
71: NextPtr 80
72: PwrMgmtCap c1c2 PMED3Hot PMED3Cold Version=2
74: PwrMgmtCtrl 0008 DataScale:0 DataSel:0 D0
80: CapID 05 MSI Capability
81: NextPtr 00
82: MsgCtrl 64BitCapable MSIEnable MultipleMsgEnable:3 (0x8) MultipleMsgCapable:3 (0x8)
84: MsgAddr fee0f00c
88: MsgAddrHi 0
8c: MsData 49b8
0: kd> !pci 0x100 1 0x0 0
PCI Configuration Space (Segment:0000 Bus:01 Device:00 Function:00)
Common Header:
00: VendorID 1912 Renesas Electronics Corp.
02: DeviceID 0015
04: Command 0406 MemSpaceEn BusInitiate InterruptDis
06: Status 0010 CapList
08: RevisionID 02
09: ProgIF 30
0a: SubClass 03
0b: BaseClass 0c
0c: CacheLineSize 0010 BurstDisabled
0d: LatencyTimer 00
0e: HeaderType 00
0f: BIST 00
10: BAR0 f7c00004
14: BAR1 00000000
18: BAR2 00000000
1c: BAR3 00000000
20: BAR4 00000000
24: BAR5 00000000
28: CBCISPtr 00000000
2c: SubSysVenID 0000
2e: SubSysID 0000
30: ROMBAR 00000000
34: CapPtr 50
3c: IntLine 00
3d: IntPin 01
3e: MinGnt 00
3f: MaxLat 00
Device Private:
40: 00000000 00000000 00000000 00000000
50: c9c37001 00000008 00000000 00000000
60: 00002030 00000000 00000000 00201809
70: 00869005 00000000 00000000 00000000
80: 00000000 00000000 00000000 00000000
90: 8007a011 00001000 00001080 00000000
a0: 00020010 00008fc0 00102000 0007ec12
b0: 10120043 00000000 00000000 00000000
c0: 00000000 00000810 00000000 00000000
d0: 00000002 00000000 00000000 00000000
e0: 00000000 00030000 05010000 00c22210
f0: 00000500 80000000 00000000 00000000
Capabilities:
50: CapID 01 PwrMgmt Capability
51: NextPtr 70
52: PwrMgmtCap c9c3 PMED0 PMED3Hot PMED3Cold Version=3
54: PwrMgmtCtrl 0008 DataScale:0 DataSel:0 D0
70: CapID 05 MSI Capability
71: NextPtr 90
72: MsgCtrl 64BitCapable MultipleMsgEnable:0 (0x1) MultipleMsgCapable:3 (0x8)
74: MsgAddr 0
78: MsgAddrHi 0
7c: MsData 0
90: CapID 11 MSI-X Capability
91: NextPtr a0
92: MsgCtrl TableSize:0x007 FuncMask:0 MSIXEnable:1
94: MSIXTable 00001000 ( BIR:0 Offset:0x1000 )
98: PBATable 00001080 ( BIR:0 Offset:0x1080 )
a0: CapID 10 PCI Express Capability
a1: NextPtr 00
a2: Express Caps 0002 (ver. 2) Type:Endpoint
a4: Device Caps 00008fc0
a8: Device Control 2000 MRR:512 ns ap pf et MP:128 ro ur fe nf ce
aa: Device Status 0010 tp AP ur fe nf ce
ac: Link Caps 0007ec12
b0: Link Control 0043 es CC rl ld RCB:64 ASPM:L0s&L1
b2: Link Status 1012 SCC lt lte NLW:x1 LS:2.5
c4: DeviceCaps2 00000810 CTR:0 CTDIS arifwd aor aoc32 aoc64 cas128 noro LTR TPH:0 OBFF:0 extfmt eetlp EETLPMax:0
c8: DeviceControl2 0000 CTVal:0 ctdis arifwd aor aoeb idoreq idocom ltr OBFF:0 eetlp
Enhanced Capabilities:
100: CapID 0001 Advanced Error Reporting Capability
Version 1
NextPtr 150
104: UncorrectableErrorStatus 00000000 dlpe sde ptlp fcpe ct ca mtlp ecrc ur acsv uie mcbtlp aeb tpb
108: UncorrectableErrorMask 00000000 dlpe sde ptlp fcpe ct ca mtlp ecrc ur acsv uie mcbtlp aeb tpb
10c: UncorrectableErrorSeverity 00062030 DLPE SDE ptlp FCPE ct ca MTLP ecrc ur acsv uie mcbtlp aeb tpb
110: CorrectableErrorStatus 00000000 re btlp bdllp rnr rtt anfe cie hlo
114: CorrectableErrorMask 00002000 re btlp bdllp rnr rtt ANFE cie hlo
118: CapabilitiesAndControl 00000000 FirstErr:0 ecrcgcap ecrcgen ecrcccap ecrccen mhrcap mhren tplp
150: CapID 0018 Latency Tolerance Reporting (LTR) Capability
Version 1
NextPtr 000
Latency 00000000 MaxSnoopValue:0 MaxSnoopScale:0 MaxNoSnoopValue:0 MaxNoSnoopScale:0
标签:debugging
原文地址:http://blog.csdn.net/u013140088/article/details/42005989