bus/pci: use Linux PCI sysfs to get PIO address
Currently virtio PMD assumes legacy device uses PIO bar.
There are three ways to get PIO (port-mapped I/O) address for virtio
legacy device.
1) under igb_uio
- get PIO address from uio/uio# sysfs attribute, for instance:
/sys/bus/pci/devices/0000:00:09.0/uio/uio0/portio/port0/start
2) under uio_pci_generic
- for X86, get PIO address from /proc/ioport
- for other ARCH, get PIO address from standard PCI sysfs attribute,
for instance: /sys/bus/pci/devices/0000:00:09.0/resource
Actually, "port0/start" in igb_uio and "resource" point to exactly the
same thing, i.e, pci_dev->resource[0] in kernel source code.
This patch refactors these messy things, and uses standard PCI sysfs
attribute "resource".
Signed-off-by: Huawei Xie <huawei.xhw@alibaba-inc.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>