virtio-pci calls pci_enable_{io,mem}bar with the bar number,
but the functions expect the bar base register offset.

Reported-by: Igor Mammedov <imamm...@redhat.com>
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 src/hw/virtio-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index 8efc826..e5c2c33 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -449,7 +449,7 @@ void vp_init_simple(struct vp_device *vp, struct pci_device 
*pci)
             switch (vp_cap->mode) {
             case VP_ACCESS_IO:
             {
-                u32 addr = pci_enable_iobar(pci, vp_cap->bar);
+                u32 addr = pci_enable_iobar(pci, base);
                 if (!addr)
                     return;
                 vp_cap->ioaddr = addr + offset;
@@ -458,7 +458,7 @@ void vp_init_simple(struct vp_device *vp, struct pci_device 
*pci)
             }
             case VP_ACCESS_MMIO:
             {
-                void *addr = pci_enable_membar(pci, vp_cap->bar);
+                void *addr = pci_enable_membar(pci, base);
                 if (!addr)
                     return;
                 vp_cap->memaddr = addr + offset;
-- 
1.8.3.1


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://www.coreboot.org/mailman/listinfo/seabios

Reply via email to