summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorjhibbits <jhibbits@FreeBSD.org>2016-03-18 01:28:41 +0000
committerjhibbits <jhibbits@FreeBSD.org>2016-03-18 01:28:41 +0000
commit720f47c9edd51268b4c29ce82e0436209cd8aa23 (patch)
tree79d2db0783ae236486e47ff49d1e85214325a9e0 /sys/powerpc
parentaf520aec51ed6695cde23fdbf339ecb995ac52ab (diff)
downloadFreeBSD-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/powerpc')
-rw-r--r--sys/powerpc/mpc85xx/lbc.c8
-rw-r--r--sys/powerpc/ofw/ofw_pci.c8
-rw-r--r--sys/powerpc/powermac/uninorth.c2
-rw-r--r--sys/powerpc/powerpc/nexus.c2
4 files changed, 10 insertions, 10 deletions
diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c
index a94a841..37e3ed0 100644
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -718,8 +718,8 @@ lbc_alloc_resource(device_t bus, device_t child, int type, int *rid,
res = rman_reserve_resource(rm, start, end, count, flags, child);
if (res == NULL) {
- device_printf(bus, "failed to reserve resource %#lx - %#lx "
- "(%#lx)\n", start, end, count);
+ device_printf(bus, "failed to reserve resource %#jx - %#jx "
+ "(%#jx)\n", start, end, count);
return (NULL);
}
@@ -749,8 +749,8 @@ lbc_print_child(device_t dev, device_t child)
rv = 0;
rv += bus_print_child_header(dev, child);
- rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx");
- rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
+ rv += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx");
+ rv += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd");
rv += bus_print_child_footer(dev, child);
return (rv);
diff --git a/sys/powerpc/ofw/ofw_pci.c b/sys/powerpc/ofw/ofw_pci.c
index 0ca5bc0..20aa81f 100644
--- a/sys/powerpc/ofw/ofw_pci.c
+++ b/sys/powerpc/ofw/ofw_pci.c
@@ -384,10 +384,10 @@ ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid,
}
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
struct ofw_pci_range *rp;
- vm_offset_t start;
+ vm_paddr_t start;
int space;
- start = (vm_offset_t)rman_get_start(res);
+ start = (vm_paddr_t)rman_get_start(res);
/*
* Map this through the ranges list
@@ -416,8 +416,8 @@ ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid,
}
if (bootverbose)
- printf("ofw_pci mapdev: start %zx, len %ld\n", start,
- rman_get_size(res));
+ printf("ofw_pci mapdev: start %jx, len %jd\n",
+ (rman_res_t)start, rman_get_size(res));
p = pmap_mapdev(start, (vm_size_t)rman_get_size(res));
if (p == NULL)
diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c
index e34c9d8..7cf490e 100644
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -591,7 +591,7 @@ unin_chip_activate_resource(device_t bus, device_t child, int type, int rid,
start = (vm_offset_t) rman_get_start(res);
if (bootverbose)
- printf("unin mapdev: start %zx, len %ld\n", start,
+ printf("unin mapdev: start %zx, len %jd\n", start,
rman_get_size(res));
p = pmap_mapdev(start, (vm_size_t) rman_get_size(res));
diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c
index 1ad118c..f5a3da8 100644
--- a/sys/powerpc/powerpc/nexus.c
+++ b/sys/powerpc/powerpc/nexus.c
@@ -203,7 +203,7 @@ nexus_activate_resource(device_t bus __unused, device_t child __unused,
start = (vm_paddr_t) rman_get_start(r);
if (bootverbose)
- printf("nexus mapdev: start %jx, len %ld\n",
+ printf("nexus mapdev: start %jx, len %jd\n",
(uintmax_t)start, rman_get_size(r));
p = pmap_mapdev(start, (vm_size_t) rman_get_size(r));
OpenPOWER on IntegriCloud