pci: Do a dummy config write to devices to establish bus number
pci: Do a dummy config write to devices to establish bus number

On PCI Express, devices need to know their own bus number in order
to provide the correct source identification (aka RID) in upstream
packets they might send, such as error messages or DMAs.

However while devices know (and hard wire) their own device and
function number, they know nothing about bus numbers by default, those
are decoded by bridges for routing. All they know is that if their
parent bridge sends a "type 0" configuration access, they should decode
it provided the device and function numbers match.

The PCIe spec thus defines that when a device receive such a configuration
access and it's a write, it should "capture" the bus number in the source
field of the packet, and re-use as the originator bus number of all
subsequent outgoing requests.

In order to ensure that a device has this bus number firmly established
before it's likely to send error packets upstream, we should thus do a
dummy configuration write to it as soon as possible after probing.

Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>
Reviewed-by: Gavin Shan <0398910e4f4970259b451f0f9d0686cc5e961b81@linux.vnet.ibm.com>
[ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com: fix Evolution broken patch, write vdid rather than &vdid as per Gavin suggestion]
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com>

open-power/skiboot,qemu/skiboot,qemu/skiboot,shenki/skiboot,open-power/skiboot,shenki/skiboot,qemu/skiboot,legoater/skiboot,qemu/skiboot,shenki/skiboot,stewart-ibm/skiboot,legoater/skiboot,open-power/skiboot,legoater/skiboot,shenki/skiboot,stewart-ibm/skiboot,qemu/skiboot,shenki/skiboot,open-power/skiboot,mikey/skiboot,open-power/skiboot,legoater/skiboot,stewart-ibm/skiboot,mikey/skiboot,legoater/skiboot,mikey/skiboot