On Tue, Dec 22, 2009 at 7:20 PM, Tarl Neustaedter Tarl.Neustaedter@sun.com wrote:
Tarl Neustaedter wrote:
[...]
Right, I think I understand now. So the obvious question to ask now is how is PCI configuration space mapped on Sparc64? I can see that on x86 it's mapped to an I/O port at 0xCF8 but I can't seem to find how this is implemented on Sparc64. Anyone have any idea?
PCI spaces are each mapped in separately in physical spaces on SPARC. [...]
On a sun4u system (Tazmo, SUNW,Ultra-4), the first PCI root complex is a Psycho (Sun's first PCI bus chip) and has spaces at:
QEMU is emulating a Sabre/Simba based system.
Config: 000001fe.01000000, length 00800000. IO: 000001fe.02010000 length 00010000. mem32: 000001ff.80000000 length 80000000. mem64: 000001ff.80000000 length 80000000
There the values are (from the US-IIi manual) Config: 000001fe.01000000, length 00800000? IO: 000001fe.02000000 length 00100000 mem32: 000001ff.00000000 length f0000000 (4G - PROM) mem64: 000001ff.80000000 length f0000000 (I think)
This can be derived from the "Ranges" property in the PCI node, attached below. Note that Psycho did not implement mem64 separately, so the mem64 space simply points to mem32 space. And it only has 31 bits of addressability - I recall the other half of the mem32 space is used for DMA, so thus not mappable as registers.
The config space is addressed precisely as defined by the PCI bindings "phys.hi" definition. That means it's composed of:
phys.hi: xxxxxxxx bbbbbbbb dddddfff rrrrrrrr
Where xxxx is not part of the addressing in above address space, bbbbbbbb is eight bits of bus number, ddddd is five bits of device number, fff is three bits of function number and rrrrrrrr is eight bits of register offset addressing (sorry I got it wrong on an earlier email, I was thinking of some pci-e stuff).
Same as Sabre.
PCI node as shown by Solaris "prtconf -pv":
Node 0xf006ebb8 slot-names: 0000001e.4d6f7468.6572626f.61726400.4d6f7468.6572626f.61726 400.4d6f7468.6572626f.61726400.50434920.736c6f74.20313000 available: 82000000.00000000.00017000.00000000.7ffe9000.81000000.000000 00.00000900.00000000.0000f700 bus-range: 00000000.00000000 version#: 00000004 implementation#: 00000000 address: fffb4000.fffb2000.fffa4000 #upa-interrupt-proxies: 00000002 clock-frequency: 01f78a40 upa-portid: 0000001f interrupts: 000007f1.000007ee.000007ef.000007e5.000007e8.000007f2 ranges: 00000000.00000000.00000000.000001fe.01000000.00000000.00800000. 01000000.00000000.00000000.000001fe.02010000.00000000.00010000.02000000.00000000 .00000000.000001ff.80000000.00000000.80000000.03000000.00000000.00000000.000001f f.80000000.00000000.80000000 reg: 000001fe.00004000.00000000.00002000.000001fe.01000000.00000000.000 00100.000001fe.00000000.00000000.0000d000 no-probe-list: '0' latency-timer: 00000040 model: 'SUNW,psycho' compatible: 'pci108e,8000' + 'pciclass,060000' thermal-interrupt: bus-parity-generated: #size-cells: 00000002 #address-cells: 00000003 device_type: 'pci' name: 'pci'
This one is from "SUNW,Ultra-5_10":
Node 0xf005f1e0 bus-range: 00000000.00000002 available: 82000000.00000000.00001000.00000000.fffff000.81000000.000000 00.00000400.00000000.00fffc00.00006176.61696c61 virtual-dma: c0000000.20000000 #virtual-dma-size-cells: 00000001 #virtual-dma-addr-cells: 00000001 latency-timer: address: fffc4000.fffc2000 button-interrupt: no-streaming-cache: clock-frequency: 03ef1480 upa-portid: 0000001f 66mhz-capable: interrupts: 000007f0.000007ee.000007ef.000007e5 ranges: 00000000.00000000.00000000.000001fe.01000000.00000000.01000000. 01000000.00000000.00000000.000001fe.02000000.00000000.01000000.02000000.00000000 .00000000.000001ff.00000000.00000001.00000000.03000000.00000000.00000000.000001f f.00000000.00000001.00000000 reg: 000001fe.00000000.00000000.00010000.000001fe.01000000.00000000.000 00100 model: 'SUNW,sabre' compatible: 70636931.3038652c.61303030.00706369 bus-parity-generated: #size-cells: '00000002' #address-cells: '00000003' device_type: 'pci' name: 'pci'
Node 0xf005f9d4 bus-range: 00000001.00000001 scsi-initiator-id: 00000007 compatible: 70636931.3038652c.35303030.00706369 66mhz-capable: fast-back-to-back: devsel-speed: 00000001 class-code: 00060400 revision-id: 00000011 device-id: 00005000 vendor-id: 0000108e interrupt-map: 00010800.00000000.00000000.00000001.f005f1e0.0000002 1.00011000.00000000.00000000.00000001.f005f1e0.0000000f.00011800.00000000.000000 00.00000001.f005f1e0.00000020 interrupt-map-mask: 00fff800.00000000.00000000.00000007 #interrupt-cells: 00000001 slot-names: 00000000 no-probe-list: '0' clock-frequency: 01f78a40 model: 'SUNW,simba' #address-cells: 00000003 #size-cells: 00000002 reg: 00000900.00000000.00000000.00000000.00000000 device_type: 'pci' name: 'pci'