diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2016-02-20 01:32:58 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2016-02-20 01:32:58 +0000 |
commit | f8385663eeba2c10cd82a51c0a461a4f932458a3 (patch) | |
tree | 1d99680c416ab999716f7e3fb78956be8804e81f /sys/arm64 | |
parent | 7a33cbc5f75355b9aacc299db55706229c9da4af (diff) | |
download | FreeBSD-src-f8385663eeba2c10cd82a51c0a461a4f932458a3.zip FreeBSD-src-f8385663eeba2c10cd82a51c0a461a4f932458a3.tar.gz |
Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.
This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.
This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.
Discussed with: jhb
Suggested by: marcel
Diffstat (limited to 'sys/arm64')
-rw-r--r-- | sys/arm64/arm64/gic_fdt.c | 2 | ||||
-rw-r--r-- | sys/arm64/arm64/gic_v3_fdt.c | 3 | ||||
-rw-r--r-- | sys/arm64/arm64/nexus.c | 2 | ||||
-rw-r--r-- | sys/arm64/cavium/thunder_pcie.c | 2 | ||||
-rw-r--r-- | sys/arm64/cavium/thunder_pcie_fdt.c | 2 | ||||
-rw-r--r-- | sys/arm64/cavium/thunder_pcie_pem.c | 2 |
6 files changed, 7 insertions, 6 deletions
diff --git a/sys/arm64/arm64/gic_fdt.c b/sys/arm64/arm64/gic_fdt.c index 075f1d6..34d8009 100644 --- a/sys/arm64/arm64/gic_fdt.c +++ b/sys/arm64/arm64/gic_fdt.c @@ -211,7 +211,7 @@ arm_gic_fdt_alloc_resource(device_t bus, device_t child, int type, int *rid, * Request for the default allocation with a given rid: use resource * list stored in the local device info. */ - if ((start == 0UL) && (end == ~0UL)) { + if (RMAN_IS_DEFAULT_RANGE(start, end)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c index 6c8de49..e5d75c3 100644 --- a/sys/arm64/arm64/gic_v3_fdt.c +++ b/sys/arm64/arm64/gic_v3_fdt.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/kernel.h> #include <sys/module.h> +#include <sys/rman.h> #include <machine/resource.h> @@ -180,7 +181,7 @@ gic_v3_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid, struct resource_list_entry *rle; int ranges_len; - if ((start == 0UL) && (end == ~0UL)) { + if (RMAN_IS_DEFAULT_RANGE(start, end)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); if (type != SYS_RES_MEMORY) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index c56c7aa..94b9048 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -223,7 +223,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, * (ie. they aren't maintained by a child bus), then work out * the start/end values. */ - if ((start == 0UL) && (end == ~0UL) && (count == 1)) { + if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) return(NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); diff --git a/sys/arm64/cavium/thunder_pcie.c b/sys/arm64/cavium/thunder_pcie.c index ca2fd6f..b4ac43c 100644 --- a/sys/arm64/cavium/thunder_pcie.c +++ b/sys/arm64/cavium/thunder_pcie.c @@ -292,7 +292,7 @@ thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, type, rid, start, end, count, flags)); }; - if ((start == 0UL) && (end == ~0UL)) { + if (RMAN_IS_DEFAULT_RANGE(start, end)) { /* Read BAR manually to get resource address and size */ pci_read_bar(child, *rid, &map, &testval, NULL); diff --git a/sys/arm64/cavium/thunder_pcie_fdt.c b/sys/arm64/cavium/thunder_pcie_fdt.c index f1624f6..09b5660 100644 --- a/sys/arm64/cavium/thunder_pcie_fdt.c +++ b/sys/arm64/cavium/thunder_pcie_fdt.c @@ -283,7 +283,7 @@ thunder_pcie_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid, sc = device_get_softc(bus); - if ((start == 0UL) && (end == ~0UL)) { + if (RMAN_IS_DEFAULT_RANGE(start, end)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); if (type == SYS_RES_IOPORT) diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index a7138dc..0f1e6a3 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -435,7 +435,7 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid, end, count, flags)); }; - if ((start == 0UL) && (end == ~0UL)) { + if (RMAN_IS_DEFAULT_RANGE(start, end)) { device_printf(dev, "Cannot allocate resource with unspecified range\n"); goto fail; |