svn commit: r295832 - in head/sys: arm/at91 arm/cavium/cns11xx arm/mv arm64/arm64 arm64/cavium dev/acpica dev/eisa dev/fdt dev/gpio dev/mca dev/ofw dev/pccard dev/siba dev/vnic kern mips/adm5120 mi...
Justin Hibbits
jhibbits at FreeBSD.org
Sat Feb 20 01:33:04 UTC 2016
Author: jhibbits
Date: Sat Feb 20 01:32:58 2016
New Revision: 295832
URL: https://svnweb.freebsd.org/changeset/base/295832
Log:
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
Modified:
head/sys/arm/at91/at91.c
head/sys/arm/at91/at91_pinctrl.c
head/sys/arm/cavium/cns11xx/econa.c
head/sys/arm/mv/mv_localbus.c
head/sys/arm/mv/mv_pci.c
head/sys/arm64/arm64/gic_fdt.c
head/sys/arm64/arm64/gic_v3_fdt.c
head/sys/arm64/arm64/nexus.c
head/sys/arm64/cavium/thunder_pcie.c
head/sys/arm64/cavium/thunder_pcie_fdt.c
head/sys/arm64/cavium/thunder_pcie_pem.c
head/sys/dev/acpica/acpi.c
head/sys/dev/eisa/eisaconf.c
head/sys/dev/fdt/simplebus.c
head/sys/dev/gpio/gpiobus.c
head/sys/dev/mca/mca_bus.c
head/sys/dev/ofw/ofwbus.c
head/sys/dev/pccard/pccard.c
head/sys/dev/siba/siba.c
head/sys/dev/vnic/mrml_bridge.c
head/sys/kern/subr_bus.c
head/sys/mips/adm5120/obio.c
head/sys/mips/alchemy/obio.c
head/sys/mips/atheros/apb.c
head/sys/mips/beri/beri_simplebus.c
head/sys/mips/idt/obio.c
head/sys/mips/mips/nexus.c
head/sys/mips/nlm/xlp_simplebus.c
head/sys/mips/rt305x/obio.c
head/sys/mips/sibyte/sb_zbbus.c
head/sys/powerpc/mpc85xx/isa.c
head/sys/riscv/riscv/nexus.c
head/sys/sparc64/central/central.c
head/sys/sparc64/ebus/ebus.c
head/sys/sparc64/fhc/fhc.c
head/sys/sparc64/isa/isa.c
head/sys/sparc64/pci/apb.c
head/sys/sparc64/sbus/sbus.c
head/sys/sparc64/sparc64/nexus.c
head/sys/sparc64/sparc64/upa.c
head/sys/sys/rman.h
head/sys/x86/isa/isa.c
head/sys/x86/x86/nexus.c
Modified: head/sys/arm/at91/at91.c
==============================================================================
--- head/sys/arm/at91/at91.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm/at91/at91.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -164,7 +164,7 @@ at91_alloc_resource(device_t dev, device
return (NULL);
if (rle->res)
panic("Resource rid %d type %d already in use", *rid, type);
- if (start == 0UL && end == ~0UL) {
+ if (RMAN_IS_DEFAULT_RANGE(start, end)) {
start = rle->start;
count = ulmax(count, rle->count);
end = ulmax(rle->end, start + count - 1);
Modified: head/sys/arm/at91/at91_pinctrl.c
==============================================================================
--- head/sys/arm/at91/at91_pinctrl.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm/at91/at91_pinctrl.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -280,7 +280,7 @@ pinctrl_alloc_resource(device_t bus, dev
* 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);
Modified: head/sys/arm/cavium/cns11xx/econa.c
==============================================================================
--- head/sys/arm/cavium/cns11xx/econa.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm/cavium/cns11xx/econa.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -425,7 +425,7 @@ econa_alloc_resource(device_t dev, devic
}
if (rle->res)
panic("Resource rid %d type %d already in use", *rid, type);
- if (start == 0UL && end == ~0UL) {
+ if (RMAN_IS_DEFAULT_RANGE(start, end)) {
start = rle->start;
count = ulmax(count, rle->count);
end = ulmax(rle->end, start + count - 1);
Modified: head/sys/arm/mv/mv_localbus.c
==============================================================================
--- head/sys/arm/mv/mv_localbus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm/mv/mv_localbus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -341,7 +341,7 @@ localbus_alloc_resource(device_t bus, de
* 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);
Modified: head/sys/arm/mv/mv_pci.c
==============================================================================
--- head/sys/arm/mv/mv_pci.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm/mv/mv_pci.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -844,7 +844,7 @@ mv_pcib_alloc_resource(device_t dev, dev
type, rid, start, end, count, flags));
};
- if ((start == 0UL) && (end == ~0UL)) {
+ if (RMAN_IS_DEFAULT_RANGE(start, end)) {
start = sc->sc_mem_base;
end = sc->sc_mem_base + sc->sc_mem_size - 1;
count = sc->sc_mem_size;
Modified: head/sys/arm64/arm64/gic_fdt.c
==============================================================================
--- head/sys/arm64/arm64/gic_fdt.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm64/arm64/gic_fdt.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -211,7 +211,7 @@ arm_gic_fdt_alloc_resource(device_t bus,
* 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);
Modified: head/sys/arm64/arm64/gic_v3_fdt.c
==============================================================================
--- head/sys/arm64/arm64/gic_v3_fdt.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm64/arm64/gic_v3_fdt.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -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, d
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)
Modified: head/sys/arm64/arm64/nexus.c
==============================================================================
--- head/sys/arm64/arm64/nexus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm64/arm64/nexus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -223,7 +223,7 @@ nexus_alloc_resource(device_t bus, devic
* (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);
Modified: head/sys/arm64/cavium/thunder_pcie.c
==============================================================================
--- head/sys/arm64/cavium/thunder_pcie.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm64/cavium/thunder_pcie.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -292,7 +292,7 @@ thunder_pcie_alloc_resource(device_t dev
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);
Modified: head/sys/arm64/cavium/thunder_pcie_fdt.c
==============================================================================
--- head/sys/arm64/cavium/thunder_pcie_fdt.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm64/cavium/thunder_pcie_fdt.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -283,7 +283,7 @@ thunder_pcie_ofw_bus_alloc_res(device_t
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)
Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==============================================================================
--- head/sys/arm64/cavium/thunder_pcie_pem.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/arm64/cavium/thunder_pcie_pem.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -435,7 +435,7 @@ thunder_pem_alloc_resource(device_t dev,
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;
Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/acpica/acpi.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -1334,7 +1334,7 @@ acpi_alloc_resource(device_t bus, device
struct resource_list_entry *rle;
struct resource_list *rl;
struct resource *res;
- int isdefault = (start == 0UL && end == ~0UL);
+ int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
/*
* First attempt at allocating the resource. For direct children,
Modified: head/sys/dev/eisa/eisaconf.c
==============================================================================
--- head/sys/dev/eisa/eisaconf.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/eisa/eisaconf.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -359,7 +359,7 @@ eisa_alloc_resource(device_t dev, device
struct resource *rv, **rvp = 0;
isdefault = (device_get_parent(child) == dev &&
- start == 0UL && end == ~0UL && count == 1);
+ RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
switch (type) {
case SYS_RES_IRQ:
Modified: head/sys/dev/fdt/simplebus.c
==============================================================================
--- head/sys/dev/fdt/simplebus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/fdt/simplebus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -335,7 +335,7 @@ simplebus_alloc_resource(device_t bus, d
* 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);
Modified: head/sys/dev/gpio/gpiobus.c
==============================================================================
--- head/sys/dev/gpio/gpiobus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/gpio/gpiobus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -516,7 +516,7 @@ gpiobus_alloc_resource(device_t bus, dev
if (type != SYS_RES_IRQ)
return (NULL);
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
rle = NULL;
if (isdefault) {
rl = BUS_GET_RESOURCE_LIST(bus, child);
Modified: head/sys/dev/mca/mca_bus.c
==============================================================================
--- head/sys/dev/mca/mca_bus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/mca/mca_bus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -463,7 +463,7 @@ mca_alloc_resource (device_t dev, device
int isdefault;
int passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != dev);
if (!passthrough && !isdefault) {
Modified: head/sys/dev/ofw/ofwbus.c
==============================================================================
--- head/sys/dev/ofw/ofwbus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/ofw/ofwbus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -186,7 +186,7 @@ ofwbus_alloc_resource(device_t bus, devi
struct resource_list_entry *rle;
int isdefault, passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != bus);
sc = device_get_softc(bus);
rle = NULL;
Modified: head/sys/dev/pccard/pccard.c
==============================================================================
--- head/sys/dev/pccard/pccard.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/pccard/pccard.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -1137,7 +1137,7 @@ pccard_alloc_resource(device_t dev, devi
struct pccard_ivar *dinfo;
struct resource_list_entry *rle = 0;
int passthrough = (device_get_parent(child) != dev);
- int isdefault = (start == 0 && end == ~0UL && count == 1);
+ int isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
struct resource *r = NULL;
/* XXX I'm no longer sure this is right */
Modified: head/sys/dev/siba/siba.c
==============================================================================
--- head/sys/dev/siba/siba.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/siba/siba.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -383,7 +383,7 @@ siba_alloc_resource(device_t bus, device
printf("%s: entry\n", __func__);
#endif
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
needactivate = flags & RF_ACTIVE;
rl = BUS_GET_RESOURCE_LIST(bus, child);
rle = NULL;
Modified: head/sys/dev/vnic/mrml_bridge.c
==============================================================================
--- head/sys/dev/vnic/mrml_bridge.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/dev/vnic/mrml_bridge.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -139,7 +139,7 @@ mrmlb_ofw_bus_alloc_res(device_t bus, de
struct resource_list_entry *rle;
int i;
- 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)
Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/kern/subr_bus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -3311,7 +3311,7 @@ resource_list_alloc(struct resource_list
{
struct resource_list_entry *rle = NULL;
int passthrough = (device_get_parent(child) != bus);
- int isdefault = (start == 0UL && end == ~0UL);
+ int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
if (passthrough) {
return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child,
Modified: head/sys/mips/adm5120/obio.c
==============================================================================
--- head/sys/mips/adm5120/obio.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/adm5120/obio.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -231,7 +231,7 @@ obio_alloc_resource(device_t bus, device
struct rman *rm;
int isdefault, needactivate, passthrough;
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
needactivate = flags & RF_ACTIVE;
passthrough = (device_get_parent(child) != bus);
rle = NULL;
Modified: head/sys/mips/alchemy/obio.c
==============================================================================
--- head/sys/mips/alchemy/obio.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/alchemy/obio.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -232,7 +232,7 @@ obio_alloc_resource(device_t bus, device
struct rman *rm;
int isdefault, needactivate, passthrough;
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
needactivate = flags & RF_ACTIVE;
passthrough = (device_get_parent(child) != bus);
rle = NULL;
Modified: head/sys/mips/atheros/apb.c
==============================================================================
--- head/sys/mips/atheros/apb.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/atheros/apb.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -170,7 +170,7 @@ apb_alloc_resource(device_t bus, device_
struct rman *rm;
int isdefault, needactivate, passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end));
needactivate = flags & RF_ACTIVE;
/*
* Pass memory requests to nexus device
Modified: head/sys/mips/beri/beri_simplebus.c
==============================================================================
--- head/sys/mips/beri/beri_simplebus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/beri/beri_simplebus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -260,7 +260,7 @@ simplebus_alloc_resource(device_t bus, d
* 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);
Modified: head/sys/mips/idt/obio.c
==============================================================================
--- head/sys/mips/idt/obio.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/idt/obio.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -165,7 +165,7 @@ obio_alloc_resource(device_t bus, device
struct rman *rm;
int isdefault, needactivate, passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end));
needactivate = flags & RF_ACTIVE;
passthrough = (device_get_parent(child) != bus);
rle = NULL;
Modified: head/sys/mips/mips/nexus.c
==============================================================================
--- head/sys/mips/mips/nexus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/mips/nexus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -281,7 +281,7 @@ nexus_alloc_resource(device_t bus, devic
(void *)(intptr_t)end, count, flags);
dprintf("%s: requested rid is %d\n", __func__, *rid);
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
needactivate = flags & RF_ACTIVE;
passthrough = (device_get_parent(child) != bus);
rle = NULL;
Modified: head/sys/mips/nlm/xlp_simplebus.c
==============================================================================
--- head/sys/mips/nlm/xlp_simplebus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/nlm/xlp_simplebus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -192,7 +192,7 @@ xlp_simplebus_alloc_resource(device_t bu
bustag = NULL;
if (!passthrough) {
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
if (isdefault) {
rle = resource_list_find(&di->rl, type, *rid);
if (rle == NULL)
Modified: head/sys/mips/rt305x/obio.c
==============================================================================
--- head/sys/mips/rt305x/obio.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/rt305x/obio.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -287,7 +287,7 @@ obio_alloc_resource(device_t bus, device
struct rman *rm;
int isdefault, needactivate, passthrough;
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
needactivate = flags & RF_ACTIVE;
passthrough = (device_get_parent(child) != bus);
rle = NULL;
Modified: head/sys/mips/sibyte/sb_zbbus.c
==============================================================================
--- head/sys/mips/sibyte/sb_zbbus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/mips/sibyte/sb_zbbus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -288,7 +288,7 @@ zbbus_alloc_resource(device_t bus, devic
struct resource_list_entry *rle;
struct zbbus_devinfo *dinfo;
- isdefault = (start == 0UL && end == ~0UL && count == 1);
+ isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1);
/*
* Our direct child is asking for a default resource allocation.
Modified: head/sys/powerpc/mpc85xx/isa.c
==============================================================================
--- head/sys/powerpc/mpc85xx/isa.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/powerpc/mpc85xx/isa.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -52,7 +52,7 @@ isa_alloc_resource(device_t bus, device_
struct resource_list *rl = &idev->id_resources;
int isdefault, passthrough, rids;
- isdefault = (start == 0UL && end == ~0UL) ? 1 : 0;
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end) ? 1 : 0;
passthrough = (device_get_parent(child) != bus) ? 1 : 0;
if (!passthrough && !isdefault &&
Modified: head/sys/riscv/riscv/nexus.c
==============================================================================
--- head/sys/riscv/riscv/nexus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/riscv/riscv/nexus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -215,7 +215,7 @@ nexus_alloc_resource(device_t bus, devic
* (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);
Modified: head/sys/sparc64/central/central.c
==============================================================================
--- head/sys/sparc64/central/central.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/central/central.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -228,7 +228,7 @@ central_alloc_resource(device_t bus, dev
int passthrough;
int i;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != bus);
res = NULL;
rle = NULL;
Modified: head/sys/sparc64/ebus/ebus.c
==============================================================================
--- head/sys/sparc64/ebus/ebus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/ebus/ebus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -438,7 +438,7 @@ ebus_alloc_resource(device_t bus, device
uint64_t cend, cstart, offset;
int i, isdefault, passthrough, ridx;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != bus);
sc = device_get_softc(bus);
rl = BUS_GET_RESOURCE_LIST(bus, child);
Modified: head/sys/sparc64/fhc/fhc.c
==============================================================================
--- head/sys/sparc64/fhc/fhc.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/fhc/fhc.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -433,7 +433,7 @@ fhc_alloc_resource(device_t bus, device_
int passthrough;
int i;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != bus);
res = NULL;
rle = NULL;
Modified: head/sys/sparc64/isa/isa.c
==============================================================================
--- head/sys/sparc64/isa/isa.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/isa/isa.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -279,7 +279,7 @@ isa_alloc_resource(device_t bus, device_
* Consider adding a resource definition.
*/
int passthrough = (device_get_parent(child) != bus);
- int isdefault = (start == 0UL && end == ~0UL);
+ int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
struct resource_list *rl;
struct resource_list_entry *rle;
u_long base, limit;
Modified: head/sys/sparc64/pci/apb.c
==============================================================================
--- head/sys/sparc64/pci/apb.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/pci/apb.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -238,7 +238,7 @@ apb_alloc_resource(device_t dev, device_
* out where it's coming from (we should actually never see these) so
* we just have to punt.
*/
- if (start == 0 && end == ~0) {
+ if (RMAN_IS_DEFAULT_RANGE(start, end)) {
device_printf(dev, "can't decode default resource id %d for "
"%s, bypassing\n", *rid, device_get_nameunit(child));
goto passup;
Modified: head/sys/sparc64/sbus/sbus.c
==============================================================================
--- head/sys/sparc64/sbus/sbus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/sbus/sbus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -723,7 +723,7 @@ sbus_alloc_resource(device_t bus, device
int i, slot;
int isdefault, passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != bus);
rle = NULL;
sc = device_get_softc(bus);
Modified: head/sys/sparc64/sparc64/nexus.c
==============================================================================
--- head/sys/sparc64/sparc64/nexus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/sparc64/nexus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -370,7 +370,7 @@ nexus_alloc_resource(device_t bus, devic
device_t nexus;
int isdefault, passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != bus);
nexus = bus;
while (strcmp(device_get_name(device_get_parent(nexus)), "root") != 0)
Modified: head/sys/sparc64/sparc64/upa.c
==============================================================================
--- head/sys/sparc64/sparc64/upa.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sparc64/sparc64/upa.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -412,7 +412,7 @@ upa_alloc_resource(device_t dev, device_
bus_addr_t cend, cstart;
int i, isdefault, passthrough;
- isdefault = (start == 0UL && end == ~0UL);
+ isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
passthrough = (device_get_parent(child) != dev);
sc = device_get_softc(dev);
rl = BUS_GET_RESOURCE_LIST(dev, child);
Modified: head/sys/sys/rman.h
==============================================================================
--- head/sys/sys/rman.h Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/sys/rman.h Sat Feb 20 01:32:58 2016 (r295832)
@@ -63,6 +63,8 @@ enum rman_type { RMAN_UNINIT = 0, RMAN_G
#define RM_MAX_END ((rman_res_t)~0)
+#define RMAN_IS_DEFAULT_RANGE(s,e) ((s) == 0 && (e) == RM_MAX_END)
+
/*
* Userspace-exported structures.
*/
Modified: head/sys/x86/isa/isa.c
==============================================================================
--- head/sys/x86/isa/isa.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/x86/isa/isa.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -94,7 +94,7 @@ isa_alloc_resource(device_t bus, device_
* Consider adding a resource definition.
*/
int passthrough = (device_get_parent(child) != bus);
- int isdefault = (start == 0UL && end == ~0UL);
+ int isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
struct isa_device* idev = DEVTOISA(child);
struct resource_list *rl = &idev->id_resources;
struct resource_list_entry *rle;
Modified: head/sys/x86/x86/nexus.c
==============================================================================
--- head/sys/x86/x86/nexus.c Fri Feb 19 22:48:20 2016 (r295831)
+++ head/sys/x86/x86/nexus.c Sat Feb 20 01:32:58 2016 (r295832)
@@ -377,7 +377,7 @@ nexus_alloc_resource(device_t bus, devic
* (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);
More information about the svn-src-all
mailing list