如何在Linux下获取PCIe ECAM基址



在Linux下有没有办法获得PCIe ECAM空间的物理基地址(例如,通过sysfsdmesg(?

我的意图是使用devmem2来检查ECAM空间,并将结果与lspci -x进行比较。我假设ECAM空间可以通过MMIO访问(即不需要I/O空间(。

使用cat /proc/iomem似乎给出了答案。我在debian上使用了memtool,而不是使用devmem2

在x86上(注意MMCONFIG行(:

bruin@debian:/boot$ sudo cat /proc/iomem|grep -i pci
000a0000-000bffff : PCI Bus 0000:00
80000000-8fffffff : PCI MMCONFIG 0000 [bus 00-ff]
90000000-fbffbfff : PCI Bus 0000:00
c0000000-d1ffffff : PCI Bus 0000:04
e0000000-efffffff : PCI Bus 0000:08
fa000000-fb0fffff : PCI Bus 0000:04
fb100000-fb1fffff : PCI Bus 0000:08
fb200000-fb2fffff : PCI Bus 0000:05
fb300000-fb3fffff : PCI Bus 0000:02
root@debian:/boot# memtool md  0x80000000
80000000: 2f008086 00100400 06000002 00000010                .../............
80000010: 00000000 00000000 00000000 00000000                ................
80000020: 00000000 00000000 00000000 102f17aa                ............../.
80000030: 00000000 00000090 00000000 00000100                ................
80000040: 00000000 00000000 00000000 00000000                ................
80000050: fbffe001 00000000 00000000 00000000                ................
80000060: 01029005 00000000 00000000 00000000                ................
80000070: 00000000 00000000 00000000 00000000                ................
80000080: 00000000 00000000 00000000 00000000                ................
80000090: 0042e010 00008000 00000000 00793041                ..B.........A0y.
800000a0: 00000000 00000000 00000000 00000000                ................
800000b0: 00000000 0000139e 00000000 00000006                ................
800000c0: 00000000 00000000 00000000 00000000                ................
800000d0: 00000000 00000000 00000000 00000000                ................
800000e0: 00030001 00000008 00000000 00000000                ................
800000f0: 00000000 00000000 00000009 00000000                ................
root@debian:/boot# lspci -s 0:0.0 -xxx
00:00.0 Host bridge: Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 DMI2 (rev 02)
00: 86 80 00 2f 00 04 10 00 02 00 00 06 10 00 00 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 aa 17 2f 10
30: 00 00 00 00 90 00 00 00 00 00 00 00 00 01 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 e0 ff fb 00 00 00 00 00 00 00 00 00 00 00 00
60: 05 90 02 01 00 00 00 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 10 e0 42 00 00 80 00 00 00 00 00 00 41 30 79 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 9e 13 00 00 00 00 00 00 06 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 01 00 03 00 08 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00

在ARM64上(注意ECAM行(:

root@ampere:/boot# cat /proc/iomem|grep ECAM
23fff0000000-23ffffffffff : PCI ECAM
27fff0000000-27ffffffffff : PCI ECAM
2bfff0000000-2bffffffffff : PCI ECAM
2ffff0000000-2fffffffffff : PCI ECAM
3bfff0000000-3bffffffffff : PCI ECAM
3ffff0000000-3fffffffffff : PCI ECAM
63fff0000000-63ffffffffff : PCI ECAM
67fff0000000-67ffffffffff : PCI ECAM
6bfff0000000-6bffffffffff : PCI ECAM
6ffff0000000-6fffffffffff : PCI ECAM
7bfff0000000-7bffffffffff : PCI ECAM
7ffff0000000-7fffffffffff : PCI ECAM
root@ampere:/boot# lspci -s 0:0:0.0 -x
0000:00:00.0 Host bridge: Ampere Computing, LLC Device e100
00: ef 1d 00 e1 00 00 00 00 00 00 00 06 10 00 00 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 00 00 00 00
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@ampere:/boot# memtool md 0x23fff0000000
23fff0000000: e1101def 00000000 06000000 00000010                ................
23fff0000010: 00000000 00000000 00000000 00000000                ................
23fff0000020: 00000000 00000000 00000000 00000000                ................
23fff0000030: 00000000 00000000 00000000 00000000                ................
23fff0000040: 00000000 00000000 00000000 00000000                ................
23fff0000050: 00000000 00000000 00000000 00000000                ................
23fff0000060: 00000000 00000000 00000000 00000000                ................
23fff0000070: 00000000 00000000 00000000 00000000                ................
23fff0000080: 00000000 00000000 00000000 00000000                ................
23fff0000090: 00000000 00000000 00000000 00000000                ................
23fff00000a0: 00000000 00000000 00000000 00000000                ................
23fff00000b0: 00000000 00000000 00000000 00000000                ................
23fff00000c0: 00000000 00000000 00000000 00000000                ................
23fff00000d0: 00000000 00000000 00000000 00000000                ................
23fff00000e0: 00000000 00000000 00000000 00000000                ................
23fff00000f0: 00000000 00000000 00000000 00000000                ................

相关内容

  • 没有找到相关文章

最新更新