diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2016-03-18 01:28:41 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2016-03-18 01:28:41 +0000 |
commit | 720f47c9edd51268b4c29ce82e0436209cd8aa23 (patch) | |
tree | 79d2db0783ae236486e47ff49d1e85214325a9e0 /sys/mips | |
parent | af520aec51ed6695cde23fdbf339ecb995ac52ab (diff) | |
download | FreeBSD-src-720f47c9edd51268b4c29ce82e0436209cd8aa23.zip FreeBSD-src-720f47c9edd51268b4c29ce82e0436209cd8aa23.tar.gz |
Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.
On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit. This extends rman's resources to uintmax_t. With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).
Why uintmax_t and not something machine dependent, or uint64_t? Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures. 64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead. That being said, uintmax_t was chosen for source
clarity. If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros. Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.
Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)
Tested PAE and devinfo on virtualbox (live CD)
Special thanks to bz for his testing on ARM.
Reviewed By: bz, jhb (previous)
Relnotes: Yes
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544
Diffstat (limited to 'sys/mips')
-rw-r--r-- | sys/mips/atheros/apb.c | 2 | ||||
-rw-r--r-- | sys/mips/mips/nexus.c | 4 | ||||
-rw-r--r-- | sys/mips/nlm/xlp_pci.c | 2 | ||||
-rw-r--r-- | sys/mips/nlm/xlp_simplebus.c | 4 | ||||
-rw-r--r-- | sys/mips/rmi/iodi.c | 6 | ||||
-rw-r--r-- | sys/mips/rmi/xlr_pci.c | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/sys/mips/atheros/apb.c b/sys/mips/atheros/apb.c index 8d230a7..56475b7 100644 --- a/sys/mips/atheros/apb.c +++ b/sys/mips/atheros/apb.c @@ -178,7 +178,7 @@ apb_alloc_resource(device_t bus, device_t child, int type, int *rid, passthrough = (device_get_parent(child) != bus); rle = NULL; - dprintf("%s: entry (%p, %p, %d, %d, %p, %p, %ld, %d)\n", + dprintf("%s: entry (%p, %p, %d, %d, %p, %p, %jd, %d)\n", __func__, bus, child, type, *rid, (void *)(intptr_t)start, (void *)(intptr_t)end, count, flags); diff --git a/sys/mips/mips/nexus.c b/sys/mips/mips/nexus.c index 617d842..5aba92d 100644 --- a/sys/mips/mips/nexus.c +++ b/sys/mips/mips/nexus.c @@ -275,7 +275,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, struct rman *rm; int isdefault, needactivate, passthrough; - dprintf("%s: entry (%p, %p, %d, %p, %p, %p, %ld, %d)\n", + dprintf("%s: entry (%p, %p, %d, %p, %p, %p, %jd, %d)\n", __func__, bus, child, type, rid, (void *)(intptr_t)start, (void *)(intptr_t)end, count, flags); dprintf("%s: requested rid is %d\n", __func__, *rid); @@ -350,7 +350,7 @@ nexus_set_resource(device_t dev, device_t child, int type, int rid, struct resource_list *rl = &ndev->nx_resources; struct resource_list_entry *rle; - dprintf("%s: entry (%p, %p, %d, %d, %p, %ld)\n", + dprintf("%s: entry (%p, %p, %d, %d, %p, %jd)\n", __func__, dev, child, type, rid, (void *)(intptr_t)start, count); rle = resource_list_add(rl, type, rid, start, start + count - 1, diff --git a/sys/mips/nlm/xlp_pci.c b/sys/mips/nlm/xlp_pci.c index fee23cd..863c6aa 100644 --- a/sys/mips/nlm/xlp_pci.c +++ b/sys/mips/nlm/xlp_pci.c @@ -433,7 +433,7 @@ mips_platform_pcib_setup_intr(device_t dev, device_t child, if (error) return error; if (rman_get_start(irq) != rman_get_end(irq)) { - device_printf(dev, "Interrupt allocation %lu != %lu\n", + device_printf(dev, "Interrupt allocation %ju != %ju\n", rman_get_start(irq), rman_get_end(irq)); return (EINVAL); } diff --git a/sys/mips/nlm/xlp_simplebus.c b/sys/mips/nlm/xlp_simplebus.c index 3ffb19a..413775b 100644 --- a/sys/mips/nlm/xlp_simplebus.c +++ b/sys/mips/nlm/xlp_simplebus.c @@ -209,7 +209,7 @@ xlp_simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, if (j == sc->nranges && sc->nranges != 0) { if (bootverbose) device_printf(bus, "Could not map resource " - "%#lx-%#lx\n", start, end); + "%#jx-%#jx\n", start, end); return (NULL); } } @@ -235,7 +235,7 @@ xlp_simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, } else { if (bootverbose) device_printf(bus, "Invalid MEM range" - "%#lx-%#lx\n", start, end); + "%#jx-%#jx\n", start, end); return (NULL); } break; diff --git a/sys/mips/rmi/iodi.c b/sys/mips/rmi/iodi.c index da0405d..d1f74e1 100644 --- a/sys/mips/rmi/iodi.c +++ b/sys/mips/rmi/iodi.c @@ -134,17 +134,17 @@ iodi_alloc_resource(device_t bus, device_t child, int type, int *rid, #ifdef DEBUG switch (type) { case SYS_RES_IRQ: - device_printf(bus, "IRQ resource - for %s %lx-%lx\n", + device_printf(bus, "IRQ resource - for %s %jx-%jx\n", device_get_nameunit(child), start, end); break; case SYS_RES_IOPORT: - device_printf(bus, "IOPORT resource - for %s %lx-%lx\n", + device_printf(bus, "IOPORT resource - for %s %jx-%jx\n", device_get_nameunit(child), start, end); break; case SYS_RES_MEMORY: - device_printf(bus, "MEMORY resource - for %s %lx-%lx\n", + device_printf(bus, "MEMORY resource - for %s %jx-%jx\n", device_get_nameunit(child), start, end); break; } diff --git a/sys/mips/rmi/xlr_pci.c b/sys/mips/rmi/xlr_pci.c index 194213b..53581a6 100644 --- a/sys/mips/rmi/xlr_pci.c +++ b/sys/mips/rmi/xlr_pci.c @@ -464,7 +464,7 @@ mips_platform_pci_setup_intr(device_t dev, device_t child, if (error) return error; if (rman_get_start(irq) != rman_get_end(irq)) { - device_printf(dev, "Interrupt allocation %lu != %lu\n", + device_printf(dev, "Interrupt allocation %ju != %ju\n", rman_get_start(irq), rman_get_end(irq)); return (EINVAL); } |