Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Nov 2022 18:36:30 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 54c65cbb2475 - stable/13 - ntb: Use uintmax_t casts and %j to print physical addresses.
Message-ID:  <202211111836.2ABIaUtv003672@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=54c65cbb2475f2d94fc94e7584b7cee5e8486d7f

commit 54c65cbb2475f2d94fc94e7584b7cee5e8486d7f
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-09-28 20:56:31 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-11 18:18:52 +0000

    ntb: Use uintmax_t casts and %j to print physical addresses.
    
    This fixes -Wint-to-pointer-cast errors with GCC when compiling on
    i386 where physical addresses are not the same size as pointers.
    
    Reviewed by:    mav, imp
    Differential Revision:  https://reviews.freebsd.org/D36751
    
    (cherry picked from commit 124e46735e07037afafbf0caa097faafb09c7329)
---
 sys/dev/ntb/ntb_hw/ntb_hw_amd.c   |  6 +++---
 sys/dev/ntb/ntb_hw/ntb_hw_intel.c | 14 ++++++++------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_amd.c b/sys/dev/ntb/ntb_hw/ntb_hw_amd.c
index 450a3a2fa2b8..fc77e39ae1a0 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw_amd.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw_amd.c
@@ -1112,10 +1112,10 @@ static void
 print_map_success(struct amd_ntb_softc *ntb, struct amd_ntb_pci_bar_info *bar,
     const char *kind)
 {
-	amd_ntb_printf(0, "Mapped BAR%d v:[%p-%p] p:[%p-%p] (0x%jx bytes) (%s)\n",
+	amd_ntb_printf(0, "Mapped BAR%d v:[%p-%p] p:[0x%jx-0x%jx] (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);
+	    (char *)bar->vbase + bar->size - 1, (uintmax_t)bar->pbase,
+	    (uintmax_t)(bar->pbase + bar->size - 1), (uintmax_t)bar->size, kind);
 }
 
 static void
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
index 2535f7a23290..e0abf927002d 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
@@ -925,10 +925,10 @@ print_map_success(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar,
 {
 
 	device_printf(ntb->device,
-	    "Mapped BAR%d v:[%p-%p] p:[%p-%p] (0x%jx bytes) (%s)\n",
+	    "Mapped BAR%d v:[%p-%p] p:[0x%jx-0x%jx] (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->pbase, (uintmax_t)(bar->pbase + bar->size - 1),
 	    (uintmax_t)bar->size, kind);
 }
 
@@ -1012,19 +1012,21 @@ map_memory_window_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar)
 	if (rc == 0) {
 		bar->map_mode = mapmode;
 		device_printf(ntb->device,
-		    "Marked BAR%d v:[%p-%p] p:[%p-%p] as "
+		    "Marked BAR%d v:[%p-%p] p:[0x%jx-0x%jx] as "
 		    "%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->pbase,
+		    (uintmax_t)(bar->pbase + bar->size - 1),
 		    intel_ntb_vm_memattr_to_str(mapmode));
 	} else
 		device_printf(ntb->device,
-		    "Unable to mark BAR%d v:[%p-%p] p:[%p-%p] as "
+		    "Unable to mark BAR%d v:[%p-%p] p:[0x%jx-0x%jx] as "
 		    "%s: %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),
+		    (uintmax_t)bar->pbase,
+		    (uintmax_t)(bar->pbase + bar->size - 1),
 		    intel_ntb_vm_memattr_to_str(mapmode), rc);
 		/* Proceed anyway */
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211111836.2ABIaUtv003672>