版权声明:转载请关注我的公众号-青儿创客基地 https://blog.csdn.net/Zhu_Zhu_2009/article/details/88930687
软件架构
PCIe总线架构,
PCI内存映射配置空间,
读取映射空间,
root@zynqmp:~# modprobe pcie_ep pcie_ep_vid=0x10b5 pcie_ep_did=0x8724
root@zynqmp:~# lspci -k -nn
00:00.0 PCI bridge [0604]: Xilinx Corporation Device [10ee:9128]
01:00.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA [10b5:8724] (rev ca)
Kernel driver in use: pcie_ep
02:00.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA [10b5:8724] (rev ca)
Kernel driver in use: pcie_ep
02:01.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA [10b5:8724] (rev ca)
Kernel driver in use: pcie_ep
02:02.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA [10b5:8724] (rev ca)
Kernel driver in use: pcie_ep
02:03.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA [10b5:8724] (rev ca)
Kernel driver in use: pcie_ep
02:08.0 PCI bridge [0604]: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA [10b5:8724] (rev ca)
Kernel driver in use: pcie_ep
03:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961 [144d:a804]
Subsystem: Samsung Electronics Co Ltd Device [144d:a801]
Kernel driver in use: nvme
Kernel modules: nvme
04:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961 [144d:a804]
Subsystem: Samsung Electronics Co Ltd Device [144d:a801]
Kernel driver in use: nvme
Kernel modules: nvme
05:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961 [144d:a804]
Subsystem: Samsung Electronics Co Ltd Device [144d:a801]
Kernel driver in use: nvme
Kernel modules: nvme
06:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961 [144d:a804]
Subsystem: Samsung Electronics Co Ltd Device [144d:a801]
Kernel driver in use: nvme
Kernel modules: nvme
root@zynqmp:~# lspci -v
...
01:00.0 PCI bridge: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA (rev ca) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 64
Memory at a0f00000 (32-bit, non-prefetchable) [size=256K]
Bus: primary=01, secondary=02, subordinate=07, sec-latency=0
I/O behind bridge: None
Memory behind bridge: a0700000-a0efffff [size=8M]
Prefetchable memory behind bridge: 00000000a0000000-00000000a05fffff [size=6M]
Capabilities: [40] Power Management version 3
Capabilities: [48] MSI: Enable+ Count=1/8 Maskable+ 64bit+
Capabilities: [68] Express Upstream Port, MSI 00
Capabilities: [a4] Subsystem: PLX Technology, Inc. PEX 8724 24-Lane, 6-Port PCI Express Gen 3 (8 GT/s) Switch, 19 x 19mm FCBGA
Capabilities: [100] Device Serial Number ca-87-00-10-b5-df-0e-00
Capabilities: [fb4] Advanced Error Reporting
Capabilities: [138] Power Budgeting <?>
Capabilities: [10c] #19
Capabilities: [148] Virtual Channel
Capabilities: [e00] #12
Capabilities: [b00] Latency Tolerance Reporting
Capabilities: [b70] Vendor Specific Information: ID=0001 Rev=0 Len=010 <?>
Kernel driver in use: pcie_ep
...
根据手册,我们选择上行端口256k的bar来读取,这里Port 0不是上行端口,读取Port 0的配置空间,
root@zynqmp:~# memtool -32 0xa0f00000 0x40
Reading 0x40 count starting at address 0xA0F00000
0xA0F00000: 872410B5 00100406 060400CA 00010000
0xA0F00010: 00000000 00000000 00030302 000001F1
0xA0F00020: A090A070 A011A001 00000000 00000000
0xA0F00030: 00000000 00000040 00000000 0000012C
0xA0F00040: C8034801 00000008 01876805 6CD11000
0xA0F00050: 00000000 00000011 000000FE 00000000
0xA0F00060: 00000000 00000000 0162A410 00008002
0xA0F00070: 00010810 00796843 20410000 00000CDF
0xA0F00080: 016007C0 00000000 00000000 00040860
0xA0F00090: 00000000 0000010E 00270003 00000000
0xA0F000A0: 00000000 0000000D 872410B5 00000000
0xA0F000B0: 00000000 00000000 00000000 00000000
0xA0F000C0: 00000000 00000000 00000000 00000000
0xA0F000D0: 00000000 00000000 00000000 00000000
0xA0F000E0: 00000000 00000000 00000000 00000000
0xA0F000F0: 00000000 00000000 00000000 00000000
硬件架构
4.4节Hardware Architecture,PEX8724包含两个Station,Station 0对应Port 0 ~ Port 3,Station 1对应Port 8 ~ Port 10,其中Port 8是软件虚拟的,
端口配置
芯片复位
I2C
寄存器访问方法,
写命令格式,
读命令格式稍有不同,Command字段为100b,写数据流程,
start > addr > cmd > data > stop
读数据流程为,
start > addr > cmd > stop > start > addr > data > stop
Read Pacing
Read Pacing的控制在Port 0和Port 8上,对应Station 0和Station 1,地址1D0,读命令为0x4,0x0,0x3c,0xd0,
root@zynqmp:~# memtool -32 0xa0f001d0 4
Reading 0x4 count starting at address 0xA0F001D0
0xA0F001D0: 1000000F 06000800 03000400 00000002
root@zynqmp:~# memtool -32 0xa0f081d0 4
Reading 0x4 count starting at address 0xA0F081D0
0xA0F081D0: 1000000F 06000800 03000400 00000802