]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
NTB: Don't abort if setting a MW write-combine fails
authorcem <cem@FreeBSD.org>
Tue, 20 Oct 2015 19:20:06 +0000 (19:20 +0000)
committercem <cem@FreeBSD.org>
Tue, 20 Oct 2015 19:20:06 +0000 (19:20 +0000)
Also log BAR mapping results more verbosely.

Sponsored by: EMC / Isilon Storage Division

sys/dev/ntb/ntb_hw/ntb_hw.c

index a4020002be4363229294ca39ee30e2b6a7b7b090..4fe1f600cec17d6f6858298275abca6c40bae524 100644 (file)
@@ -265,7 +265,8 @@ static inline bool bar_is_64bit(struct ntb_softc *, enum ntb_bar);
 static inline void bar_get_xlat_params(struct ntb_softc *, enum ntb_bar,
     uint32_t *base, uint32_t *xlat, uint32_t *lmt);
 static int ntb_map_pci_bars(struct ntb_softc *ntb);
-static void print_map_success(struct ntb_softc *, struct ntb_pci_bar_info *);
+static void print_map_success(struct ntb_softc *, struct ntb_pci_bar_info *,
+    const char *);
 static int map_mmr_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar);
 static int map_memory_window_bar(struct ntb_softc *ntb,
     struct ntb_pci_bar_info *bar);
@@ -676,11 +677,16 @@ out:
 }
 
 static void
-print_map_success(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar)
+print_map_success(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar,
+    const char *kind)
 {
 
-       device_printf(ntb->device, "Bar size = %lx, v %p, p %p\n",
-           bar->size, bar->vbase, (void *)(bar->pbase));
+       device_printf(ntb->device,
+           "Mapped BAR%d v:[%p-%p] p:[%p-%p] (0x%jx bytes) (%s)\n",
+           PCI_RID2BAR(bar->pci_resource_id), bar->vbase,
+           (char *)bar->vbase + bar->size - 1,
+           (void *)bar->pbase, (void *)(bar->pbase + bar->size - 1),
+           (uintmax_t)bar->size, kind);
 }
 
 static int
@@ -693,7 +699,7 @@ map_mmr_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar)
                return (ENXIO);
 
        save_bar_parameters(bar);
-       print_map_success(ntb, bar);
+       print_map_success(ntb, bar, "mmr");
        return (0);
 }
 
@@ -749,12 +755,23 @@ map_memory_window_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar)
        /* Mark bar region as write combining to improve performance. */
        rc = pmap_change_attr((vm_offset_t)bar->vbase, bar->size,
            VM_MEMATTR_WRITE_COMBINING);
-       if (rc != 0) {
+       print_map_success(ntb, bar, "mw");
+       if (rc == 0)
                device_printf(ntb->device,
-                   "unable to mark bar as WRITE_COMBINING\n");
-               return (rc);
-       }
-       print_map_success(ntb, bar);
+                   "Marked BAR%d v:[%p-%p] p:[%p-%p] as "
+                   "WRITE_COMBINING.\n",
+                   PCI_RID2BAR(bar->pci_resource_id), bar->vbase,
+                   (char *)bar->vbase + bar->size - 1,
+                   (void *)bar->pbase, (void *)(bar->pbase + bar->size - 1));
+       else
+               device_printf(ntb->device,
+                   "Unable to mark BAR%d v:[%p-%p] p:[%p-%p] as "
+                   "WRITE_COMBINING: %d\n",
+                   PCI_RID2BAR(bar->pci_resource_id), bar->vbase,
+                   (char *)bar->vbase + bar->size - 1,
+                   (void *)bar->pbase, (void *)(bar->pbase + bar->size - 1),
+                   rc);
+               /* Proceed anyway */
        return (0);
 }