[SeaBIOS] [PATCH 5/7] kvmtool: uses mmio for legacy bar 0
Gerd Hoffmann
kraxel at redhat.com
Tue Jul 7 08:38:44 CEST 2015
Hmm. Doesn't match virtio spec.
But easy to check and handle.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
src/hw/virtio-pci.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index 6df5194..465deb9 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -267,9 +267,14 @@ void vp_init_simple(struct vp_device *vp, struct pci_device *pci)
dprintf(1, "pci dev %x:%x using legacy (0.9.5) virtio mode\n",
pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf));
vp->legacy.bar = 0;
- vp->legacy.addr = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0) &
- PCI_BASE_ADDRESS_IO_MASK;
- vp->legacy.is_io = 1;
+ addr = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0);
+ if (addr & PCI_BASE_ADDRESS_SPACE_IO) {
+ vp->legacy.addr = addr & PCI_BASE_ADDRESS_IO_MASK;
+ vp->legacy.is_io = 1;
+ } else {
+ vp->legacy.addr = addr & PCI_BASE_ADDRESS_MEM_MASK;
+ vp->legacy.is_io = 0;
+ }
}
vp_reset(vp);
--
1.8.3.1
More information about the SeaBIOS
mailing list