Page MenuHomeFreeBSD

D26915.id78714.diff
No OneTemporary

D26915.id78714.diff

Index: sys/dev/virtio/pci/virtio_pci.c
===================================================================
--- sys/dev/virtio/pci/virtio_pci.c
+++ sys/dev/virtio/pci/virtio_pci.c
@@ -67,6 +67,7 @@
struct vtpci_softc {
device_t vtpci_dev;
+ int vtpci_res_type;
struct resource *vtpci_res;
struct resource *vtpci_msix_res;
uint64_t vtpci_features;
@@ -287,9 +288,20 @@
rid = PCIR_BAR(0);
sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
RF_ACTIVE);
+ sc->vtpci_res_type = SYS_RES_IOPORT;
if (sc->vtpci_res == NULL) {
- device_printf(dev, "cannot map I/O space\n");
- return (ENXIO);
+ /*
+ * We should try harder as the common configuration structure is
+ * possible to be in memory space.
+ */
+ rid = PCIR_BAR(0);
+ sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+ RF_ACTIVE);
+ sc->vtpci_res_type = SYS_RES_MEMORY;
+ if (sc->vtpci_res == NULL) {
+ device_printf(dev, "cannot map I/O nor memory space\n");
+ return (ENXIO);
+ }
}
if (pci_find_cap(dev, PCIY_MSI, NULL) != 0)
@@ -347,7 +359,7 @@
}
if (sc->vtpci_res != NULL) {
- bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0),
+ bus_release_resource(dev, sc->vtpci_res_type, PCIR_BAR(0),
sc->vtpci_res);
sc->vtpci_res = NULL;
}

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 31, 12:58 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30617318
Default Alt Text
D26915.id78714.diff (1 KB)

Event Timeline