From owner-svn-src-all@freebsd.org Tue Oct 20 19:20:07 2015 Return-Path: <owner-svn-src-all@freebsd.org> Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DBA8A18628; Tue, 20 Oct 2015 19:20:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A1297E9; Tue, 20 Oct 2015 19:20:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9KJK6k4037701; Tue, 20 Oct 2015 19:20:06 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9KJK6rj037700; Tue, 20 Oct 2015 19:20:06 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201510201920.t9KJK6rj037700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" <cem@FreeBSD.org> Date: Tue, 20 Oct 2015 19:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289647 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" <svn-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/> List-Post: <mailto:svn-src-all@freebsd.org> List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 20 Oct 2015 19:20:07 -0000 Author: cem Date: Tue Oct 20 19:20:06 2015 New Revision: 289647 URL: https://svnweb.freebsd.org/changeset/base/289647 Log: NTB: Don't abort if setting a MW write-combine fails Also log BAR mapping results more verbosely. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Oct 20 19:19:57 2015 (r289646) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.c Tue Oct 20 19:20:06 2015 (r289647) @@ -265,7 +265,8 @@ static inline bool bar_is_64bit(struct n 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, struc 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 * /* 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); }