diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-09-28 20:56:31 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2022-09-28 20:56:31 +0000 |
commit | 124e46735e07037afafbf0caa097faafb09c7329 (patch) | |
tree | 19b9dbc382ea0e023821a98f117b337e3869656f /sys/dev | |
parent | 9bbed3f615f15017ea53a86721686c790d8d8b68 (diff) | |
download | src-124e46735e07037afafbf0caa097faafb09c7329.tar.gz src-124e46735e07037afafbf0caa097faafb09c7329.zip |
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
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ntb/ntb_hw/ntb_hw_amd.c | 6 | ||||
-rw-r--r-- | 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 94cfba2bfe72..eef4f7ca463a 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 774bb14fea0f..a6c71935665b 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); |