Linux 64位条形图编程

Linux 64位条形图编程,linux,pci-e,Linux,Pci E,PCI网桥支持32/64优先级/无优先级: pci_bus 0000:00: root bus resource [bus 00-ff] pci_bus 0000:00: root bus resource [io 0x0000-0xffff] pci_bus 0000:00: root bus resource [mem 0x1000000000-0x10ffffffff] (bus address [0x00000000-0xffffffff]) pci_bus 0000:00: roo

PCI网桥支持32/64优先级/无优先级:

pci_bus 0000:00: root bus resource [bus 00-ff]
pci_bus 0000:00: root bus resource [io  0x0000-0xffff] 
pci_bus 0000:00: root bus resource [mem 0x1000000000-0x10ffffffff] (bus address [0x00000000-0xffffffff])
pci_bus 0000:00: root bus resource [mem 0x1100000000-0x11ffffffff pref] (bus address [0x00000000-0xffffffff])
pci_bus 0000:00: root bus resource [mem 0x2000000000-0x2fffffffff] (bus address [0x00000000-0xfffffffff])
pci_bus 0000:00: root bus resource [mem 0x3000000000-0x3fffffffff pref] (bus  address [0x00000000-0xfffffffff])
用2个条扫描端点:

pci 0000:01:00.0: BAR 2: assigned [mem 0x2100000000-0x211fffffff 64bit pref]
pci 0000:01:00.0: BAR 0: assigned [mem 0x1000000000-0x100007ffff]
桥显示窗口:

pci 0000:00:00.0: PCI bridge to [bus 01]
pci 0000:00:00.0:   bridge window [mem 0x1000000000-0x10000fffff]
pci 0000:00:00.0:   bridge window [mem 0x2100000000-0x211fffffff 64bit pref]
端点汇总了这些条:

endpoint: BAR 0 addr = 0x1000000000, size = 524287
endpoint: BAR 1 addr = 0x2100000000, size = 536870911
BAR1的上32位将被编程为什么?我期望0x21,但找到0x1

这是因为pcibios_总线到_资源/pcibios_资源到_总线。 它标识了3个窗偏移:

window->res->start = 1000000000 window->offset = 1000000000 window->res->end = 10FFFFFFFF
window->res->start = 1100000000 window->offset = 1100000000 window->res->end = 11FFFFFFFF
window->res->start = 2000000000 window->offset = 2000000000 window->res->end = 2FFFFFFFFF
它在显示上述地址时添加偏移量,但在编程条时减去偏移量 在端点中注册。所以0x210000000变为0x100000000

对于64位地址和32位条形图来说,这可能是有意义的,但为什么对于64位条形图来说是正确的呢?

根据这一点(取自问题):

内存地址0x20'0000'0000对应于总线地址0

因此,如果要使用内存地址0x21'0000'0000访问设备中的条,则需要将其编程为0x1'0000'0000

类似地,内存地址0x10'0000'0000对应于总线地址0。因此,设备中的条被编程为0,以便使用内存地址0x10'0000'0000访问

    pci_bus 0000:00: root bus resource [mem 0x1000000000-0x10ffffffff] (bus address [0x00000000-0xffffffff])
    pci_bus 0000:00: root bus resource [mem 0x1100000000-0x11ffffffff pref] (bus address [0x00000000-0xffffffff])
    pci_bus 0000:00: root bus resource [mem 0x2000000000-0x2fffffffff] (bus address [0x00000000-0xfffffffff])
    pci_bus 0000:00: root bus resource [mem 0x3000000000-0x3fffffffff pref] (bus  address [0x00000000-0xfffffffff])