Index: UPDATING =================================================================== --- UPDATING +++ UPDATING @@ -31,6 +31,10 @@ disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +TBD: + Bus resource type size has been changed. All kernel modules must must + be recompiled. + 20151216: The tftp loader (pxeboot) now uses the option root-path directive. As a consequence it no longer looks for a pxeboot.4th file on the tftp Index: lib/libdevinfo/Makefile =================================================================== --- lib/libdevinfo/Makefile +++ lib/libdevinfo/Makefile @@ -4,6 +4,7 @@ SRCS= devinfo.c INCS= devinfo.h MAN= devinfo.3 +SHLIB_MAJOR= 6 WARNS?= 3 Index: lib/libdevinfo/devinfo.h =================================================================== --- lib/libdevinfo/devinfo.h +++ lib/libdevinfo/devinfo.h @@ -56,8 +56,8 @@ struct devinfo_rman { devinfo_handle_t dm_handle; /* resource manager handle */ - unsigned long dm_start; /* resource start */ - unsigned long dm_size; /* resource size */ + rman_res_t dm_start; /* resource start */ + rman_res_t dm_size; /* resource size */ char *dm_desc; /* resource description */ }; @@ -67,8 +67,8 @@ devinfo_handle_t dr_rman; /* resource manager handle */ devinfo_handle_t dr_device; /* owning device */ - unsigned long dr_start; /* region start */ - unsigned long dr_size; /* region size */ + rman_res_t dr_start; /* region start */ + rman_res_t dr_size; /* region size */ /* XXX add flags */ }; Index: lib/libdevinfo/devinfo.3 =================================================================== --- lib/libdevinfo/devinfo.3 +++ lib/libdevinfo/devinfo.3 @@ -110,8 +110,8 @@ struct devinfo_rman { devinfo_handle_t dm_handle; /* resource manager handle */ - u_long dm_start; /* resource start */ - u_long dm_size; /* resource size */ + rman_res_t dm_start; /* resource start */ + rman_res_t dm_size; /* resource size */ char *dm_desc; /* resource description */ }; @@ -119,8 +119,8 @@ devinfo_handle_t dr_handle; /* resource handle */ devinfo_handle_t dr_rman; /* resource manager handle */ devinfo_handle_t dr_device; /* owning device */ - u_long dr_start; /* region start */ - u_long dr_size; /* region size */ + rman_res_t dr_start; /* region start */ + rman_res_t dr_size; /* region size */ }; .Ed .Pp Index: share/man/man9/bus_adjust_resource.9 =================================================================== --- share/man/man9/bus_adjust_resource.9 +++ share/man/man9/bus_adjust_resource.9 @@ -41,7 +41,8 @@ .In sys/rman.h .In machine/resource.h .Ft int -.Fn bus_adjust_resource "device_t dev" "int type" "struct resource *r" "u_long start" "u_long end" +.Fo bus_adjust_resource +.Fa "device_t dev" "int type" "struct resource *r" "rman_res_t start" "rman_res_t end" .Sh DESCRIPTION This function is used to ask the parent bus to adjust the resource range assigned to an allocated resource. Index: share/man/man9/bus_alloc_resource.9 =================================================================== --- share/man/man9/bus_alloc_resource.9 +++ share/man/man9/bus_alloc_resource.9 @@ -43,7 +43,10 @@ .In sys/rman.h .In machine/resource.h .Ft struct resource * -.Fn bus_alloc_resource "device_t dev" "int type" "int *rid" "u_long start" "u_long end" "u_long count" "u_int flags" +.Fo bus_alloc_resource +.Fa "device_t dev" "int type" "int *rid" "rman_res_t start" "rman_res_t end" +.Fa "rman_res_t count" "u_int flags" +.Fc .Ft struct resource * .Fn bus_alloc_resource_any "device_t dev" "int type" "int *rid" "u_int flags" .Sh DESCRIPTION Index: share/man/man9/bus_get_resource.9 =================================================================== --- share/man/man9/bus_get_resource.9 +++ share/man/man9/bus_get_resource.9 @@ -44,7 +44,7 @@ .In sys/rman.h .Ft int .Fo bus_get_resource -.Fa "device_t dev" "int type" "int rid" "u_long *startp" "u_long *countp" +.Fa "device_t dev" "int type" "int rid" "rman_res_t *startp" "rman_res_t *countp" .Fc .Sh DESCRIPTION The Index: share/man/man9/bus_set_resource.9 =================================================================== --- share/man/man9/bus_set_resource.9 +++ share/man/man9/bus_set_resource.9 @@ -43,7 +43,7 @@ .In machine/resource.h .Ft int .Fo bus_set_resource -.Fa "device_t dev" "int type" "int rid" "u_long start" "u_long count" +.Fa "device_t dev" "int type" "int rid" "rman_res_t start" "rman_res_t count" .Fc .Sh DESCRIPTION The Index: share/man/man9/rman.9 =================================================================== --- share/man/man9/rman.9 +++ share/man/man9/rman.9 @@ -65,7 +65,7 @@ .Ft int .Fn rman_activate_resource "struct resource *r" .Ft int -.Fn rman_adjust_resource "struct resource *r" "u_long start" "u_long end" +.Fn rman_adjust_resource "struct resource *r" "rman_res_t start" "rman_res_t end" .Ft int .Fn rman_await_resource "struct resource *r" "int pri2" "int timo" .Ft int @@ -79,32 +79,32 @@ .Ft int .Fn rman_is_region_manager "struct resource *r" "struct rman *rm" .Ft int -.Fn rman_manage_region "struct rman *rm" "u_long start" "u_long end" +.Fn rman_manage_region "struct rman *rm" "rman_res_t start" "rman_res_t end" .Ft int -.Fn rman_first_free_region "struct rman *rm" "u_long *start" "u_long *end" +.Fn rman_first_free_region "struct rman *rm" "rman_res_t *start" "rman_res_t *end" .Ft int -.Fn rman_last_free_region "struct rman *rm" "u_long *start" "u_long *end" +.Fn rman_last_free_region "struct rman *rm" "rman_res_t *start" "rman_res_t *end" .Ft int .Fn rman_release_resource "struct resource *r" .Ft "struct resource *" .Fo rman_reserve_resource -.Fa "struct rman *rm" "u_long start" "u_long end" "u_long count" +.Fa "struct rman *rm" "rman_res_t start" "rman_res_t end" "rman_res_t count" .Fa "u_int flags" "struct device *dev" .Fc .Ft "struct resource *" .Fo rman_reserve_resource_bound -.Fa "struct rman *rm" "u_long start" "u_long end" "u_long count" -.Fa "u_long bound" "u_int flags" "struct device *dev" +.Fa "struct rman *rm" "rman_res_t start" "rman_res_t end" "rman_res_t count" +.Fa "rman_res_t bound" "u_int flags" "struct device *dev" .Fc .Ft uint32_t .Fn rman_make_alignment_flags "uint32_t size" -.Ft u_long +.Ft rman_res_t .Fn rman_get_start "struct resource *r" -.Ft u_long +.Ft rman_res_t .Fn rman_get_end "struct resource *r" .Ft "struct device *" .Fn rman_get_device "struct resource *r" -.Ft u_long +.Ft rman_res_t .Fn rman_get_size "struct resource *r" .Ft u_int .Fn rman_get_flags "struct resource *r" Index: sys/arm/arm/nexus.c =================================================================== --- sys/arm/arm/nexus.c +++ sys/arm/arm/nexus.c @@ -82,7 +82,7 @@ static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); #ifdef ARM_INTRNG @@ -159,7 +159,7 @@ { mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = BUS_SPACE_MAXADDR; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0, ~0)) @@ -212,7 +212,7 @@ */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *rv; struct rman *rm; @@ -345,6 +345,10 @@ if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { paddr = (bus_addr_t)rman_get_start(r); psize = (bus_size_t)rman_get_size(r); + if (paddr + psize > BUS_SPACE_MAXADDR) { + rman_deactivate_resource(r); + return (ENOMEM); + } #ifdef FDT err = bus_space_map(fdtbus_bs_tag, paddr, psize, 0, &vaddr); if (err != 0) { Index: sys/arm/at91/at91.c =================================================================== --- sys/arm/at91/at91.c +++ sys/arm/at91/at91.c @@ -304,7 +304,7 @@ static struct resource * at91_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct at91_softc *sc = device_get_softc(dev); struct resource_list_entry *rle; @@ -321,7 +321,7 @@ return (NULL); if (rle->res) panic("Resource rid %d type %d already in use", *rid, type); - if (start == 0UL && end == ~0UL) { + if (start == 0 && end == ~0) { start = rle->start; count = ulmax(count, rle->count); end = ulmax(rle->end, start + count - 1); @@ -412,7 +412,7 @@ struct resource *r) { #if 0 - u_long p; + rman_res_t p; int error; if (type == SYS_RES_MEMORY) { Index: sys/arm/at91/at91_pinctrl.c =================================================================== --- sys/arm/at91/at91_pinctrl.c +++ sys/arm/at91/at91_pinctrl.c @@ -280,7 +280,7 @@ * Request for the default allocation with a given rid: use resource * list stored in the local device info. */ - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); Index: sys/arm/cavium/cns11xx/econa.c =================================================================== --- sys/arm/cavium/cns11xx/econa.c +++ sys/arm/cavium/cns11xx/econa.c @@ -408,7 +408,7 @@ static struct resource * econa_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct econa_softc *sc = device_get_softc(dev); struct resource_list_entry *rle; @@ -425,7 +425,7 @@ } if (rle->res) panic("Resource rid %d type %d already in use", *rid, type); - if (start == 0UL && end == ~0UL) { + if (start == 0 && end == ~0) { start = rle->start; count = ulmax(count, rle->count); end = ulmax(rle->end, start + count - 1); Index: sys/arm/mv/mv_localbus.c =================================================================== --- sys/arm/mv/mv_localbus.c +++ sys/arm/mv/mv_localbus.c @@ -100,7 +100,7 @@ static int localbus_print_child(device_t, device_t); static struct resource *localbus_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static struct resource_list *localbus_get_resource_list(device_t, device_t); static ofw_bus_get_devinfo_t localbus_get_devinfo; @@ -332,7 +332,7 @@ static struct resource * localbus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct localbus_devinfo *di; struct resource_list_entry *rle; @@ -341,7 +341,7 @@ * Request for the default allocation with a given rid: use resource * list stored in the local device info. */ - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); Index: sys/arm/mv/mv_pci.c =================================================================== --- sys/arm/mv/mv_pci.c +++ sys/arm/mv/mv_pci.c @@ -332,7 +332,7 @@ static int mv_pcib_attach(device_t); static struct resource *mv_pcib_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int mv_pcib_release_resource(device_t, device_t, int, int, struct resource *); static int mv_pcib_read_ivar(device_t, device_t, int, uintptr_t *); @@ -830,7 +830,7 @@ static struct resource * mv_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct mv_pcib_softc *sc = device_get_softc(dev); struct rman *rm = NULL; @@ -848,7 +848,7 @@ type, rid, start, end, count, flags)); }; - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { start = sc->sc_mem_base; end = sc->sc_mem_base + sc->sc_mem_size - 1; count = sc->sc_mem_size; Index: sys/arm/versatile/versatile_pci.c =================================================================== --- sys/arm/versatile/versatile_pci.c +++ sys/arm/versatile/versatile_pci.c @@ -305,7 +305,7 @@ static struct resource * versatile_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct versatile_pci_softc *sc = device_get_softc(bus); Index: sys/arm/xscale/i8134x/i81342.c =================================================================== --- sys/arm/xscale/i8134x/i81342.c +++ sys/arm/xscale/i8134x/i81342.c @@ -409,7 +409,7 @@ static struct resource * i81342_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct i81342_softc *sc = device_get_softc(dev); struct resource *rv; Index: sys/arm/xscale/i8134x/i81342_pci.c =================================================================== --- sys/arm/xscale/i8134x/i81342_pci.c +++ sys/arm/xscale/i8134x/i81342_pci.c @@ -328,7 +328,7 @@ static struct resource * i81342_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct i81342_pci_softc *sc = device_get_softc(bus); struct resource *rv; @@ -383,7 +383,7 @@ i81342_pci_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { - u_long p; + bus_space_handle_t p; int error; if (type == SYS_RES_MEMORY) { Index: sys/arm/xscale/i8134x/obio.c =================================================================== --- sys/arm/xscale/i8134x/obio.c +++ sys/arm/xscale/i8134x/obio.c @@ -91,7 +91,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *rv; struct rman *rm; Index: sys/arm/xscale/ixp425/avila_ata.c =================================================================== --- sys/arm/xscale/ixp425/avila_ata.c +++ sys/arm/xscale/ixp425/avila_ata.c @@ -282,12 +282,12 @@ static struct resource * ata_avila_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ata_avila_softc *sc = device_get_softc(dev); KASSERT(type == SYS_RES_IRQ && *rid == ATA_IRQ_RID, - ("type %u rid %u start %lu end %lu count %lu flags %u", + ("type %u rid %u start %ju end %ju count %ju flags %u", type, *rid, start, end, count, flags)); /* doesn't matter what we return so reuse the real thing */ Index: sys/arm/xscale/ixp425/ixp425.c =================================================================== --- sys/arm/xscale/ixp425/ixp425.c +++ sys/arm/xscale/ixp425/ixp425.c @@ -496,7 +496,7 @@ static struct resource * ixp425_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ixp425_softc *sc = device_get_softc(dev); const struct hwvtrans *vtrans; @@ -533,7 +533,7 @@ (start - vtrans->hwbase); if (bootverbose) device_printf(child, - "%s: assign 0x%lx:0x%lx%s\n", + "%s: assign 0x%jx:0x%jx%s\n", __func__, start, end - start, vtrans->isa4x ? " A4X" : vtrans->isslow ? " SLOW" : ""); @@ -542,14 +542,14 @@ vtrans = gethwvtrans(start, end - start); if (vtrans == NULL) { /* likely means above table needs to be updated */ - device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", + device_printf(child, "%s: no mapping for 0x%jx:0x%jx\n", __func__, start, end - start); return NULL; } rv = rman_reserve_resource(&sc->sc_mem_rman, start, end, end - start, flags, child); if (rv == NULL) { - device_printf(child, "%s: cannot reserve 0x%lx:0x%lx\n", + device_printf(child, "%s: cannot reserve 0x%jx:0x%jx\n", __func__, start, end - start); return NULL; } @@ -586,7 +586,7 @@ if (type == SYS_RES_MEMORY) { vtrans = gethwvtrans(rman_get_start(r), rman_get_size(r)); if (vtrans == NULL) { /* NB: should not happen */ - device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", + device_printf(child, "%s: no mapping for 0x%jx:0x%jx\n", __func__, rman_get_start(r), rman_get_size(r)); return (ENOENT); } Index: sys/arm/xscale/ixp425/ixp425_pci.c =================================================================== --- sys/arm/xscale/ixp425/ixp425_pci.c +++ sys/arm/xscale/ixp425/ixp425_pci.c @@ -269,7 +269,7 @@ static struct resource * ixppcib_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ixppcib_softc *sc = device_get_softc(bus); struct rman *rmanp; Index: sys/arm/xscale/pxa/pxa_obio.c =================================================================== --- sys/arm/xscale/pxa/pxa_obio.c +++ sys/arm/xscale/pxa/pxa_obio.c @@ -50,14 +50,14 @@ static struct resource_list * pxa_get_resource_list(device_t, device_t); static struct resource * pxa_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int pxa_release_resource(device_t, device_t, int, int, struct resource *); static int pxa_activate_resource(device_t, device_t, int, int, struct resource *); static struct resource * pxa_alloc_gpio_irq(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); struct obio_device { const char *od_name; @@ -224,7 +224,7 @@ static struct resource * pxa_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc; struct obio_device *od; @@ -351,7 +351,7 @@ static struct resource * pxa_alloc_gpio_irq(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc; struct obio_device *od; @@ -390,7 +390,7 @@ } if (bootverbose) - device_printf(dev, "lazy allocation of irq %ld for %s\n", + device_printf(dev, "lazy allocation of irq %jd for %s\n", start, device_get_nameunit(child)); return (rv); Index: sys/arm/xscale/pxa/pxa_smi.c =================================================================== --- sys/arm/xscale/pxa/pxa_smi.c +++ sys/arm/xscale/pxa/pxa_smi.c @@ -70,7 +70,7 @@ static int pxa_smi_read_ivar(device_t, device_t, int, uintptr_t *); static struct resource * pxa_smi_alloc_resource(device_t, device_t, - int, int *, u_long, u_long, u_long, u_int); + int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int pxa_smi_release_resource(device_t, device_t, int, int, struct resource *); static int pxa_smi_activate_resource(device_t, device_t, @@ -176,7 +176,7 @@ static struct resource * pxa_smi_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pxa_smi_softc *sc; struct smi_ivars *smid; Index: sys/arm64/arm64/gic_v3_fdt.c =================================================================== --- sys/arm64/arm64/gic_v3_fdt.c +++ sys/arm64/arm64/gic_v3_fdt.c @@ -54,7 +54,7 @@ static int gic_v3_fdt_attach(device_t); static struct resource *gic_v3_ofw_bus_alloc_res(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static const struct ofw_bus_devinfo *gic_v3_ofw_get_devinfo(device_t, device_t); static device_method_t gic_v3_fdt_methods[] = { @@ -174,13 +174,13 @@ static struct resource * gic_v3_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct gic_v3_ofw_devinfo *di; struct resource_list_entry *rle; int ranges_len; - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); if (type != SYS_RES_MEMORY) Index: sys/arm64/arm64/nexus.c =================================================================== --- sys/arm64/arm64/nexus.c +++ sys/arm64/arm64/nexus.c @@ -99,13 +99,14 @@ static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, enum intr_polarity pol); static struct resource_list *nexus_get_reslist(device_t, device_t); -static int nexus_set_resource(device_t, device_t, int, int, u_long, u_long); +static int nexus_set_resource(device_t, device_t, int, int, + rman_res_t, rman_res_t); static int nexus_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -145,13 +146,13 @@ { mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = ~0; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(&mem_rman) || rman_manage_region(&mem_rman, 0, ~0)) panic("nexus_attach mem_rman"); irq_rman.rm_start = 0; - irq_rman.rm_end = ~0ul; + irq_rman.rm_end = ~0; irq_rman.rm_type = RMAN_ARRAY; irq_rman.rm_descr = "Interrupts"; if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) @@ -201,7 +202,7 @@ */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct nexus_device *ndev = DEVTONX(child); struct resource *rv; @@ -215,7 +216,7 @@ * (ie. they aren't maintained by a child bus), then work out * the start/end values. */ - if ((start == 0UL) && (end == ~0UL) && (count == 1)) { + if ((start == 0) && (end == ~0) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) return(NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); @@ -310,6 +311,10 @@ if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { paddr = (bus_addr_t)rman_get_start(r); psize = (bus_size_t)rman_get_size(r); + if (paddr + psize > BUS_SPACE_MAXADDR) { + rman_deactivate_resource(r); + return (ENOMEM); + } err = bus_space_map(&memmap_bus, paddr, psize, 0, &vaddr); if (err != 0) { rman_deactivate_resource(r); @@ -332,7 +337,7 @@ static int nexus_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; Index: sys/arm64/cavium/thunder_pcie.c =================================================================== --- sys/arm64/cavium/thunder_pcie.c +++ sys/arm64/cavium/thunder_pcie.c @@ -110,7 +110,7 @@ /* Forward prototypes */ static struct resource *thunder_pcie_alloc_resource(device_t, - device_t, int, int *, u_long, u_long, u_long, u_int); + device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int thunder_pcie_attach(device_t); static int thunder_pcie_identify_pcib(device_t); static int thunder_pcie_maxslots(device_t); @@ -431,7 +431,7 @@ static struct resource * thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct thunder_pcie_softc *sc = device_get_softc(dev); struct rman *rm = NULL; @@ -450,7 +450,7 @@ type, rid, start, end, count, flags)); }; - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { /* Read BAR manually to get resource address and size */ pci_read_bar(child, *rid, &map, &testval, NULL); @@ -519,7 +519,7 @@ thunder_pcie_identify_pcib(device_t dev) { struct thunder_pcie_softc *sc; - u_long start; + rman_res_t start; sc = device_get_softc(dev); start = bus_get_resource_start(dev, SYS_RES_MEMORY, 0); Index: sys/arm64/cavium/thunder_pcie_pem.c =================================================================== --- sys/arm64/cavium/thunder_pcie_pem.c +++ sys/arm64/cavium/thunder_pcie_pem.c @@ -126,7 +126,7 @@ }; static struct resource * thunder_pem_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int thunder_pem_attach(device_t); static int thunder_pem_detach(device_t); static uint64_t thunder_pem_config_reg_read(struct thunder_pem_softc *, int); @@ -230,7 +230,7 @@ thunder_pem_identify(device_t dev) { struct thunder_pem_softc *sc; - u_long start; + rman_res_t start; sc = device_get_softc(dev); start = rman_get_start(sc->reg); @@ -426,7 +426,7 @@ static struct resource * thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct thunder_pem_softc *sc = device_get_softc(dev); struct rman *rm = NULL; @@ -447,7 +447,7 @@ end, count, flags)); }; - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { device_printf(dev, "Cannot allocate resource with unspecified range\n"); goto fail; Index: sys/compat/ndis/kern_ndis.c =================================================================== --- sys/compat/ndis/kern_ndis.c +++ sys/compat/ndis/kern_ndis.c @@ -348,13 +348,13 @@ ndis_add_sysctl(sc, "BusType", "Bus Type", buf, NDIS_FLAG_RDONLY); if (sc->ndis_res_io != NULL) { - sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io)); + sprintf(buf, "0x%jx", rman_get_start(sc->ndis_res_io)); ndis_add_sysctl(sc, "IOBaseAddress", "Base I/O Address", buf, NDIS_FLAG_RDONLY); } if (sc->ndis_irq != NULL) { - sprintf(buf, "%lu", rman_get_start(sc->ndis_irq)); + sprintf(buf, "%ju", rman_get_start(sc->ndis_irq)); ndis_add_sysctl(sc, "InterruptNumber", "Interrupt Number", buf, NDIS_FLAG_RDONLY); } Index: sys/dev/aac/aac.c =================================================================== --- sys/dev/aac/aac.c +++ sys/dev/aac/aac.c @@ -1781,7 +1781,7 @@ bus_release_resource(sc->aac_dev, SYS_RES_MEMORY, rid, sc->aac_regs_res1); sc->aac_regs_res1 = bus_alloc_resource(sc->aac_dev, - SYS_RES_MEMORY, &rid, 0ul, ~0ul, atu_size, RF_ACTIVE); + SYS_RES_MEMORY, &rid, 0, ~0, atu_size, RF_ACTIVE); if (sc->aac_regs_res1 == NULL) { sc->aac_regs_res1 = bus_alloc_resource_any( sc->aac_dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); Index: sys/dev/aacraid/aacraid.c =================================================================== --- sys/dev/aacraid/aacraid.c +++ sys/dev/aacraid/aacraid.c @@ -1665,7 +1665,7 @@ sc->aac_regs_rid0, sc->aac_regs_res0); sc->aac_regs_res0 = bus_alloc_resource( sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid0, - 0ul, ~0ul, atu_size, RF_ACTIVE); + 0, ~0, atu_size, RF_ACTIVE); if (sc->aac_regs_res0 == NULL) { sc->aac_regs_res0 = bus_alloc_resource_any( sc->aac_dev, SYS_RES_MEMORY, Index: sys/dev/acpica/acpi.c =================================================================== --- sys/dev/acpica/acpi.c +++ sys/dev/acpica/acpi.c @@ -121,12 +121,12 @@ static void acpi_reserve_resources(device_t dev); static int acpi_sysres_alloc(device_t dev); static int acpi_set_resource(device_t dev, device_t child, int type, - int rid, u_long start, u_long count); + int rid, rman_res_t start, rman_res_t count); static struct resource *acpi_alloc_resource(device_t bus, device_t child, - int type, int *rid, u_long start, u_long end, - u_long count, u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); static int acpi_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end); + struct resource *r, rman_res_t start, rman_res_t end); static int acpi_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); static void acpi_delete_resource(device_t bus, device_t child, int type, @@ -460,7 +460,7 @@ panic("acpi rman_init IO ports failed"); acpi_rman_mem.rm_type = RMAN_ARRAY; acpi_rman_mem.rm_start = 0; - acpi_rman_mem.rm_end = ~0ul; + acpi_rman_mem.rm_end = ~0; acpi_rman_mem.rm_descr = "ACPI I/O memory addresses"; if (rman_init(&acpi_rman_mem) != 0) panic("acpi rman_init memory failed"); @@ -793,10 +793,10 @@ int retval = 0; retval += bus_print_child_header(bus, child); - retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx"); - retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx"); - retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); - retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%ld"); + retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#jx"); + retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#jx"); + retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); + retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%jd"); if (device_get_flags(child)) retval += printf(" flags %#x", device_get_flags(child)); retval += bus_print_child_domain(bus, child); @@ -1154,7 +1154,7 @@ rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev); STAILQ_FOREACH(rle, rl, link) { if (rle->res != NULL) { - device_printf(dev, "duplicate resource for %lx\n", rle->start); + device_printf(dev, "duplicate resource for %jx\n", rle->start); continue; } @@ -1177,7 +1177,7 @@ rman_manage_region(rm, rman_get_start(res), rman_get_end(res)); rle->res = res; } else if (bootverbose) - device_printf(dev, "reservation of %lx, %lx (%d) failed\n", + device_printf(dev, "reservation of %jx, %jx (%d) failed\n", rle->start, rle->count, rle->type); } return (0); @@ -1247,13 +1247,13 @@ static int acpi_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct acpi_softc *sc = device_get_softc(dev); struct acpi_device *ad = device_get_ivars(child); struct resource_list *rl = &ad->ad_rl; ACPI_DEVICE_INFO *devinfo; - u_long end; + rman_res_t end; /* Ignore IRQ resources for PCI link devices. */ if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL) @@ -1323,14 +1323,14 @@ static struct resource * acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { ACPI_RESOURCE ares; struct acpi_device *ad; struct resource_list_entry *rle; struct resource_list *rl; struct resource *res; - int isdefault = (start == 0UL && end == ~0UL); + int isdefault = (start == 0 && end == ~0); /* * First attempt at allocating the resource. For direct children, @@ -1399,8 +1399,8 @@ * system resources. */ struct resource * -acpi_alloc_sysres(device_t child, int type, int *rid, u_long start, u_long end, - u_long count, u_int flags) +acpi_alloc_sysres(device_t child, int type, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags) { struct rman *rm; struct resource *res; @@ -1450,7 +1450,7 @@ static int acpi_adjust_resource(device_t bus, device_t child, int type, struct resource *r, - u_long start, u_long end) + rman_res_t start, rman_res_t end) { if (acpi_is_resource_managed(type, r)) Index: sys/dev/acpica/acpi_hpet.c =================================================================== --- sys/dev/acpica/acpi_hpet.c +++ sys/dev/acpica/acpi_hpet.c @@ -322,7 +322,7 @@ static int hpet_find_irq_rid(device_t dev, u_long start, u_long end) { - u_long irq; + rman_res_t irq; int error, rid; for (rid = 0;; rid++) { @@ -442,7 +442,7 @@ /* Validate that we can access the whole region. */ if (rman_get_size(sc->mem_res) < HPET_MEM_WIDTH) { - device_printf(dev, "memory region width %ld too small\n", + device_printf(dev, "memory region width %jd too small\n", rman_get_size(sc->mem_res)); bus_free_resource(dev, SYS_RES_MEMORY, sc->mem_res); return (ENXIO); Index: sys/dev/acpica/acpi_pcib_acpi.c =================================================================== --- sys/dev/acpica/acpi_pcib_acpi.c +++ sys/dev/acpica/acpi_pcib_acpi.c @@ -91,12 +91,12 @@ int *irq); static struct resource *acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); #ifdef NEW_PCIB static int acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, int type, struct resource *r, - u_long start, u_long end); + rman_res_t start, rman_res_t end); #ifdef PCI_RES_BUS static int acpi_pcib_acpi_release_resource(device_t dev, device_t child, int type, int rid, @@ -283,7 +283,7 @@ #if defined(NEW_PCIB) && defined(PCI_RES_BUS) static int -first_decoded_bus(struct acpi_hpcib_softc *sc, u_long *startp) +first_decoded_bus(struct acpi_hpcib_softc *sc, rman_res_t *startp) { struct resource_list_entry *rle; @@ -304,7 +304,7 @@ u_int slot, func, busok; #if defined(NEW_PCIB) && defined(PCI_RES_BUS) struct resource *bus_res; - u_long start; + rman_res_t start; int rid; #endif uint8_t busno; @@ -584,7 +584,7 @@ struct resource * acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { #ifdef NEW_PCIB struct acpi_hpcib_softc *sc; @@ -625,7 +625,7 @@ #ifdef NEW_PCIB int acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct acpi_hpcib_softc *sc; Index: sys/dev/acpica/acpi_resource.c =================================================================== --- sys/dev/acpica/acpi_resource.c +++ sys/dev/acpica/acpi_resource.c @@ -671,7 +671,7 @@ struct resource_list_entry *bus_rle, *dev_rle; struct resource_list *bus_rl, *dev_rl; int done, type; - u_long start, end, count; + rman_res_t start, end, count; /* * Loop through all current resources to see if the new one overlaps Index: sys/dev/acpica/acpi_timer.c =================================================================== --- sys/dev/acpica/acpi_timer.c +++ sys/dev/acpica/acpi_timer.c @@ -122,7 +122,7 @@ acpi_timer_identify(driver_t *driver, device_t parent) { device_t dev; - u_long rlen, rstart; + rman_res_t rlen, rstart; int rid, rtype; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -152,7 +152,7 @@ rlen = AcpiGbl_FADT.PmTimerLength; rstart = AcpiGbl_FADT.XPmTimerBlock.Address; if (bus_set_resource(dev, rtype, rid, rstart, rlen)) - device_printf(dev, "couldn't set resource (%s 0x%lx+0x%lx)\n", + device_printf(dev, "couldn't set resource (%s 0x%jx+0x%jx)\n", (rtype == SYS_RES_IOPORT) ? "port" : "mem", rstart, rlen); return_VOID; } Index: sys/dev/acpica/acpivar.h =================================================================== --- sys/dev/acpica/acpivar.h +++ sys/dev/acpica/acpivar.h @@ -383,7 +383,8 @@ ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resource_set *set, void *arg); struct resource *acpi_alloc_sysres(device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags); /* ACPI event handling */ UINT32 acpi_event_power_button_sleep(void *context); Index: sys/dev/advansys/adv_isa.c =================================================================== --- sys/dev/advansys/adv_isa.c +++ sys/dev/advansys/adv_isa.c @@ -109,7 +109,7 @@ { int port_index; int max_port_index; - u_long iobase, iocount, irq; + rman_res_t iobase, iocount, irq; int user_iobase = 0; int rid = 0; void *ih; @@ -136,7 +136,7 @@ || (iobase != adv_isa_ioports[port_index])) { if (bootverbose) device_printf(dev, - "Invalid baseport of 0x%lx specified. " + "Invalid baseport of 0x%jx specified. " "Nearest valid baseport is 0x%x. Failing " "probe.\n", iobase, (port_index <= max_port_index) ? Index: sys/dev/aha/aha_isa.c =================================================================== --- sys/dev/aha/aha_isa.c +++ sys/dev/aha/aha_isa.c @@ -121,7 +121,7 @@ port_rid = 0; aha->port = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid, - 0ul, ~0ul, AHA_NREGS, RF_ACTIVE); + 0, ~0, AHA_NREGS, RF_ACTIVE); if (aha->port == NULL) return (ENXIO); @@ -192,7 +192,7 @@ aha->dev = dev; aha->portrid = 0; aha->port = bus_alloc_resource(dev, SYS_RES_IOPORT, &aha->portrid, - 0ul, ~0ul, AHA_NREGS, RF_ACTIVE); + 0, ~0, AHA_NREGS, RF_ACTIVE); if (!aha->port) { device_printf(dev, "Unable to allocate I/O ports\n"); goto fail; Index: sys/dev/ahci/ahci.h =================================================================== --- sys/dev/ahci/ahci.h +++ sys/dev/ahci/ahci.h @@ -626,7 +626,7 @@ int ahci_setup_interrupt(device_t dev); int ahci_print_child(device_t dev, device_t child); struct resource *ahci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int ahci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int ahci_setup_intr(device_t dev, device_t child, struct resource *irq, Index: sys/dev/ahci/ahci.c =================================================================== --- sys/dev/ahci/ahci.c +++ sys/dev/ahci/ahci.c @@ -523,7 +523,7 @@ struct resource * ahci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ahci_controller *ctlr = device_get_softc(dev); struct resource *res; Index: sys/dev/aic/aic_isa.c =================================================================== --- sys/dev/aic/aic_isa.c +++ sys/dev/aic/aic_isa.c @@ -76,7 +76,7 @@ rid = 0; sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, AIC_ISA_PORTSIZE, RF_ACTIVE); + 0, ~0, AIC_ISA_PORTSIZE, RF_ACTIVE); if (!sc->sc_port) { device_printf(dev, "I/O port allocation failed\n"); return (ENOMEM); Index: sys/dev/aic/aic_pccard.c =================================================================== --- sys/dev/aic/aic_pccard.c +++ sys/dev/aic/aic_pccard.c @@ -78,7 +78,7 @@ rid = 0; sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, AIC_PCCARD_PORTSIZE, RF_ACTIVE); + 0, ~0, AIC_PCCARD_PORTSIZE, RF_ACTIVE); if (!sc->sc_port) return (ENOMEM); Index: sys/dev/amdsbwd/amdsbwd.c =================================================================== --- sys/dev/amdsbwd/amdsbwd.c +++ sys/dev/amdsbwd/amdsbwd.c @@ -395,7 +395,7 @@ return (ENXIO); } rid = 0; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, + res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, AMDSB_PMIO_WIDTH, RF_ACTIVE | RF_SHAREABLE); if (res == NULL) { device_printf(dev, "bus_alloc_resource for IO failed\n"); Index: sys/dev/an/if_an.c =================================================================== --- sys/dev/an/if_an.c +++ sys/dev/an/if_an.c @@ -395,7 +395,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res) { sc->port_rid = rid; sc->port_res = res; @@ -414,7 +414,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res) { sc->mem_rid = rid; sc->mem_res = res; @@ -434,7 +434,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res) { sc->mem_aux_rid = rid; sc->mem_aux_res = res; Index: sys/dev/arcmsr/arcmsr.c =================================================================== --- sys/dev/arcmsr/arcmsr.c +++ sys/dev/arcmsr/arcmsr.c @@ -4143,7 +4143,7 @@ u_int32_t rid0 = PCIR_BAR(0); vm_offset_t mem_base0; - acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, 0x1000, RF_ACTIVE); + acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0, ~0, 0x1000, RF_ACTIVE); if(acb->sys_res_arcmsr[0] == NULL) { arcmsr_free_resource(acb); printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); @@ -4178,10 +4178,10 @@ for(i=0; i < 2; i++) { if(i == 0) { acb->sys_res_arcmsr[i] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid[i], - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); } else { acb->sys_res_arcmsr[i] = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid[i], - 0ul, ~0ul, sizeof(struct HBB_RWBUFFER), RF_ACTIVE); + 0, ~0, sizeof(struct HBB_RWBUFFER), RF_ACTIVE); } if(acb->sys_res_arcmsr[i] == NULL) { arcmsr_free_resource(acb); @@ -4224,7 +4224,7 @@ u_int32_t rid0 = PCIR_BAR(1); vm_offset_t mem_base0; - acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, sizeof(struct HBC_MessageUnit), RF_ACTIVE); + acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0, ~0, sizeof(struct HBC_MessageUnit), RF_ACTIVE); if(acb->sys_res_arcmsr[0] == NULL) { arcmsr_free_resource(acb); printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); @@ -4251,7 +4251,7 @@ u_int32_t rid0 = PCIR_BAR(0); vm_offset_t mem_base0; - acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, sizeof(struct HBD_MessageUnit), RF_ACTIVE); + acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0, ~0, sizeof(struct HBD_MessageUnit), RF_ACTIVE); if(acb->sys_res_arcmsr[0] == NULL) { arcmsr_free_resource(acb); printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev)); @@ -4323,7 +4323,7 @@ } /* After setting up the adapter, map our interrupt */ rid = 0; - irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0ul, ~0ul, 1, RF_SHAREABLE | RF_ACTIVE); + irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); if(irqres == NULL || #if __FreeBSD_version >= 700025 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|INTR_MPSAFE, NULL, arcmsr_intr_handler, acb, &acb->ih)) { Index: sys/dev/ata/ata-cbus.c =================================================================== --- sys/dev/ata/ata-cbus.c +++ sys/dev/ata/ata-cbus.c @@ -67,7 +67,7 @@ { struct resource *io; int rid; - u_long tmp; + rman_res_t tmp; /* dont probe PnP devices */ if (isa_get_vendorid(dev)) @@ -168,7 +168,8 @@ static struct resource * ata_cbus_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct ata_cbus_controller *ctlr = device_get_softc(dev); Index: sys/dev/ata/ata-isa.c =================================================================== --- sys/dev/ata/ata-isa.c +++ sys/dev/ata/ata-isa.c @@ -60,7 +60,8 @@ ata_isa_probe(device_t dev) { struct resource *io = NULL, *ctlio = NULL; - u_long tmp; + rman_res_t tmp; + rman_res_t tcount; int rid; /* check isapnp ids */ @@ -74,7 +75,7 @@ return ENXIO; /* set the altport range */ - if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tmp)) { + if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tcount)) { bus_set_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, rman_get_start(io) + ATA_CTLOFFSET, ATA_CTLIOSIZE); } @@ -100,7 +101,8 @@ { struct ata_channel *ch = device_get_softc(dev); struct resource *io = NULL, *ctlio = NULL; - u_long tmp; + rman_res_t tmp; + rman_res_t tcount; int i, rid; if (ch->attached) @@ -114,7 +116,7 @@ return ENXIO; /* set the altport range */ - if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tmp)) { + if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tcount)) { bus_set_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, rman_get_start(io) + ATA_CTLOFFSET, ATA_CTLIOSIZE); } Index: sys/dev/ata/ata-pci.h =================================================================== --- sys/dev/ata/ata-pci.h +++ sys/dev/ata/ata-pci.h @@ -535,7 +535,7 @@ int ata_pci_print_child(device_t dev, device_t child); int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); -struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); Index: sys/dev/ata/ata-pci.c =================================================================== --- sys/dev/ata/ata-pci.c +++ sys/dev/ata/ata-pci.c @@ -217,7 +217,8 @@ struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct ata_pci_controller *controller = device_get_softc(dev); struct resource *res = NULL; Index: sys/dev/ata/chipsets/ata-promise.c =================================================================== --- sys/dev/ata/chipsets/ata-promise.c +++ sys/dev/ata/chipsets/ata-promise.c @@ -191,18 +191,19 @@ !BUS_READ_IVAR(device_get_parent(GRANDPARENT(dev)), GRANDPARENT(dev), PCI_IVAR_DEVID, &devid) && ((devid == ATA_DEC_21150) || (devid == ATA_DEC_21150_1))) { - static long start = 0, end = 0; + static rman_res_t start = 0; + static rman_res_t count = 0; if (pci_get_slot(dev) == 1) { - bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &end); + bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &count); strcat(buffer, " (channel 0+1)"); } - else if (pci_get_slot(dev) == 2 && start && end) { - bus_set_resource(dev, SYS_RES_IRQ, 0, start, end); + else if (pci_get_slot(dev) == 2 && start && count) { + bus_set_resource(dev, SYS_RES_IRQ, 0, start, count); strcat(buffer, " (channel 2+3)"); } else { - start = end = 0; + start = count = 0; } } sprintf(buffer, "%s %s controller", buffer, ata_mode2str(idx->max_dma)); Index: sys/dev/atkbdc/atkbdc_ebus.c =================================================================== --- sys/dev/atkbdc/atkbdc_ebus.c +++ sys/dev/atkbdc/atkbdc_ebus.c @@ -91,7 +91,7 @@ atkbdc_ebus_probe(device_t dev) { struct resource *port0, *port1; - u_long count, start; + rman_res_t count, start; int error, rid; if (strcmp(ofw_bus_get_name(dev), "8042") != 0) @@ -176,7 +176,7 @@ atkbdc_device_t *adi; device_t cdev; phandle_t child; - u_long count, intr, start; + rman_res_t count, intr, start; int children, error, rid, unit; char *cname, *dname; Index: sys/dev/atkbdc/atkbdc_isa.c =================================================================== --- sys/dev/atkbdc/atkbdc_isa.c +++ sys/dev/atkbdc/atkbdc_isa.c @@ -50,8 +50,8 @@ static device_t atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *atkbdc_isa_alloc_resource(device_t dev, device_t child, - int type, int *rid, u_long start, u_long end, - u_long count, u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); static int atkbdc_isa_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); @@ -97,8 +97,8 @@ { struct resource *port0; struct resource *port1; - u_long start; - u_long count; + rman_res_t start; + rman_res_t count; int error; int rid; #if defined(__i386__) || defined(__amd64__) @@ -295,7 +295,7 @@ struct resource * atkbdc_isa_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { atkbdc_softc_t *sc; Index: sys/dev/atkbdc/atkbdc_subr.c =================================================================== --- sys/dev/atkbdc/atkbdc_subr.c +++ sys/dev/atkbdc/atkbdc_subr.c @@ -51,7 +51,7 @@ atkbdc_print_child(device_t bus, device_t dev) { atkbdc_device_t *kbdcdev; - u_long irq; + rman_res_t irq; int flags; int retval = 0; @@ -63,7 +63,7 @@ retval += printf(" flags 0x%x", flags); irq = bus_get_resource_start(dev, SYS_RES_IRQ, kbdcdev->rid); if (irq != 0) - retval += printf(" irq %ld", irq); + retval += printf(" irq %jd", irq); retval += bus_print_child_footer(bus, dev); return (retval); Index: sys/dev/bxe/bxe.c =================================================================== --- sys/dev/bxe/bxe.c +++ sys/dev/bxe/bxe.c @@ -13403,7 +13403,7 @@ sc->bar[i].handle = rman_get_bushandle(sc->bar[i].resource); sc->bar[i].kva = (vm_offset_t)rman_get_virtual(sc->bar[i].resource); - BLOGI(sc, "PCI BAR%d [%02x] memory allocated: %p-%p (%ld) -> %p\n", + BLOGI(sc, "PCI BAR%d [%02x] memory allocated: %p-%p (%jd) -> %p\n", i, PCIR_BAR(i), (void *)rman_get_start(sc->bar[i].resource), (void *)rman_get_end(sc->bar[i].resource), Index: sys/dev/cardbus/cardbus_cis.c =================================================================== --- sys/dev/cardbus/cardbus_cis.c +++ sys/dev/cardbus/cardbus_cis.c @@ -485,7 +485,8 @@ "to read CIS.\n"); return (NULL); } - DEVPRINTF((cbdev, "CIS Mapped to %#lx\n", rman_get_start(res))); + DEVPRINTF((cbdev, "CIS Mapped to %#jx\n", + rman_get_start(res))); /* Flip to the right ROM image if CIS is in ROM */ if (space == PCIM_CIS_ASI_ROM) { Index: sys/dev/cm/if_cm_isa.c =================================================================== --- sys/dev/cm/if_cm_isa.c +++ sys/dev/cm/if_cm_isa.c @@ -64,7 +64,7 @@ rid = 0; sc->port_res = bus_alloc_resource( - dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, CM_IO_PORTS, RF_ACTIVE); + dev, SYS_RES_IOPORT, &rid, 0, ~0, CM_IO_PORTS, RF_ACTIVE); if (sc->port_res == NULL) return (ENOENT); @@ -75,7 +75,7 @@ rid = 0; sc->mem_res = bus_alloc_resource( - dev, SYS_RES_MEMORY, &rid, 0ul, ~0ul, CM_MEM_SIZE, RF_ACTIVE); + dev, SYS_RES_MEMORY, &rid, 0, ~0, CM_MEM_SIZE, RF_ACTIVE); if (sc->mem_res == NULL) { cm_release_resources(dev); return (ENOENT); Index: sys/dev/cs/if_cs.c =================================================================== --- sys/dev/cs/if_cs.c +++ sys/dev/cs/if_cs.c @@ -258,7 +258,7 @@ { int i; int error; - u_long irq, junk; + rman_res_t irq, junk; struct cs_softc *sc = device_get_softc(dev); unsigned rev_type = 0; uint16_t id; @@ -407,7 +407,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res == NULL) return (ENOENT); sc->port_rid = rid; Index: sys/dev/ct/ct_isa.c =================================================================== --- sys/dev/ct/ct_isa.c +++ sys/dev/ct/ct_isa.c @@ -318,7 +318,7 @@ *memhp = NULL; port_rid = 0; - *iohp = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid, 0ul, ~0ul, + *iohp = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid, 0, ~0, BSHW_IOSZ, RF_ACTIVE); if (*iohp == NULL) return ENXIO; @@ -327,7 +327,7 @@ return 0; mem_rid = 0; - *memhp = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, 0ul, ~0ul, + *memhp = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, 0, ~0, BSHW_MEMSZ, RF_ACTIVE); if (*memhp == NULL) { bus_release_resource(dev, SYS_RES_IOPORT, port_rid, *iohp); Index: sys/dev/ctau/if_ct.c =================================================================== --- sys/dev/ctau/if_ct.c +++ sys/dev/ctau/if_ct.c @@ -317,8 +317,8 @@ static char dmatab [] = { 7, 6, 5, 0 }; static char irqtab [] = { 5, 10, 11, 7, 3, 15, 12, 0 }; -static int ct_is_free_res (device_t dev, int rid, int type, u_long start, - u_long end, u_long count) +static int ct_is_free_res (device_t dev, int rid, int type, rman_res_t start, + rman_res_t end, rman_res_t count) { struct resource *res; @@ -332,7 +332,7 @@ static void ct_identify (driver_t *driver, device_t dev) { - u_long iobase, rescount; + rman_res_t iobase, rescount; int devcount; device_t *devices; device_t child; @@ -440,7 +440,7 @@ static int ct_probe (device_t dev) { int unit = device_get_unit (dev); - u_long iobase, rescount; + rman_res_t iobase, rescount; if (!device_get_desc (dev) || strcmp (device_get_desc (dev), "Cronyx Tau-ISA")) @@ -459,7 +459,7 @@ } if (!ct_probe_board (iobase, -1, -1)) { - printf ("ct%d: probing for Tau-ISA at %lx faild\n", unit, iobase); + printf ("ct%d: probing for Tau-ISA at %jx faild\n", unit, iobase); return ENXIO; } @@ -529,7 +529,7 @@ static int ct_attach (device_t dev) { bdrv_t *bd = device_get_softc (dev); - u_long iobase, drq, irq, rescount; + rman_res_t iobase, drq, irq, rescount; int unit = device_get_unit (dev); char *ct_ln = CT_LOCK_NAME; ct_board_t *b; @@ -632,7 +632,7 @@ ct_ln[2] = '0' + unit; mtx_init (&bd->ct_mtx, ct_ln, MTX_NETWORK_LOCK, MTX_DEF|MTX_RECURSE); if (! probe_irq (b, irq)) { - printf ("ct%d: irq %ld not functional\n", unit, irq); + printf ("ct%d: irq %jd not functional\n", unit, irq); bd->board = 0; adapter [unit] = 0; free (b, M_DEVBUF); @@ -651,7 +651,7 @@ if (bus_setup_intr (dev, bd->irq_res, INTR_TYPE_NET|INTR_MPSAFE, NULL, ct_intr, bd, &bd->intrhand)) { - printf ("ct%d: Can't setup irq %ld\n", unit, irq); + printf ("ct%d: Can't setup irq %jd\n", unit, irq); bd->board = 0; adapter [unit] = 0; free (b, M_DEVBUF); Index: sys/dev/cx/if_cx.c =================================================================== --- sys/dev/cx/if_cx.c +++ sys/dev/cx/if_cx.c @@ -405,8 +405,8 @@ static char dmatab [] = { 7, 6, 5, 0 }; static char irqtab [] = { 5, 10, 11, 7, 3, 15, 12, 0 }; -static int cx_is_free_res (device_t dev, int rid, int type, u_long start, - u_long end, u_long count) +static int cx_is_free_res (device_t dev, int rid, int type, rman_res_t start, + rman_res_t end, rman_res_t count) { struct resource *res; @@ -420,7 +420,7 @@ static void cx_identify (driver_t *driver, device_t dev) { - u_long iobase, rescount; + rman_res_t iobase, rescount; int devcount; device_t *devices; device_t child; @@ -530,7 +530,7 @@ { int unit = device_get_unit (dev); int i; - u_long iobase, rescount; + rman_res_t iobase, rescount; if (!device_get_desc (dev) || strcmp (device_get_desc (dev), "Cronyx Sigma")) @@ -629,7 +629,7 @@ static int cx_attach (device_t dev) { bdrv_t *bd = device_get_softc (dev); - u_long iobase, drq, irq, rescount; + rman_res_t iobase, drq, irq, rescount; int unit = device_get_unit (dev); char *cx_ln = CX_LOCK_NAME; cx_board_t *b; Index: sys/dev/cy/cy_isa.c =================================================================== --- sys/dev/cy/cy_isa.c +++ sys/dev/cy/cy_isa.c @@ -81,7 +81,7 @@ mem_rid = 0; mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, - 0ul, ~0ul, 0ul, RF_ACTIVE); + 0, ~0, 0, RF_ACTIVE); if (mem_res == NULL) { device_printf(dev, "ioport resource allocation failed\n"); return (ENXIO); @@ -113,7 +113,7 @@ mem_rid = 0; mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, - 0ul, ~0ul, 0ul, RF_ACTIVE); + 0, ~0, 0, RF_ACTIVE); if (mem_res == NULL) { device_printf(dev, "memory resource allocation failed\n"); goto fail; @@ -127,7 +127,7 @@ } irq_rid = 0; - irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, 0ul, ~0ul, 0ul, + irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, 0, ~0, 0, RF_SHAREABLE | RF_ACTIVE); if (irq_res == NULL) { device_printf(dev, "interrupt resource allocation failed\n"); Index: sys/dev/cy/cy_pci.c =================================================================== --- sys/dev/cy/cy_pci.c +++ sys/dev/cy/cy_pci.c @@ -115,7 +115,7 @@ ioport_rid = CY_PCI_BASE_ADDR1; ioport_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &ioport_rid, - 0ul, ~0ul, 0ul, RF_ACTIVE); + 0, ~0, 0, RF_ACTIVE); if (ioport_res == NULL) { device_printf(dev, "ioport resource allocation failed\n"); goto fail; @@ -124,7 +124,7 @@ mem_rid = CY_PCI_BASE_ADDR2; mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, - 0ul, ~0ul, 0ul, RF_ACTIVE); + 0, ~0, 0, RF_ACTIVE); if (mem_res == NULL) { device_printf(dev, "memory resource allocation failed\n"); goto fail; @@ -138,7 +138,7 @@ } irq_rid = 0; - irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, 0ul, ~0ul, 0ul, + irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &irq_rid, 0, ~0, 0, RF_SHAREABLE | RF_ACTIVE); if (irq_res == NULL) { device_printf(dev, "interrupt resource allocation failed\n"); Index: sys/dev/digi/digi_isa.c =================================================================== --- sys/dev/digi/digi_isa.c +++ sys/dev/digi/digi_isa.c @@ -278,7 +278,7 @@ /* Temporarily map our io ports */ sc->res.iorid = 0; sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, - 0ul, ~0ul, IO_SIZE, RF_ACTIVE); + 0, ~0, IO_SIZE, RF_ACTIVE); if (sc->res.io == NULL) return (ENXIO); @@ -292,7 +292,7 @@ /* Temporarily map our memory */ sc->res.mrid = 0; sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, - 0ul, ~0ul, sc->win_size, 0); + 0, ~0, sc->win_size, 0); if (sc->res.mem == NULL) { device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, @@ -343,7 +343,7 @@ /* Allocate resources (verified in digi_isa_probe()) */ sc->res.iorid = 0; sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, - 0ul, ~0ul, iosize, RF_ACTIVE); + 0, ~0, iosize, RF_ACTIVE); if (sc->res.io == NULL) return (ENXIO); @@ -357,7 +357,7 @@ sc->res.mrid = 0; sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, - 0ul, ~0ul, msize, RF_ACTIVE); + 0, ~0, msize, RF_ACTIVE); if (sc->res.mem == NULL) { device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); sc->hidewin(sc); Index: sys/dev/drm2/i915/i915_dma.c =================================================================== --- sys/dev/drm2/i915/i915_dma.c +++ sys/dev/drm2/i915/i915_dma.c @@ -1142,7 +1142,7 @@ vga = device_get_parent(dev->dev); dev_priv->mch_res_rid = 0x100; dev_priv->mch_res = BUS_ALLOC_RESOURCE(device_get_parent(vga), - dev->dev, SYS_RES_MEMORY, &dev_priv->mch_res_rid, 0, ~0UL, + dev->dev, SYS_RES_MEMORY, &dev_priv->mch_res_rid, 0, ~0, MCHBAR_SIZE, RF_ACTIVE | RF_SHAREABLE); if (dev_priv->mch_res == NULL) { DRM_DEBUG_DRIVER("failed bus alloc\n"); Index: sys/dev/ed/if_ed.c =================================================================== --- sys/dev/ed/if_ed.c +++ sys/dev/ed/if_ed.c @@ -164,7 +164,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res) { sc->port_res = res; sc->port_used = size; @@ -185,7 +185,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res) { sc->mem_res = res; sc->mem_used = size; Index: sys/dev/ed/if_ed_3c503.c =================================================================== --- sys/dev/ed/if_ed_3c503.c +++ sys/dev/ed/if_ed_3c503.c @@ -74,7 +74,7 @@ int i; u_int memsize; u_char isa16bit; - u_long conf_maddr, conf_msize, irq, junk, pmem; + rman_res_t conf_maddr, conf_msize, irq, junk, pmem; error = ed_alloc_port(dev, 0, ED_3COM_IO_PORTS); if (error) @@ -324,7 +324,7 @@ ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ5); break; default: - device_printf(dev, "Invalid irq configuration (%ld) must be 3-5,9 for 3c503\n", + device_printf(dev, "Invalid irq configuration (%jd) must be 3-5,9 for 3c503\n", irq); return (ENXIO); } Index: sys/dev/ed/if_ed_cbus.c =================================================================== --- sys/dev/ed/if_ed_cbus.c +++ sys/dev/ed/if_ed_cbus.c @@ -607,7 +607,7 @@ { struct ed_softc *sc = device_get_softc(dev); int error; - u_long conf_maddr, conf_msize; + rman_res_t conf_maddr, conf_msize; error = bus_get_resource(dev, SYS_RES_MEMORY, 0, &conf_maddr, &conf_msize); @@ -1001,7 +1001,7 @@ struct ed_softc *sc = device_get_softc(dev); int error; u_char tmp; - u_long conf_irq, junk; + rman_res_t conf_irq, junk; #ifdef DIAGNOSTIC u_char tmp_s; #endif @@ -1021,7 +1021,7 @@ if (((rman_get_start(sc->port_res) & 0x0fff) != 0x03d0) || ((rman_get_start(sc->port_res) & 0xf000) < (u_short) 0xa000)) { #ifdef DIAGNOSTIC - device_printf(dev, "Invalid i/o port configuration (0x%lx) " + device_printf(dev, "Invalid i/o port configuration (0x%jx) " "must be %s for %s\n", rman_get_start(sc->port_res), "0x[a-f]3d0", "CNET98"); #endif @@ -1032,7 +1032,7 @@ /* Check window area address */ tmp_s = rman_get_start(sc->mem_res) >> 12; if (tmp_s < 0x80) { - device_printf(dev, "Please change window address(0x%lx)\n", + device_printf(dev, "Please change window address(0x%jx)\n", rman_get_start(sc->mem_res)); return (ENXIO); } @@ -1040,8 +1040,8 @@ tmp_s &= 0x0f; tmp = rman_get_start(sc->port_res) >> 12; if ((tmp_s <= tmp) && (tmp < (tmp_s + 4))) { - device_printf(dev, "Please change iobase address(0x%lx) " - "or window address(0x%lx)\n", + device_printf(dev, "Please change iobase address(0x%jx) " + "or window address(0x%jx)\n", rman_get_start(sc->port_res), rman_get_start(sc->mem_res)); return (ENXIO); @@ -1128,7 +1128,7 @@ tmp = ED_CNET98_INT_IRQ13; break; default: - device_printf(dev, "Invalid irq configuration (%ld) must be " + device_printf(dev, "Invalid irq configuration (%jd) must be " "%s for %s\n", conf_irq, "3,5,6,9,12,13", "CNET98"); return (ENXIO); } @@ -1157,7 +1157,7 @@ int error; int i; u_char romdata[ETHER_ADDR_LEN * 2], tmp; - u_long conf_irq, junk; + rman_res_t conf_irq, junk; error = ed98_alloc_port(dev, port_rid); if (error) @@ -1169,7 +1169,7 @@ /* Check I/O address. 0x[0-f]3d0 are allowed. */ if ((rman_get_start(sc->port_res) & 0x0fff) != 0x03d0) { #ifdef DIAGNOSTIC - device_printf(dev, "Invalid i/o port configuration (0x%lx) " + device_printf(dev, "Invalid i/o port configuration (0x%jx) " "must be %s for %s\n", rman_get_start(sc->port_res), "0x?3d0", "CNET98E/L"); #endif @@ -1223,7 +1223,7 @@ break; #endif default: - device_printf(dev, "Invalid irq configuration (%ld) must be " + device_printf(dev, "Invalid irq configuration (%jd) must be " "%s for %s\n", conf_irq, "3,5,6", "CNET98E/L"); return (ENXIO); } @@ -1251,7 +1251,7 @@ struct ed_softc *sc = device_get_softc(dev); int error; u_char tmp; - u_long conf_irq, junk; + rman_res_t conf_irq, junk; error = ed98_probe_Novell(dev, port_rid, flags); if (error) @@ -1285,7 +1285,7 @@ tmp = ED_NEC77_IRQ13; break; default: - device_printf(dev, "Invalid irq configuration (%ld) must be " + device_printf(dev, "Invalid irq configuration (%jd) must be " "%s for %s\n", conf_irq, "3,5,6,12,13", "PC-9801-77"); return (ENXIO); } @@ -1303,7 +1303,7 @@ struct ed_softc *sc = device_get_softc(dev); int error; u_char tmp; - u_long conf_irq, junk; + rman_res_t conf_irq, junk; error = ed98_probe_Novell(dev, port_rid, flags); if (error) @@ -1337,7 +1337,7 @@ tmp = ED_NW98X_IRQ13; break; default: - device_printf(dev, "Invalid irq configuration (%ld) must be " + device_printf(dev, "Invalid irq configuration (%jd) must be " "%s for %s\n", conf_irq, "3,5,6,12,13", "EC/EP-98X"); return (ENXIO); } @@ -1427,7 +1427,7 @@ struct ed_softc *sc = device_get_softc(dev); int error; u_char tmp; - u_long conf_irq, junk; + rman_res_t conf_irq, junk; error = ed98_alloc_port(dev, port_rid); if (error) @@ -1439,7 +1439,7 @@ /* Check I/O address. 00d[02468ace] are allowed. */ if ((rman_get_start(sc->port_res) & ~0x000e) != 0x00d0) { #ifdef DIAGNOSTIC - device_printf(dev, "Invalid i/o port configuration (0x%lx) " + device_printf(dev, "Invalid i/o port configuration (0x%jx) " "must be %s for %s\n", rman_get_start(sc->port_res), "0xd?", "SB9801"); #endif @@ -1475,7 +1475,7 @@ tmp = ED_SB98_CFG_IRQ12; break; default: - device_printf(dev, "Invalid irq configuration (%ld) must be " + device_printf(dev, "Invalid irq configuration (%jd) must be " "%s for %s\n", conf_irq, "3,5,6,12", "SB9801"); return (ENXIO); } Index: sys/dev/ed/if_ed_hpp.c =================================================================== --- sys/dev/ed/if_ed_hpp.c +++ sys/dev/ed/if_ed_hpp.c @@ -126,7 +126,7 @@ u_char irq; /* board configured IRQ */ uint8_t test_pattern[ED_HPP_TEST_SIZE]; /* read/write areas for */ uint8_t test_buffer[ED_HPP_TEST_SIZE]; /* probing card */ - u_long conf_maddr, conf_msize, conf_irq, junk; + rman_res_t conf_maddr, conf_msize, conf_irq, junk; error = ed_alloc_port(dev, 0, ED_HPP_IO_PORTS); if (error) Index: sys/dev/ed/if_ed_pccard.c =================================================================== --- sys/dev/ed/if_ed_pccard.c +++ sys/dev/ed/if_ed_pccard.c @@ -510,7 +510,7 @@ if (rman_get_size(sc->port_res) == ED_NOVELL_IO_PORTS / 2) { port_rid++; sc->port_res2 = bus_alloc_resource(dev, SYS_RES_IOPORT, - &port_rid, 0ul, ~0ul, 1, RF_ACTIVE); + &port_rid, 0, ~0, 1, RF_ACTIVE); if (sc->port_res2 == NULL || rman_get_size(sc->port_res2) != ED_NOVELL_IO_PORTS / 2) { error = ENXIO; Index: sys/dev/ed/if_ed_wd80x3.c =================================================================== --- sys/dev/ed/if_ed_wd80x3.c +++ sys/dev/ed/if_ed_wd80x3.c @@ -97,7 +97,7 @@ int i; u_int memsize; u_char iptr, isa16bit, sum, totalsum; - u_long irq, junk, pmem; + rman_res_t irq, junk, pmem; sc->chip_type = ED_CHIP_TYPE_DP8390; Index: sys/dev/eisa/eisaconf.c =================================================================== --- sys/dev/eisa/eisaconf.c +++ sys/dev/eisa/eisaconf.c @@ -352,14 +352,14 @@ static struct resource * eisa_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { int isdefault; struct eisa_device *e_dev = device_get_ivars(child); struct resource *rv, **rvp = 0; isdefault = (device_get_parent(child) == dev && - start == 0UL && end == ~0UL && count == 1); + start == 0 && end == ~0 && count == 1); switch (type) { case SYS_RES_IRQ: Index: sys/dev/fb/s3_pci.c =================================================================== --- sys/dev/fb/s3_pci.c +++ sys/dev/fb/s3_pci.c @@ -479,7 +479,7 @@ */ rid = 0; if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, 0, RF_ACTIVE | RF_SHAREABLE))) { + 0, ~0, 0, RF_ACTIVE | RF_SHAREABLE))) { printf("%s: port resource allocation failed!\n", __func__); goto error; } @@ -488,7 +488,7 @@ rid = 1; if (!(sc->enh_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, 0, RF_ACTIVE | RF_SHAREABLE))) { + 0, ~0, 0, RF_ACTIVE | RF_SHAREABLE))) { printf("%s: enhanced port resource allocation failed!\n", __func__); goto error; Index: sys/dev/fdc/fdc_isa.c =================================================================== --- sys/dev/fdc/fdc_isa.c +++ sys/dev/fdc/fdc_isa.c @@ -90,7 +90,7 @@ for (rid = 0; ; rid++) { newrid = rid; res = bus_alloc_resource(dev, SYS_RES_IOPORT, &newrid, - 0ul, ~0ul, rid == 0 ? nport : 1, RF_ACTIVE); + 0, ~0, rid == 0 ? nport : 1, RF_ACTIVE); if (res == NULL) break; /* Index: sys/dev/fdc/fdc_pccard.c =================================================================== --- sys/dev/fdc/fdc_pccard.c +++ sys/dev/fdc/fdc_pccard.c @@ -56,7 +56,7 @@ int rid, i; rid = 0; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, 1, + res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE); if (res == NULL) { device_printf(dev, "cannot alloc I/O port range\n"); Index: sys/dev/fdt/simplebus.c =================================================================== --- sys/dev/fdt/simplebus.c +++ sys/dev/fdt/simplebus.c @@ -46,7 +46,7 @@ static int simplebus_probe(device_t dev); static int simplebus_attach(device_t dev); static struct resource *simplebus_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static void simplebus_probe_nomatch(device_t bus, device_t child); static int simplebus_print_child(device_t bus, device_t child); static device_t simplebus_add_child(device_t dev, u_int order, @@ -322,7 +322,7 @@ static struct resource * simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct simplebus_softc *sc; struct simplebus_devinfo *di; @@ -335,7 +335,7 @@ * Request for the default allocation with a given rid: use resource * list stored in the local device info. */ - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); @@ -369,7 +369,7 @@ 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); } @@ -387,8 +387,8 @@ if (di == NULL) return (0); rv = 0; - rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#lx"); - rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%ld"); + rv += resource_list_print_type(&di->rl, "mem", SYS_RES_MEMORY, "%#jx"); + rv += resource_list_print_type(&di->rl, "irq", SYS_RES_IRQ, "%jd"); return (rv); } Index: sys/dev/fe/if_fe.c =================================================================== --- sys/dev/fe/if_fe.c +++ sys/dev/fe/if_fe.c @@ -881,7 +881,7 @@ rid = 0; res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + 0, ~0, size, RF_ACTIVE); if (res) { sc->port_used = size; sc->port_res = res; Index: sys/dev/fe/if_fe_cbus.c =================================================================== --- sys/dev/fe/if_fe_cbus.c +++ sys/dev/fe/if_fe_cbus.c @@ -298,7 +298,7 @@ { struct fe_softc *sc = device_get_softc(dev); int i, n; - u_long iobase, irq; + rman_res_t iobase, irq; u_char sum; static struct fe_simple_probe_struct probe_table [] = { @@ -398,7 +398,7 @@ { struct fe_softc *sc = device_get_softc(dev); int i, n, xirq, error; - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [JLI_EEPROM_SIZE]; u_short const * irqmap; @@ -524,7 +524,7 @@ fe_probe_cnet9ne (device_t dev) { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; static struct fe_simple_probe_struct probe_table [] = { { FE_DLCR2, 0x58, 0x00 }, @@ -598,7 +598,7 @@ fe_probe_ssi(device_t dev) { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [SSI_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { @@ -676,7 +676,7 @@ { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [LNX_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { @@ -804,7 +804,7 @@ struct fe_softc *sc = device_get_softc(dev); u_char sum, save7; - u_long iobase, irq; + rman_res_t iobase, irq; int i; static struct fe_simple_probe_struct const probe_table [] = { { FE_DLCR2, 0x58, 0x00 }, @@ -949,7 +949,7 @@ struct fe_softc *sc = device_get_softc(dev); int i; - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [REX_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { Index: sys/dev/fe/if_fe_isa.c =================================================================== --- sys/dev/fe/if_fe_isa.c +++ sys/dev/fe/if_fe_isa.c @@ -203,7 +203,7 @@ { struct fe_softc *sc = device_get_softc(dev); int n; - u_long iobase, irq; + rman_res_t iobase, irq; static u_short const irqmap [ 4 ] = { 3, 7, 10, 15 }; @@ -698,7 +698,7 @@ { struct fe_softc *sc = device_get_softc(dev); int i, n, error, xirq; - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [JLI_EEPROM_SIZE]; u_short const * irqmap; @@ -816,7 +816,7 @@ fe_probe_ssi(device_t dev) { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [SSI_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { @@ -878,7 +878,7 @@ fe_probe_lnx(device_t dev) { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; u_char eeprom [LNX_EEPROM_SIZE]; static struct fe_simple_probe_struct probe_table [] = { @@ -946,7 +946,7 @@ fe_probe_gwy(device_t dev) { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; static struct fe_simple_probe_struct probe_table [] = { /* { FE_DLCR2, 0x70, 0x00 }, */ @@ -999,7 +999,7 @@ fe_probe_ubn(device_t dev) { struct fe_softc *sc = device_get_softc(dev); - u_long iobase, irq; + rman_res_t iobase, irq; #if 0 u_char sum; #endif Index: sys/dev/gpio/gpiobus.c =================================================================== --- sys/dev/gpio/gpiobus.c +++ sys/dev/gpio/gpiobus.c @@ -488,7 +488,7 @@ static int gpiobus_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct gpiobus_ivar *devi; struct resource_list_entry *rle; @@ -506,7 +506,7 @@ static struct resource * gpiobus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct gpiobus_softc *sc; struct resource *rv; @@ -516,7 +516,7 @@ if (type != SYS_RES_IRQ) return (NULL); - isdefault = (start == 0UL && end == ~0UL && count == 1); + isdefault = (start == 0 && end == ~0 && count == 1); rle = NULL; if (isdefault) { rl = BUS_GET_RESOURCE_LIST(bus, child); Index: sys/dev/hpt27xx/hpt27xx_osm_bsd.c =================================================================== --- sys/dev/hpt27xx/hpt27xx_osm_bsd.c +++ sys/dev/hpt27xx/hpt27xx_osm_bsd.c @@ -1261,7 +1261,7 @@ for (hba = vbus_ext->hba_list; hba; hba = hba->next) { int rid = 0; if ((hba->irq_res = bus_alloc_resource(hba->pcidev, - SYS_RES_IRQ, &rid, 0, ~0ul, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) + SYS_RES_IRQ, &rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { os_printk("can't allocate interrupt"); return ; Index: sys/dev/hptiop/hptiop.c =================================================================== --- sys/dev/hptiop/hptiop.c +++ sys/dev/hptiop/hptiop.c @@ -2053,7 +2053,7 @@ rid = 0; if ((hba->irq_res = bus_alloc_resource(hba->pcidev, SYS_RES_IRQ, - &rid, 0, ~0ul, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + &rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { device_printf(dev, "allocate irq failed!\n"); goto free_hba_path; } Index: sys/dev/hptmv/entry.c =================================================================== --- sys/dev/hptmv/entry.c +++ sys/dev/hptmv/entry.c @@ -1990,7 +1990,7 @@ return rid; rid = 0; - if ((pAdapter->hpt_irq = bus_alloc_resource(pAdapter->hpt_dev, SYS_RES_IRQ, &rid, 0, ~0ul, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) + if ((pAdapter->hpt_irq = bus_alloc_resource(pAdapter->hpt_dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { hpt_printk(("can't allocate interrupt\n")); return(ENXIO); Index: sys/dev/hptnr/hptnr_osm_bsd.c =================================================================== --- sys/dev/hptnr/hptnr_osm_bsd.c +++ sys/dev/hptnr/hptnr_osm_bsd.c @@ -1446,7 +1446,7 @@ for (hba = vbus_ext->hba_list; hba; hba = hba->next) { int rid = 0; if ((hba->irq_res = bus_alloc_resource(hba->pcidev, - SYS_RES_IRQ, &rid, 0, ~0ul, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) + SYS_RES_IRQ, &rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { os_printk("can't allocate interrupt"); return ; Index: sys/dev/hptrr/hptrr_osm_bsd.c =================================================================== --- sys/dev/hptrr/hptrr_osm_bsd.c +++ sys/dev/hptrr/hptrr_osm_bsd.c @@ -1094,7 +1094,7 @@ for (hba = vbus_ext->hba_list; hba; hba = hba->next) { int rid = 0; if ((hba->irq_res = bus_alloc_resource(hba->pcidev, - SYS_RES_IRQ, &rid, 0, ~0ul, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) + SYS_RES_IRQ, &rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) { os_printk("can't allocate interrupt"); return ; Index: sys/dev/ichsmb/ichsmb_pci.c =================================================================== --- sys/dev/ichsmb/ichsmb_pci.c +++ sys/dev/ichsmb/ichsmb_pci.c @@ -241,7 +241,7 @@ &sc->io_rid, 0, ~0, 16, RF_ACTIVE); if (sc->io_res == NULL) sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->io_rid, 0ul, ~0ul, 32, RF_ACTIVE); + &sc->io_rid, 0, ~0, 32, RF_ACTIVE); if (sc->io_res == NULL) { device_printf(dev, "can't map I/O\n"); error = ENXIO; Index: sys/dev/if_ndis/if_ndis_pccard.c =================================================================== --- sys/dev/if_ndis/if_ndis_pccard.c +++ sys/dev/if_ndis/if_ndis_pccard.c @@ -281,7 +281,7 @@ sc = arg; rid = NDIS_AM_RID; sc->ndis_res_am = bus_alloc_resource(sc->ndis_dev, SYS_RES_MEMORY, - &rid, 0UL, ~0UL, 0x1000, RF_ACTIVE); + &rid, 0, ~0, 0x1000, RF_ACTIVE); if (sc->ndis_res_am == NULL) { device_printf(sc->ndis_dev, Index: sys/dev/iicbus/iicoc.c =================================================================== --- sys/dev/iicbus/iicoc.c +++ sys/dev/iicbus/iicoc.c @@ -208,7 +208,7 @@ mtx_init(&sc->sc_mtx, "iicoc", "iicoc", MTX_DEF); sc->mem_rid = 0; sc->mem_res = bus_alloc_resource(dev, - SYS_RES_MEMORY, &sc->mem_rid, 0ul, ~0ul, 0x100, RF_ACTIVE); + SYS_RES_MEMORY, &sc->mem_rid, 0, ~0, 0x100, RF_ACTIVE); if (sc->mem_res == NULL) { device_printf(dev, "Could not allocate bus resource.\n"); Index: sys/dev/iir/iir_pci.c =================================================================== --- sys/dev/iir/iir_pci.c +++ sys/dev/iir/iir_pci.c @@ -228,7 +228,7 @@ /* check and reset interface area */ bus_write_4(gdt->sc_dpmem, GDT_MPR_IC, htole32(GDT_MPR_MAGIC)); if (bus_read_4(gdt->sc_dpmem, GDT_MPR_IC) != htole32(GDT_MPR_MAGIC)) { - device_printf(dev, "cannot access DPMEM at 0x%lx (shadowed?)\n", + device_printf(dev, "cannot access DPMEM at 0x%jx (shadowed?)\n", rman_get_start(gdt->sc_dpmem)); error = ENXIO; goto err; Index: sys/dev/mca/mca_bus.c =================================================================== --- sys/dev/mca/mca_bus.c +++ sys/dev/mca/mca_bus.c @@ -365,11 +365,11 @@ rid = 0; while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IOPORT, rid++))) { if (rle->count == 1) { - snprintf(buf, sizeof(buf), "%s%lx", + snprintf(buf, sizeof(buf), "%s%jx", ((rid == 1) ? "io 0x" : "0x"), rle->start); } else { - snprintf(buf, sizeof(buf), "%s%lx-0x%lx", + snprintf(buf, sizeof(buf), "%s%jx-0x%jx", ((rid == 1) ? "io 0x" : "0x"), rle->start, (rle->start + rle->count)); @@ -381,11 +381,11 @@ rid = 0; while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_MEMORY, rid++))) { if (rle->count == 1) { - snprintf(buf, sizeof(buf), "%s%lx", + snprintf(buf, sizeof(buf), "%s%jx", ((rid == 1) ? "mem 0x" : "0x"), rle->start); } else { - snprintf(buf, sizeof(buf), "%s%lx-0x%lx", + snprintf(buf, sizeof(buf), "%s%jx-0x%jx", ((rid == 1) ? "mem 0x" : "0x"), rle->start, (rle->start + rle->count)); @@ -396,14 +396,14 @@ rid = 0; while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IRQ, rid++))) { - snprintf(buf, sizeof(buf), "irq %ld", rle->start); + snprintf(buf, sizeof(buf), "irq %jd", rle->start); mca_reg_print(child, buf, ((rid == 1) ? &separator : NULL), &column); } rid = 0; while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_DRQ, rid++))) { - snprintf(buf, sizeof(buf), "drq %lx", rle->start); + snprintf(buf, sizeof(buf), "drq %jx", rle->start); mca_reg_print(child, buf, ((rid == 1) ? &separator : NULL), &column); } @@ -456,14 +456,14 @@ static struct resource * mca_alloc_resource (device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct mca_device * m_dev = device_get_ivars(child); struct resource_list_entry * rle; int isdefault; int passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != dev); if (!passthrough && !isdefault) { Index: sys/dev/mvs/mvs_pci.c =================================================================== --- sys/dev/mvs/mvs_pci.c +++ sys/dev/mvs/mvs_pci.c @@ -389,7 +389,8 @@ static struct resource * mvs_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct mvs_controller *ctlr = device_get_softc(dev); int unit = ((struct mvs_channel *)device_get_softc(child))->unit; Index: sys/dev/mvs/mvs_soc.c =================================================================== --- sys/dev/mvs/mvs_soc.c +++ sys/dev/mvs/mvs_soc.c @@ -336,7 +336,7 @@ static struct resource * mvs_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct mvs_controller *ctlr = device_get_softc(dev); int unit = ((struct mvs_channel *)device_get_softc(child))->unit; Index: sys/dev/mxge/if_mxge.c =================================================================== --- sys/dev/mxge/if_mxge.c +++ sys/dev/mxge/if_mxge.c @@ -4612,7 +4612,7 @@ device_printf(sc->dev, "using %d msix IRQs:", sc->num_slices); for (i = 0; i < sc->num_slices; i++) - printf(" %ld", rman_get_start(sc->msix_irq_res[i])); + printf(" %jd", rman_get_start(sc->msix_irq_res[i])); printf("\n"); } return (0); @@ -4668,7 +4668,7 @@ return ENXIO; } if (mxge_verbose) - device_printf(sc->dev, "using %s irq %ld\n", + device_printf(sc->dev, "using %s irq %jd\n", sc->legacy_irq ? "INTx" : "MSI", rman_get_start(sc->irq_res)); err = bus_setup_intr(sc->dev, sc->irq_res, @@ -4823,7 +4823,7 @@ sc->sram = rman_get_virtual(sc->mem_res); sc->sram_size = 2*1024*1024 - (2*(48*1024)+(32*1024)) - 0x100; if (sc->sram_size > rman_get_size(sc->mem_res)) { - device_printf(dev, "impossible memory region size %ld\n", + device_printf(dev, "impossible memory region size %jd\n", rman_get_size(sc->mem_res)); err = ENXIO; goto abort_with_mem_res; Index: sys/dev/ncv/ncr53c500_pccard.c =================================================================== --- sys/dev/ncv/ncr53c500_pccard.c +++ sys/dev/ncv/ncr53c500_pccard.c @@ -142,7 +142,7 @@ { struct ncv_softc *sc = device_get_softc(dev); u_int32_t flags = device_get_flags(dev); - u_long ioaddr, iosize, maddr, msize; + rman_res_t ioaddr, iosize, maddr, msize; int error; bus_addr_t offset = 0; Index: sys/dev/nsp/nsp_pccard.c =================================================================== --- sys/dev/nsp/nsp_pccard.c +++ sys/dev/nsp/nsp_pccard.c @@ -115,7 +115,7 @@ nsp_alloc_resource(device_t dev) { struct nsp_softc *sc = device_get_softc(dev); - u_long ioaddr, iosize, maddr, msize; + rman_res_t ioaddr, iosize, maddr, msize; int error; error = bus_get_resource(dev, SYS_RES_IOPORT, 0, &ioaddr, &iosize); Index: sys/dev/ntb/ntb_hw/ntb_hw.c =================================================================== --- sys/dev/ntb/ntb_hw/ntb_hw.c +++ sys/dev/ntb/ntb_hw/ntb_hw.c @@ -749,7 +749,7 @@ * Ideally I could have just specified the size when I allocated the * resource like: * bus_alloc_resource(ntb->device, - * SYS_RES_MEMORY, &bar->pci_resource_id, 0ul, ~0ul, + * SYS_RES_MEMORY, &bar->pci_resource_id, 0, ~0, * 1ul << bar_size_bits, RF_ACTIVE); * but the PCI driver does not honor the size in this call, so we have * to modify it after the fact. Index: sys/dev/oce/oce_hw.c =================================================================== --- sys/dev/oce/oce_hw.c +++ sys/dev/oce/oce_hw.c @@ -270,7 +270,7 @@ else sc->devcfg_res = bus_alloc_resource(sc->dev, SYS_RES_MEMORY, &rr, - 0ul, ~0ul, 32768, + 0, ~0, 32768, RF_ACTIVE|RF_SHAREABLE); if (!sc->devcfg_res) Index: sys/dev/ofw/ofwbus.c =================================================================== --- sys/dev/ofw/ofwbus.c +++ sys/dev/ofw/ofwbus.c @@ -178,7 +178,7 @@ static struct resource * ofwbus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ofwbus_softc *sc; struct rman *rm; @@ -186,7 +186,7 @@ struct resource_list_entry *rle; int isdefault, passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != bus); sc = device_get_softc(bus); rle = NULL; @@ -200,8 +200,8 @@ return (NULL); } start = rle->start; - count = ulmax(count, rle->count); - end = ulmax(rle->end, start + count - 1); + count = ummax(count, rle->count); + end = ummax(rle->end, start + count - 1); } switch (type) { @@ -239,7 +239,7 @@ static int ofwbus_adjust_resource(device_t bus, device_t child __unused, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct ofwbus_softc *sc; struct rman *rm; Index: sys/dev/pccard/pccard.c =================================================================== --- sys/dev/pccard/pccard.c +++ sys/dev/pccard/pccard.c @@ -97,9 +97,9 @@ const char *name, int type, int count, const char *format); static int pccard_print_child(device_t dev, device_t child); static int pccard_set_resource(device_t dev, device_t child, int type, - int rid, u_long start, u_long count); + int rid, rman_res_t start, rman_res_t count); static int pccard_get_resource(device_t dev, device_t child, int type, - int rid, u_long *startp, u_long *countp); + int rid, rman_res_t *startp, rman_res_t *countp); static void pccard_delete_resource(device_t dev, device_t child, int type, int rid); static int pccard_set_res_flags(device_t dev, device_t child, int type, @@ -113,8 +113,8 @@ uintptr_t *result); static void pccard_driver_added(device_t dev, driver_t *driver); static struct resource *pccard_alloc_resource(device_t dev, - device_t child, int type, int *rid, u_long start, - u_long end, u_long count, u_int flags); + device_t child, int type, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags); static int pccard_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); static void pccard_child_detached(device_t parent, device_t dev); @@ -474,7 +474,7 @@ struct pccard_ce_iospace *ios; struct pccard_ce_memspace *mems; device_t bus; - u_long start, end, len; + rman_res_t start, end, len; int i, rid, spaces; if (pf->pf_flags & PFF_ENABLED) { @@ -506,8 +506,8 @@ if (start) end = start + ios->length - 1; else - end = ~0UL; - DEVPRINTF((bus, "I/O rid %d start %#lx end %#lx\n", + end = ~0; + DEVPRINTF((bus, "I/O rid %d start %#jx end %#jx\n", i, start, end)); rid = i; len = ios->length; @@ -530,8 +530,8 @@ if (start) end = start + mems->length - 1; else - end = ~0UL; - DEVPRINTF((bus, "Memory rid %d start %#lx end %#lx\ncardaddr %#lx hostaddr %#lx length %#lx\n", + end = ~0; + DEVPRINTF((bus, "Memory rid %d start %#jx end %#jx\ncardaddr %#jx hostaddr %#jx length %#jx\n", i, start, end, mems->cardaddr, mems->hostaddr, mems->length)); rid = i; @@ -602,7 +602,7 @@ device_printf(pf->sc->dev, "function_free: Resource still owned by " "child, oops. " - "(type=%d, rid=%d, addr=%#lx)\n", + "(type=%d, rid=%d, addr=%#jx)\n", rle->type, rle->rid, rman_get_start(rle->res)); BUS_RELEASE_RESOURCE(device_get_parent(pf->sc->dev), @@ -614,8 +614,8 @@ } static void -pccard_mfc_adjust_iobase(struct pccard_function *pf, bus_addr_t addr, - bus_addr_t offset, bus_size_t size) +pccard_mfc_adjust_iobase(struct pccard_function *pf, rman_res_t addr, + rman_res_t offset, rman_res_t size) { bus_size_t iosize, tmp; @@ -697,7 +697,7 @@ &pf->ccr_rid, 0, ~0, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE); if (!pf->ccr_res) goto bad; - DEVPRINTF((dev, "ccr_res == %#lx-%#lx, base=%#x\n", + DEVPRINTF((dev, "ccr_res == %#jx-%#jx, base=%#x\n", rman_get_start(pf->ccr_res), rman_get_end(pf->ccr_res), pf->ccr_base)); CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY, @@ -923,7 +923,7 @@ static int pccard_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct pccard_ivar *devi = PCCARD_IVAR(child); struct resource_list *rl = &devi->resources; @@ -952,7 +952,7 @@ static int pccard_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { struct pccard_ivar *devi = PCCARD_IVAR(child); struct resource_list *rl = &devi->resources; @@ -1132,12 +1132,12 @@ static struct resource * pccard_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { 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 = (start == 0 && end == ~0 && count == 1); struct resource *r = NULL; /* XXX I'm no longer sure this is right */ @@ -1197,7 +1197,7 @@ if (!rle) { device_printf(dev, "Allocated resource not found, " - "%d %#x %#lx %#lx\n", + "%d %#x %#jx %#jx\n", type, rid, rman_get_start(r), rman_get_size(r)); return ENOENT; } Index: sys/dev/pccard/pccard_cis.c =================================================================== --- sys/dev/pccard/pccard_cis.c +++ sys/dev/pccard/pccard_cis.c @@ -151,7 +151,7 @@ tuple.memh = rman_get_bushandle(res); tuple.ptr = 0; - DPRINTF(("cis mem map %#x (resource: %#lx)\n", + DPRINTF(("cis mem map %#x (resource: %#jx)\n", (unsigned int) tuple.memh, rman_get_start(res))); tuple.mult = 2; @@ -576,9 +576,9 @@ printf("; iomask %#lx, iospace", cfe->iomask); for (i = 0; i < cfe->num_iospace; i++) { - printf(" %#lx", cfe->iospace[i].start); + printf(" %#jx", cfe->iospace[i].start); if (cfe->iospace[i].length) - printf("-%#lx", + printf("-%#jx", cfe->iospace[i].start + cfe->iospace[i].length - 1); } @@ -587,14 +587,14 @@ printf("; memspace"); for (i = 0; i < cfe->num_memspace; i++) { - printf(" %#lx", + printf(" %#jx", cfe->memspace[i].cardaddr); if (cfe->memspace[i].length) - printf("-%#lx", + printf("-%#jx", cfe->memspace[i].cardaddr + cfe->memspace[i].length - 1); if (cfe->memspace[i].hostaddr) - printf("@%#lx", + printf("@%#jx", cfe->memspace[i].hostaddr); } } Index: sys/dev/pccard/pccardvarp.h =================================================================== --- sys/dev/pccard/pccardvarp.h +++ sys/dev/pccard/pccardvarp.h @@ -48,14 +48,14 @@ #define PCCARD_CFE_AUDIO 0x0800 struct pccard_ce_iospace { - u_long length; - u_long start; + rman_res_t length; + rman_res_t start; }; struct pccard_ce_memspace { - u_long length; - u_long cardaddr; - u_long hostaddr; + rman_res_t length; + rman_res_t cardaddr; + rman_res_t hostaddr; }; struct pccard_config_entry { Index: sys/dev/pccbb/pccbb.c =================================================================== --- sys/dev/pccbb/pccbb.c +++ sys/dev/pccbb/pccbb.c @@ -166,8 +166,8 @@ static int cbb_cardbus_deactivate_resource(device_t brdev, device_t child, int type, int rid, struct resource *res); static struct resource *cbb_cardbus_alloc_resource(device_t brdev, - device_t child, int type, int *rid, u_long start, - u_long end, u_long count, u_int flags); + device_t child, int type, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags); static int cbb_cardbus_release_resource(device_t brdev, device_t child, int type, int rid, struct resource *res); static int cbb_cardbus_power_enable_socket(device_t brdev, @@ -229,7 +229,7 @@ while ((rle = SLIST_FIRST(&sc->rl)) != NULL) { device_printf(sc->dev, "Danger Will Robinson: Resource " "left allocated! This is a bug... " - "(rid=%x, type=%d, addr=%lx)\n", rle->rid, rle->type, + "(rid=%x, type=%d, addr=%jx)\n", rle->rid, rle->type, rman_get_start(rle->res)); SLIST_REMOVE_HEAD(&sc->rl, link); free(rle, M_DEVBUF); @@ -1230,19 +1230,19 @@ static struct resource * cbb_cardbus_alloc_resource(device_t brdev, device_t child, int type, - int *rid, u_long start, u_long end, u_long count, u_int flags) + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct cbb_softc *sc = device_get_softc(brdev); int tmp; struct resource *res; - u_long align; + rman_res_t align; switch (type) { case SYS_RES_IRQ: tmp = rman_get_start(sc->irq_res); if (start > tmp || end < tmp || count != 1) { - device_printf(child, "requested interrupt %ld-%ld," - "count = %ld not supported by cbb\n", + device_printf(child, "requested interrupt %jd-%jd," + "count = %jd not supported by cbb\n", start, end, count); return (NULL); } @@ -1395,7 +1395,7 @@ static struct resource * cbb_pcic_alloc_resource(device_t brdev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res = NULL; struct cbb_softc *sc = device_get_softc(brdev); @@ -1425,8 +1425,8 @@ case SYS_RES_IRQ: tmp = rman_get_start(sc->irq_res); if (start > tmp || end < tmp || count != 1) { - device_printf(child, "requested interrupt %ld-%ld," - "count = %ld not supported by cbb\n", + device_printf(child, "requested interrupt %jd-%jd," + "count = %jd not supported by cbb\n", start, end, count); return (NULL); } @@ -1538,7 +1538,7 @@ struct resource * cbb_alloc_resource(device_t brdev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct cbb_softc *sc = device_get_softc(brdev); Index: sys/dev/pccbb/pccbb_pci.c =================================================================== --- sys/dev/pccbb/pccbb_pci.c +++ sys/dev/pccbb/pccbb_pci.c @@ -313,7 +313,7 @@ mtx_destroy(&sc->mtx); return (ENOMEM); } else { - DEVPRINTF((brdev, "Found memory at %08lx\n", + DEVPRINTF((brdev, "Found memory at %jx\n", rman_get_start(sc->base_res))); } @@ -783,7 +783,7 @@ #if defined(NEW_PCIB) && defined(PCI_RES_BUS) static struct resource * cbb_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct cbb_softc *sc; @@ -797,7 +797,7 @@ static int cbb_pci_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct cbb_softc *sc; Index: sys/dev/pccbb/pccbbvar.h =================================================================== --- sys/dev/pccbb/pccbbvar.h +++ sys/dev/pccbb/pccbbvar.h @@ -113,7 +113,7 @@ int cbb_activate_resource(device_t brdev, device_t child, int type, int rid, struct resource *r); struct resource *cbb_alloc_resource(device_t brdev, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, + int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); void cbb_child_detached(device_t brdev, device_t child); int cbb_child_present(device_t parent, device_t child); Index: sys/dev/pcf/pcf_isa.c =================================================================== --- sys/dev/pcf/pcf_isa.c +++ sys/dev/pcf/pcf_isa.c @@ -100,7 +100,7 @@ static int pcf_isa_probe(device_t dev) { - u_long start, count; + rman_res_t start, count; u_int rid = 0, port, error; /* skip PnP probes */ Index: sys/dev/pci/hostb_pci.c =================================================================== --- sys/dev/pci/hostb_pci.c +++ sys/dev/pci/hostb_pci.c @@ -102,7 +102,7 @@ static struct resource * pci_hostb_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); Index: sys/dev/pci/isa_pci.c =================================================================== --- sys/dev/pci/isa_pci.c +++ sys/dev/pci/isa_pci.c @@ -52,8 +52,8 @@ static int isab_pci_probe(device_t dev); static int isab_pci_attach(device_t dev); static struct resource * isab_pci_alloc_resource(device_t dev, - device_t child, int type, int *rid, u_long start, u_long end, u_long count, - u_int flags); + device_t child, int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); static int isab_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); @@ -169,7 +169,7 @@ static struct resource * isab_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct isab_pci_softc *sc; int bar; Index: sys/dev/pci/pci.c =================================================================== --- sys/dev/pci/pci.c +++ sys/dev/pci/pci.c @@ -1559,7 +1559,7 @@ if (bootverbose) { rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, 1); if (actual == 1) - device_printf(child, "using IRQ %lu for MSI-X\n", + device_printf(child, "using IRQ %ju for MSI-X\n", rle->start); else { int run; @@ -1569,7 +1569,7 @@ * IRQ values as ranges. 'irq' is the previous IRQ. * 'run' is true if we are in a range. */ - device_printf(child, "using IRQs %lu", rle->start); + device_printf(child, "using IRQs %ju", rle->start); irq = rle->start; run = 0; for (i = 1; i < actual; i++) { @@ -1590,7 +1590,7 @@ } /* Start new range. */ - printf(",%lu", rle->start); + printf(",%ju", rle->start); irq = rle->start; } @@ -2968,13 +2968,6 @@ */ if (!force && (basezero || map == testval)) return (barlen); - if ((u_long)base != base) { - device_printf(bus, - "pci%d:%d:%d:%d bar %#x too many address bits", - pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), - pci_get_function(dev), reg); - return (barlen); - } /* * This code theoretically does the right thing, but has @@ -3008,7 +3001,7 @@ flags |= RF_PREFETCHABLE; if (basezero || base == pci_mapbase(testval) || pci_clear_bars) { start = 0; /* Let the parent decide. */ - end = ~0ul; + end = ~0; } else { start = base; end = base + count - 1; @@ -3023,7 +3016,7 @@ */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, flags); - if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) { + if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) { /* * If the allocation fails, try to allocate a resource for * this BAR using any available range. The firmware felt @@ -3031,8 +3024,8 @@ * disable decoding if we can help it. */ resource_list_delete(rl, type, reg); - resource_list_add(rl, type, reg, 0, ~0ul, count); - res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0ul, + resource_list_add(rl, type, reg, 0, ~0, count); + res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0, count, flags); } if (res == NULL) { @@ -3353,7 +3346,7 @@ { struct resource *res; char *cp; - u_long start, end, count; + rman_res_t start, end, count; int rid, sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; switch (cfg->hdrtype & PCIM_HDRTYPE) { @@ -3423,7 +3416,7 @@ end = sub_bus; count = end - start + 1; - resource_list_add(rl, PCI_RES_BUS, 0, 0ul, ~0ul, count); + resource_list_add(rl, PCI_RES_BUS, 0, 0, ~0, count); /* * If requested, clear secondary bus registers in @@ -3453,8 +3446,8 @@ } static struct resource * -pci_alloc_secbus(device_t dev, device_t child, int *rid, u_long start, - u_long end, u_long count, u_int flags) +pci_alloc_secbus(device_t dev, device_t child, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags) { struct pci_devinfo *dinfo; pcicfgregs *cfg; @@ -3488,13 +3481,13 @@ start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { resource_list_delete(rl, PCI_RES_BUS, *rid); - device_printf(child, "allocating %lu bus%s failed\n", + device_printf(child, "allocating %ju bus%s failed\n", count, count == 1 ? "" : "es"); return (NULL); } if (bootverbose) device_printf(child, - "Lazy allocation of %lu bus%s at %lu\n", count, + "Lazy allocation of %ju bus%s at %ju\n", count, count == 1 ? "" : "es", rman_get_start(res)); PCI_WRITE_CONFIG(dev, child, sec_reg, rman_get_start(res), 1); PCI_WRITE_CONFIG(dev, child, sub_reg, rman_get_end(res), 1); @@ -4126,9 +4119,9 @@ retval += bus_print_child_header(dev, child); - retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx"); - retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx"); - retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld"); + retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#jx"); + retval += resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#jx"); + retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); if (device_get_flags(dev)) retval += printf(" flags %#x", device_get_flags(dev)); @@ -4618,7 +4611,8 @@ static struct resource * pci_reserve_map(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int num, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int num, + u_int flags) { struct pci_devinfo *dinfo = device_get_ivars(child); struct resource_list *rl = &dinfo->resources; @@ -4700,13 +4694,13 @@ if (res == NULL) { resource_list_delete(rl, type, *rid); device_printf(child, - "%#lx bytes of rid %#x res %d failed (%#lx, %#lx).\n", + "%#jx bytes of rid %#x res %d failed (%#jx, %#jx).\n", count, *rid, type, start, end); goto out; } if (bootverbose) device_printf(child, - "Lazy allocation of %#lx bytes rid %#x type %d at %#lx\n", + "Lazy allocation of %#jx bytes rid %#x type %d at %#jx\n", count, *rid, type, rman_get_start(res)); map = rman_get_start(res); pci_write_bar(child, pm, map); @@ -4716,7 +4710,8 @@ struct resource * pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_long num, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_long num, + u_int flags) { struct pci_devinfo *dinfo; struct resource_list *rl; @@ -4791,7 +4786,7 @@ struct resource * pci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { #ifdef PCI_IOV struct pci_devinfo *dinfo; @@ -4982,7 +4977,7 @@ resource_list_busy(rl, type, rid)) { device_printf(dev, "delete_resource: " "Resource still owned by child, oops. " - "(type=%d, rid=%d, addr=%lx)\n", + "(type=%d, rid=%d, addr=%jx)\n", type, rid, rman_get_start(rle->res)); return; } Index: sys/dev/pci/pci_host_generic.c =================================================================== --- sys/dev/pci/pci_host_generic.c +++ sys/dev/pci/pci_host_generic.c @@ -124,8 +124,8 @@ static int generic_pcie_write_ivar(device_t dev, device_t child, int index, uintptr_t value); static struct resource *generic_pcie_alloc_resource(device_t dev, - device_t child, int type, int *rid, u_long start, u_long end, - u_long count, u_int flags); + device_t child, int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); static int generic_pcie_release_resource(device_t dev, device_t child, int type, int rid, struct resource *res); @@ -482,7 +482,7 @@ static struct resource * generic_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct generic_pcie_softc *sc; struct resource *res; @@ -527,7 +527,7 @@ static int generic_pcie_adjust_resource(device_t dev, device_t child, int type, - struct resource *res, u_long start, u_long end) + struct resource *res, rman_res_t start, rman_res_t end) { struct generic_pcie_softc *sc; struct rman *rm; Index: sys/dev/pci/pci_iov.c =================================================================== --- sys/dev/pci/pci_iov.c +++ sys/dev/pci/pci_iov.c @@ -320,7 +320,7 @@ struct resource *res; struct pcicfg_iov *iov; device_t dev, bus; - u_long start, end; + rman_res_t start, end; pci_addr_t bar_size; int rid; @@ -330,8 +330,8 @@ rid = iov->iov_pos + PCIR_SRIOV_BAR(bar); bar_size = 1 << bar_shift; - res = pci_alloc_multi_resource(bus, dev, SYS_RES_MEMORY, &rid, 0ul, - ~0ul, 1, iov->iov_num_vfs, RF_ACTIVE); + res = pci_alloc_multi_resource(bus, dev, SYS_RES_MEMORY, &rid, 0, + ~0, 1, iov->iov_num_vfs, RF_ACTIVE); if (res == NULL) return (ENXIO); @@ -498,7 +498,7 @@ int error; iov->rman.rm_start = 0; - iov->rman.rm_end = ~0ul; + iov->rman.rm_end = ~0; iov->rman.rm_type = RMAN_ARRAY; snprintf(iov->rman_name, sizeof(iov->rman_name), "%s VF I/O memory", device_get_nameunit(pf)); @@ -890,15 +890,15 @@ } struct resource * -pci_vf_alloc_mem_resource(device_t dev, device_t child, int *rid, u_long start, - u_long end, u_long count, u_int flags) +pci_vf_alloc_mem_resource(device_t dev, device_t child, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pci_devinfo *dinfo; struct pcicfg_iov *iov; struct pci_map *map; struct resource *res; struct resource_list_entry *rle; - u_long bar_start, bar_end; + rman_res_t bar_start, bar_end; pci_addr_t bar_length; int error; Index: sys/dev/pci/pci_pci.c =================================================================== --- sys/dev/pci/pci_pci.c +++ sys/dev/pci/pci_pci.c @@ -212,9 +212,10 @@ * ISA alias range. */ static int -pcib_is_isa_range(struct pcib_softc *sc, u_long start, u_long end, u_long count) +pcib_is_isa_range(struct pcib_softc *sc, rman_res_t start, rman_res_t end, + rman_res_t count) { - u_long next_alias; + rman_res_t next_alias; if (!(sc->bridgectl & PCIB_BCR_ISA_ENABLE)) return (0); @@ -246,7 +247,7 @@ alias: if (bootverbose) device_printf(sc->dev, - "I/O range %#lx-%#lx overlaps with an ISA alias\n", start, + "I/O range %#jx-%#jx overlaps with an ISA alias\n", start, end); return (1); } @@ -275,13 +276,13 @@ } } -typedef void (nonisa_callback)(u_long start, u_long end, void *arg); +typedef void (nonisa_callback)(rman_res_t start, rman_res_t end, void *arg); static void -pcib_walk_nonisa_ranges(u_long start, u_long end, nonisa_callback *cb, +pcib_walk_nonisa_ranges(rman_res_t start, rman_res_t end, nonisa_callback *cb, void *arg) { - u_long next_end; + rman_res_t next_end; /* * If start is within an ISA alias range, move up to the start @@ -309,7 +310,7 @@ } static void -count_ranges(u_long start, u_long end, void *arg) +count_ranges(rman_res_t start, rman_res_t end, void *arg) { int *countp; @@ -324,7 +325,7 @@ }; static void -alloc_ranges(u_long start, u_long end, void *arg) +alloc_ranges(rman_res_t start, rman_res_t end, void *arg) { struct alloc_state *as; struct pcib_window *w; @@ -338,7 +339,7 @@ rid = w->reg; if (bootverbose) device_printf(as->sc->dev, - "allocating non-ISA range %#lx-%#lx\n", start, end); + "allocating non-ISA range %#jx-%#jx\n", start, end); as->res[as->count] = bus_alloc_resource(as->sc->dev, SYS_RES_IOPORT, &rid, start, end, end - start + 1, 0); if (as->res[as->count] == NULL) @@ -348,7 +349,7 @@ } static int -pcib_alloc_nonisa_ranges(struct pcib_softc *sc, u_long start, u_long end) +pcib_alloc_nonisa_ranges(struct pcib_softc *sc, rman_res_t start, rman_res_t end) { struct alloc_state as; int i, new_count; @@ -387,8 +388,8 @@ char buf[64]; int error, rid; - if (max_address != (u_long)max_address) - max_address = ~0ul; + if (max_address != (rman_res_t)max_address) + max_address = ~(rman_res_t)0; w->rman.rm_start = 0; w->rman.rm_end = max_address; w->rman.rm_type = RMAN_ARRAY; @@ -576,14 +577,14 @@ * if one exists, or a new bus range if one does not. */ rid = 0; - bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0ul, ~0ul, + bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0, ~0, min_count, 0); if (bus->res == NULL) { /* * Fall back to just allocating a range of a single bus * number. */ - bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0ul, ~0ul, + bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0, ~0, 1, 0); } else if (rman_get_size(bus->res) < min_count) /* @@ -609,7 +610,7 @@ static struct resource * pcib_suballoc_bus(struct pcib_secbus *bus, device_t child, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; @@ -620,7 +621,7 @@ if (bootverbose) device_printf(bus->dev, - "allocated bus range (%lu-%lu) for rid %d of %s\n", + "allocated bus range (%ju-%ju) for rid %d of %s\n", rman_get_start(res), rman_get_end(res), *rid, pcib_child_name(child)); rman_set_rid(res, *rid); @@ -633,9 +634,9 @@ * subbus. */ static int -pcib_grow_subbus(struct pcib_secbus *bus, u_long new_end) +pcib_grow_subbus(struct pcib_secbus *bus, rman_res_t new_end) { - u_long old_end; + rman_res_t old_end; int error; old_end = rman_get_end(bus->res); @@ -645,7 +646,7 @@ if (error) return (error); if (bootverbose) - device_printf(bus->dev, "grew bus range to %lu-%lu\n", + device_printf(bus->dev, "grew bus range to %ju-%ju\n", rman_get_start(bus->res), rman_get_end(bus->res)); error = rman_manage_region(&bus->rman, old_end + 1, rman_get_end(bus->res)); @@ -658,10 +659,10 @@ struct resource * pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; - u_long start_free, end_free, new_end; + rman_res_t start_free, end_free, new_end; /* * First, see if the request can be satisified by the existing @@ -693,8 +694,8 @@ /* Finally, attempt to grow the existing resource. */ if (bootverbose) { device_printf(bus->dev, - "attempting to grow bus range for %lu buses\n", count); - printf("\tback candidate range: %lu-%lu\n", start_free, + "attempting to grow bus range for %ju buses\n", count); + printf("\tback candidate range: %ju-%ju\n", start_free, new_end); } if (pcib_grow_subbus(bus, new_end) == 0) @@ -1158,8 +1159,8 @@ */ static struct resource * pcib_suballoc_resource(struct pcib_softc *sc, struct pcib_window *w, - device_t child, int type, int *rid, u_long start, u_long end, u_long count, - u_int flags) + device_t child, int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags) { struct resource *res; @@ -1173,7 +1174,7 @@ if (bootverbose) device_printf(sc->dev, - "allocated %s range (%#lx-%#lx) for rid %x of %s\n", + "allocated %s range (%#jx-%#jx) for rid %x of %s\n", w->name, rman_get_start(res), rman_get_end(res), *rid, pcib_child_name(child)); rman_set_rid(res, *rid); @@ -1196,10 +1197,10 @@ /* Allocate a fresh resource range for an unconfigured window. */ static int pcib_alloc_new_window(struct pcib_softc *sc, struct pcib_window *w, int type, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; - u_long base, limit, wmask; + rman_res_t base, limit, wmask; int rid; /* @@ -1269,7 +1270,7 @@ /* Try to expand an existing window to the requested base and limit. */ static int pcib_expand_window(struct pcib_softc *sc, struct pcib_window *w, int type, - u_long base, u_long limit) + rman_res_t base, rman_res_t limit) { struct resource *res; int error, i, force_64k_base; @@ -1367,9 +1368,9 @@ */ static int pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { - u_long align, start_free, end_free, front, back, wmask; + rman_res_t align, start_free, end_free, front, back, wmask; int error; /* @@ -1388,7 +1389,7 @@ end = w->rman.rm_end; if (start + count - 1 > end || start + count < start) return (EINVAL); - wmask = (1ul << w->step) - 1; + wmask = ((rman_res_t)1 << w->step) - 1; /* * If there is no resource at all, just try to allocate enough @@ -1400,7 +1401,7 @@ if (error) { if (bootverbose) device_printf(sc->dev, - "failed to allocate initial %s window (%#lx-%#lx,%#lx)\n", + "failed to allocate initial %s window (%#jx-%#jx,%#jx)\n", w->name, start, end, count); return (error); } @@ -1432,9 +1433,9 @@ */ if (bootverbose) device_printf(sc->dev, - "attempting to grow %s window for (%#lx-%#lx,%#lx)\n", + "attempting to grow %s window for (%#jx-%#jx,%#jx)\n", w->name, start, end, count); - align = 1ul << RF_ALIGNMENT(flags); + align = (rman_res_t)1 << RF_ALIGNMENT(flags); if (start < w->base) { if (rman_first_free_region(&w->rman, &start_free, &end_free) != 0 || start_free != w->base) @@ -1456,7 +1457,7 @@ */ if (front >= start && front <= end_free) { if (bootverbose) - printf("\tfront candidate range: %#lx-%#lx\n", + printf("\tfront candidate range: %#jx-%#jx\n", front, end_free); front &= ~wmask; front = w->base - front; @@ -1484,7 +1485,7 @@ */ if (back <= end && start_free <= back) { if (bootverbose) - printf("\tback candidate range: %#lx-%#lx\n", + printf("\tback candidate range: %#jx-%#jx\n", start_free, back); back |= wmask; back -= w->limit; @@ -1534,7 +1535,7 @@ */ struct resource * pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pcib_softc *sc; struct resource *r; @@ -1623,7 +1624,7 @@ int pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *r, - u_long start, u_long end) + rman_res_t start, rman_res_t end) { struct pcib_softc *sc; @@ -1658,7 +1659,7 @@ */ struct resource * pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pcib_softc *sc = device_get_softc(dev); const char *name, *suffix; @@ -1708,7 +1709,7 @@ #endif } if (end < start) { - device_printf(dev, "ioport: end (%lx) < start (%lx)\n", + device_printf(dev, "ioport: end (%jx) < start (%jx)\n", end, start); start = 0; end = 0; @@ -1716,13 +1717,13 @@ } if (!ok) { device_printf(dev, "%s%srequested unsupported I/O " - "range 0x%lx-0x%lx (decoding 0x%x-0x%x)\n", + "range 0x%jx-0x%jx (decoding 0x%x-0x%x)\n", name, suffix, start, end, sc->iobase, sc->iolimit); return (NULL); } if (bootverbose) device_printf(dev, - "%s%srequested I/O range 0x%lx-0x%lx: in range\n", + "%s%srequested I/O range 0x%jx-0x%jx: in range\n", name, suffix, start, end); break; @@ -1777,7 +1778,7 @@ #endif } if (end < start) { - device_printf(dev, "memory: end (%lx) < start (%lx)\n", + device_printf(dev, "memory: end (%jx) < start (%jx)\n", end, start); start = 0; end = 0; @@ -1785,7 +1786,7 @@ } if (!ok && bootverbose) device_printf(dev, - "%s%srequested unsupported memory range %#lx-%#lx " + "%s%srequested unsupported memory range %#jx-%#jx " "(decoding %#jx-%#jx, %#jx-%#jx)\n", name, suffix, start, end, (uintmax_t)sc->membase, (uintmax_t)sc->memlimit, @@ -1794,7 +1795,7 @@ return (NULL); if (bootverbose) device_printf(dev,"%s%srequested memory range " - "0x%lx-0x%lx: good\n", + "0x%jx-0x%jx: good\n", name, suffix, start, end); break; Index: sys/dev/pci/pci_private.h =================================================================== --- sys/dev/pci/pci_private.h +++ sys/dev/pci/pci_private.h @@ -105,8 +105,8 @@ int pci_msix_pba_bar_method(device_t dev, device_t child); int pci_msix_table_bar_method(device_t dev, device_t child); struct resource *pci_alloc_resource(device_t dev, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, - u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); int pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int pci_activate_resource(device_t dev, device_t child, int type, @@ -151,8 +151,8 @@ pci_addr_t size); struct resource *pci_alloc_multi_resource(device_t dev, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, - u_long num, u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_long num, u_int flags); int pci_iov_attach_method(device_t bus, device_t dev, struct nvlist *pf_schema, struct nvlist *vf_schema); @@ -162,8 +162,8 @@ uint16_t rid, uint16_t vid, uint16_t did); struct resource *pci_vf_alloc_mem_resource(device_t dev, device_t child, - int *rid, u_long start, u_long end, u_long count, - u_int flags); + int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); int pci_vf_release_mem_resource(device_t dev, device_t child, int rid, struct resource *r); #endif /* _PCI_PRIVATE_H_ */ Index: sys/dev/pci/pci_subr.c =================================================================== --- sys/dev/pci/pci_subr.c +++ sys/dev/pci/pci_subr.c @@ -178,14 +178,14 @@ } int -pcib_host_res_decodes(struct pcib_host_resources *hr, int type, u_long start, - u_long end, u_int flags) +pcib_host_res_decodes(struct pcib_host_resources *hr, int type, rman_res_t start, + rman_res_t end, u_int flags) { struct resource_list_entry *rle; int rid; if (bootverbose) - device_printf(hr->hr_pcib, "decoding %d %srange %#lx-%#lx\n", + device_printf(hr->hr_pcib, "decoding %d %srange %#jx-%#jx\n", type, flags & RF_PREFETCHABLE ? "prefetchable ": "", start, end); rid = resource_list_add_next(&hr->hr_rl, type, start, end, @@ -201,11 +201,11 @@ struct resource * pcib_host_res_alloc(struct pcib_host_resources *hr, device_t dev, int type, - int *rid, u_long start, u_long end, u_long count, u_int flags) + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list_entry *rle; struct resource *r; - u_long new_start, new_end; + rman_res_t new_start, new_end; if (flags & RF_PREFETCHABLE) KASSERT(type == SYS_RES_MEMORY, @@ -229,8 +229,8 @@ if (((flags & RF_PREFETCHABLE) != 0) != ((rle->flags & RLE_PREFETCH) != 0)) continue; - new_start = ulmax(start, rle->start); - new_end = ulmin(end, rle->end); + new_start = ummax(start, rle->start); + new_end = ummin(end, rle->end); if (new_start > new_end || new_start + count - 1 > new_end || new_start + count < new_start) @@ -240,7 +240,7 @@ if (r != NULL) { if (bootverbose) device_printf(hr->hr_pcib, - "allocated type %d (%#lx-%#lx) for rid %x of %s\n", + "allocated type %d (%#jx-%#jx) for rid %x of %s\n", type, rman_get_start(r), rman_get_end(r), *rid, pcib_child_name(dev)); return (r); @@ -261,7 +261,7 @@ int pcib_host_res_adjust(struct pcib_host_resources *hr, device_t dev, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct resource_list_entry *rle; @@ -329,8 +329,8 @@ } struct resource * -pci_domain_alloc_bus(int domain, device_t dev, int *rid, u_long start, - u_long end, u_long count, u_int flags) +pci_domain_alloc_bus(int domain, device_t dev, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags) { struct pci_domain *d; struct resource *res; @@ -349,7 +349,7 @@ int pci_domain_adjust_bus(int domain, device_t dev, struct resource *r, - u_long start, u_long end) + rman_res_t start, rman_res_t end) { #ifdef INVARIANTS struct pci_domain *d; Index: sys/dev/pci/pcib_private.h =================================================================== --- sys/dev/pci/pcib_private.h +++ sys/dev/pci/pcib_private.h @@ -49,13 +49,13 @@ int pcib_host_res_free(device_t pcib, struct pcib_host_resources *hr); int pcib_host_res_decodes(struct pcib_host_resources *hr, int type, - u_long start, u_long end, u_int flags); + rman_res_t start, rman_res_t end, u_int flags); struct resource *pcib_host_res_alloc(struct pcib_host_resources *hr, - device_t dev, int type, int *rid, u_long start, u_long end, - u_long count, u_int flags); + device_t dev, int type, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags); int pcib_host_res_adjust(struct pcib_host_resources *hr, - device_t dev, int type, struct resource *r, u_long start, - u_long end); + device_t dev, int type, struct resource *r, rman_res_t start, + rman_res_t end); #endif /* @@ -132,13 +132,13 @@ int slot, int func, uint8_t *busnum); #if defined(NEW_PCIB) && defined(PCI_RES_BUS) struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int pci_domain_adjust_bus(int domain, device_t dev, - struct resource *r, u_long start, u_long end); + struct resource *r, rman_res_t start, rman_res_t end); int pci_domain_release_bus(int domain, device_t dev, int rid, struct resource *r); struct resource *pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, - int *rid, u_long start, u_long end, u_long count, + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); void pcib_setup_secbus(device_t dev, struct pcib_secbus *bus, int min_count); @@ -152,10 +152,11 @@ int pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); int pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value); struct resource *pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); #ifdef NEW_PCIB int pcib_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end); + struct resource *r, rman_res_t start, rman_res_t end); int pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); #endif Index: sys/dev/pci/pcivar.h =================================================================== --- sys/dev/pci/pcivar.h +++ sys/dev/pci/pcivar.h @@ -397,7 +397,7 @@ * Check if the address range falls within the VGA defined address range(s) */ static __inline int -pci_is_vga_ioport_range(u_long start, u_long end) +pci_is_vga_ioport_range(rman_res_t start, rman_res_t end) { return (((start >= 0x3b0 && end <= 0x3bb) || @@ -405,7 +405,7 @@ } static __inline int -pci_is_vga_memory_range(u_long start, u_long end) +pci_is_vga_memory_range(rman_res_t start, rman_res_t end) { return ((start >= 0xa0000 && end <= 0xbffff) ? 1 : 0); Index: sys/dev/pci/vga_pci.c =================================================================== --- sys/dev/pci/vga_pci.c +++ sys/dev/pci/vga_pci.c @@ -68,7 +68,8 @@ static struct vga_resource *lookup_res(struct vga_pci_softc *sc, int rid); static struct resource *vga_pci_alloc_resource(device_t dev, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags); static int vga_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); @@ -163,8 +164,8 @@ #endif rid = PCIR_BIOS; - res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0ul, - ~0ul, 1, RF_ACTIVE); + res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0, + ~0, 1, RF_ACTIVE); if (res == NULL) { return (NULL); } @@ -333,7 +334,7 @@ static struct resource * vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct vga_resource *vr; Index: sys/dev/ppc/ppc.c =================================================================== --- sys/dev/ppc/ppc.c +++ sys/dev/ppc/ppc.c @@ -1674,7 +1674,7 @@ #endif struct ppc_data *ppc; int error; - u_long port; + rman_res_t port; /* * Allocate the ppc_data structure. @@ -1699,7 +1699,7 @@ next_bios_ppc += 1; if (bootverbose) device_printf(dev, - "parallel port found at 0x%lx\n", port); + "parallel port found at 0x%jx\n", port); } #else if ((next_bios_ppc < BIOS_MAX_PPC) && @@ -1707,7 +1707,7 @@ port = *(BIOS_PORTS + next_bios_ppc++); if (bootverbose) device_printf(dev, - "parallel port found at 0x%lx\n", port); + "parallel port found at 0x%jx\n", port); } else { device_printf(dev, "parallel port not found.\n"); return (ENXIO); @@ -2015,7 +2015,7 @@ */ struct resource * ppc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ppc_data *ppc = DEVTOSOFTC(bus); Index: sys/dev/ppc/ppcvar.h =================================================================== --- sys/dev/ppc/ppcvar.h +++ sys/dev/ppc/ppcvar.h @@ -41,7 +41,7 @@ int ppc_exec_microseq(device_t, struct ppb_microseq **); struct resource *ppc_alloc_resource(device_t bus, device_t child, int type, - int *rid, u_long start, u_long end, u_long count, u_int flags); + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int ppc_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); int ppc_reset_epp(device_t); Index: sys/dev/proto/proto_bus_isa.c =================================================================== --- sys/dev/proto/proto_bus_isa.c +++ sys/dev/proto/proto_bus_isa.c @@ -80,7 +80,7 @@ return (ENODEV); sb = sbuf_new_auto(); - sbuf_printf(sb, "%s:%#lx", proto_isa_prefix, rman_get_start(res)); + sbuf_printf(sb, "%s:%#jx", proto_isa_prefix, rman_get_start(res)); sbuf_finish(sb); device_set_desc_copy(dev, sbuf_data(sb)); sbuf_delete(sb); Index: sys/dev/puc/puc.c =================================================================== --- sys/dev/puc/puc.c +++ sys/dev/puc/puc.c @@ -78,7 +78,7 @@ { struct puc_bar *bar; struct rman *rm; - u_long end, start; + rman_res_t end, start; int error, i; /* Find the BAR entry with the given RID. */ @@ -474,7 +474,7 @@ struct resource * puc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct puc_port *port; struct resource *res; @@ -495,7 +495,7 @@ return (NULL); /* We only support default allocations. */ - if (start != 0UL || end != ~0UL) + if (start != 0 || end != ~0) return (NULL); if (type == port->p_bar->b_type) @@ -567,11 +567,11 @@ int puc_bus_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { struct puc_port *port; struct resource *res; - u_long start; + rman_res_t start; /* Get our immediate child. */ while (child != NULL && device_get_parent(child) != dev) Index: sys/dev/puc/puc_bfe.h =================================================================== --- sys/dev/puc/puc_bfe.h +++ sys/dev/puc/puc_bfe.h @@ -85,9 +85,9 @@ int puc_bus_child_location_str(device_t, device_t, char *, size_t); int puc_bus_child_pnpinfo_str(device_t, device_t, char *, size_t); -struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); -int puc_bus_get_resource(device_t, device_t, int, int, u_long *, u_long *); +struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *, + rman_res_t, rman_res_t, rman_res_t, u_int); +int puc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *); int puc_bus_print_child(device_t, device_t); int puc_bus_read_ivar(device_t, device_t, int, uintptr_t *); int puc_bus_release_resource(device_t, device_t, int, int, struct resource *); Index: sys/dev/quicc/quicc_bfe.h =================================================================== --- sys/dev/quicc/quicc_bfe.h +++ sys/dev/quicc/quicc_bfe.h @@ -61,8 +61,9 @@ int quicc_bfe_probe(device_t, u_int); struct resource *quicc_bus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); -int quicc_bus_get_resource(device_t, device_t, int, int, u_long *, u_long *); + rman_res_t, rman_res_t, rman_res_t, u_int); +int quicc_bus_get_resource(device_t, device_t, int, int, + rman_res_t *, rman_res_t *); int quicc_bus_read_ivar(device_t, device_t, int, uintptr_t *); int quicc_bus_release_resource(device_t, device_t, int, int, struct resource *); int quicc_bus_setup_intr(device_t, device_t, struct resource *, int, Index: sys/dev/quicc/quicc_core.c =================================================================== --- sys/dev/quicc/quicc_core.c +++ sys/dev/quicc/quicc_core.c @@ -101,7 +101,7 @@ struct quicc_softc *sc; struct resource_list_entry *rle; const char *sep; - u_long size, start; + rman_res_t size, start; int error; sc = device_get_softc(dev); @@ -254,7 +254,7 @@ struct resource * quicc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct quicc_device *qd; struct resource_list_entry *rle; @@ -263,7 +263,7 @@ return (NULL); /* We only support default allocations. */ - if (start != 0UL || end != ~0UL) + if (start != 0 || end != ~0) return (NULL); qd = device_get_ivars(child); @@ -284,7 +284,7 @@ int quicc_bus_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { struct quicc_device *qd; struct resource_list_entry *rle; Index: sys/dev/rc/rc.c =================================================================== --- sys/dev/rc/rc.c +++ sys/dev/rc/rc.c @@ -243,7 +243,7 @@ for (i = 0; i < IOBASE_ADDRS; i++) { x = i; sc->sc_port[i] = bus_alloc_resource(dev, SYS_RES_IOPORT, &x, - 0ul, ~0ul, 0x10, RF_ACTIVE); + 0, ~0, 0x10, RF_ACTIVE); if (x != i) { device_printf(dev, "ioport %d was rid %d\n", i, x); goto fail; Index: sys/dev/sbni/if_sbni_isa.c =================================================================== --- sys/dev/sbni/if_sbni_isa.c +++ sys/dev/sbni/if_sbni_isa.c @@ -87,7 +87,7 @@ sc = device_get_softc(dev); sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid, - 0ul, ~0ul, SBNI_PORTS, RF_ACTIVE); + 0, ~0, SBNI_PORTS, RF_ACTIVE); if (!sc->io_res) { printf("sbni: cannot allocate io ports!\n"); return (ENOENT); Index: sys/dev/sbni/if_sbni_pci.c =================================================================== --- sys/dev/sbni/if_sbni_pci.c +++ sys/dev/sbni/if_sbni_pci.c @@ -96,7 +96,7 @@ sc->io_rid = PCIR_BAR(0); sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid, - 0ul, ~0ul, ports, RF_ACTIVE); + 0, ~0, ports, RF_ACTIVE); if (!sc->io_res) { device_printf(dev, "cannot allocate io ports!\n"); if (sc->slave_sc) Index: sys/dev/scc/scc_bfe.h =================================================================== --- sys/dev/scc/scc_bfe.h +++ sys/dev/scc/scc_bfe.h @@ -143,8 +143,8 @@ int scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid); struct resource *scc_bus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); -int scc_bus_get_resource(device_t, device_t, int, int, u_long *, u_long *); + rman_res_t, rman_res_t, rman_res_t, u_int); +int scc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *); int scc_bus_read_ivar(device_t, device_t, int, uintptr_t *); int scc_bus_release_resource(device_t, device_t, int, int, struct resource *); int scc_bus_setup_intr(device_t, device_t, struct resource *, int, Index: sys/dev/scc/scc_core.c =================================================================== --- sys/dev/scc/scc_core.c +++ sys/dev/scc/scc_core.c @@ -103,7 +103,7 @@ struct scc_softc *sc, *sc0; const char *sep; bus_space_handle_t bh; - u_long base, size, start, sz; + rman_res_t base, size, start, sz; int c, error, mode, sysdev; /* @@ -407,7 +407,7 @@ struct resource * scc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list_entry *rle; struct scc_chan *ch; @@ -417,7 +417,7 @@ return (NULL); /* We only support default allocations. */ - if (start != 0UL || end != ~0UL) + if (start != 0 || end != ~0) return (NULL); m = device_get_ivars(child); @@ -431,7 +431,7 @@ int scc_bus_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { struct resource_list_entry *rle; struct scc_chan *ch; Index: sys/dev/sdhci/sdhci_pci.c =================================================================== --- sys/dev/sdhci/sdhci_pci.c +++ sys/dev/sdhci/sdhci_pci.c @@ -331,7 +331,7 @@ /* Allocate memory. */ rid = PCIR_BAR(bar + i); sc->mem_res[i] = bus_alloc_resource(dev, SYS_RES_MEMORY, - &rid, 0ul, ~0ul, 0x100, RF_ACTIVE); + &rid, 0, ~0, 0x100, RF_ACTIVE); if (sc->mem_res[i] == NULL) { device_printf(dev, "Can't allocate memory for slot %d\n", i); continue; Index: sys/dev/siba/siba.c =================================================================== --- sys/dev/siba/siba.c +++ sys/dev/siba/siba.c @@ -92,8 +92,8 @@ struct resource *); static device_t siba_add_child(device_t, u_int, const char *, int); static struct resource * - siba_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + siba_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static int siba_attach(device_t); #ifdef notyet static void siba_destroy_devinfo(struct siba_devinfo *); @@ -371,7 +371,7 @@ static struct resource * siba_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *rv; struct resource_list *rl; @@ -383,7 +383,7 @@ printf("%s: entry\n", __func__); #endif - isdefault = (start == 0UL && end == ~0UL && count == 1); + isdefault = (start == 0 && end == ~0 && count == 1); needactivate = flags & RF_ACTIVE; rl = BUS_GET_RESOURCE_LIST(bus, child); rle = NULL; Index: sys/dev/siba/siba_bwn.c =================================================================== --- sys/dev/siba/siba_bwn.c +++ sys/dev/siba/siba_bwn.c @@ -242,7 +242,7 @@ /* proxying to the parent */ static struct resource * siba_bwn_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, Index: sys/dev/siba/siba_pcib.c =================================================================== --- sys/dev/siba/siba_pcib.c +++ sys/dev/siba/siba_pcib.c @@ -92,7 +92,7 @@ int, struct resource *); static struct resource * siba_pcib_alloc_resource(device_t, device_t, int, int *, - u_long , u_long, u_long, u_int); + rman_res_t , rman_res_t, rman_res_t, u_int); static int siba_pcib_attach(device_t); static int siba_pcib_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -249,7 +249,7 @@ static struct resource * siba_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { #if 1 Index: sys/dev/siis/siis.c =================================================================== --- sys/dev/siis/siis.c +++ sys/dev/siis/siis.c @@ -314,7 +314,7 @@ static struct resource * siis_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct siis_controller *ctlr = device_get_softc(dev); int unit = ((struct siis_channel *)device_get_softc(child))->unit; Index: sys/dev/snc/if_snc.c =================================================================== --- sys/dev/snc/if_snc.c +++ sys/dev/snc/if_snc.c @@ -73,7 +73,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, SNEC_NREGS, RF_ACTIVE); + 0, ~0, SNEC_NREGS, RF_ACTIVE); if (res) { sc->ioport = res; sc->ioport_rid = rid; @@ -96,7 +96,7 @@ struct resource *res; res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, SNEC_NMEMS, RF_ACTIVE); + 0, ~0, SNEC_NMEMS, RF_ACTIVE); if (res) { sc->iomem = res; sc->iomem_rid = rid; Index: sys/dev/snc/if_snc_cbus.c =================================================================== --- sys/dev/snc/if_snc_cbus.c +++ sys/dev/snc/if_snc_cbus.c @@ -72,7 +72,7 @@ { struct isa_device *idev = DEVTOISA(dev); struct isa_config config; - u_long start, count; + rman_res_t start, count; int rid; bzero(&config, sizeof(config)); @@ -148,7 +148,7 @@ bus_set_resource(dev, SYS_RES_IOPORT, rid, port, SNEC_NREGS); res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, SNEC_NREGS, + 0, ~0, SNEC_NREGS, 0 /* !RF_ACTIVE */); if (res) break; } Index: sys/dev/sound/isa/ad1816.c =================================================================== --- sys/dev/sound/isa/ad1816.c +++ sys/dev/sound/isa/ad1816.c @@ -624,11 +624,11 @@ goto no; } if (ad1816->drq2) - snprintf(status2, SND_STATUSLEN, ":%ld", rman_get_start(ad1816->drq2)); + snprintf(status2, SND_STATUSLEN, ":%jd", rman_get_start(ad1816->drq2)); else status2[0] = '\0'; - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %ld%s bufsz %u %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd drq %jd%s bufsz %u %s", rman_get_start(ad1816->io_base), rman_get_start(ad1816->irq), rman_get_start(ad1816->drq1), Index: sys/dev/sound/isa/ess.c =================================================================== --- sys/dev/sound/isa/ess.c +++ sys/dev/sound/isa/ess.c @@ -867,12 +867,12 @@ } if (sc->drq2) - snprintf(buf, SND_STATUSLEN, ":%ld", rman_get_start(sc->drq2)); + snprintf(buf, SND_STATUSLEN, ":%jd", rman_get_start(sc->drq2)); else buf[0] = '\0'; - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %ld%s bufsz %u %s", - rman_get_start(sc->io_base), rman_get_start(sc->irq), + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd drq %jd%s bufsz %u %s", + rman_get_start(sc->io_base), rman_get_start(sc->irq), rman_get_start(sc->drq1), buf, sc->bufsize, PCM_KLDSTRING(snd_ess)); Index: sys/dev/sound/isa/gusc.c =================================================================== --- sys/dev/sound/isa/gusc.c +++ sys/dev/sound/isa/gusc.c @@ -91,7 +91,7 @@ static int gusisa_probe(device_t dev); static void gusc_intr(void *); static struct resource *gusc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int gusc_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); @@ -350,7 +350,7 @@ static struct resource * gusc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { sc_p scp; int *alloced, rid_max, alloced_max; Index: sys/dev/sound/isa/mss.c =================================================================== --- sys/dev/sound/isa/mss.c +++ sys/dev/sound/isa/mss.c @@ -1325,7 +1325,7 @@ } tmp &= 0x3f; if (!(tmp == 0x04 || tmp == 0x0f || tmp == 0x00 || tmp == 0x05)) { - BVDDB(printf("No MSS signature detected on port 0x%lx (0x%x)\n", + BVDDB(printf("No MSS signature detected on port 0x%jx (0x%x)\n", rman_get_start(mss->io_base), tmpx)); goto no; } @@ -1766,7 +1766,7 @@ else status2[0] = '\0'; - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %d%s bufsz %u", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd drq %d%s bufsz %u", rman_get_start(mss->io_base), rman_get_start(mss->irq), pdma, status2, mss->bufsize); if (pcm_register(dev, mss, 1, 1)) goto no; Index: sys/dev/sound/isa/sb16.c =================================================================== --- sys/dev/sound/isa/sb16.c +++ sys/dev/sound/isa/sb16.c @@ -854,11 +854,11 @@ } if (!(pcm_getflags(dev) & SD_F_SIMPLEX)) - snprintf(status2, SND_STATUSLEN, ":%ld", rman_get_start(sb->drq2)); + snprintf(status2, SND_STATUSLEN, ":%jd", rman_get_start(sb->drq2)); else status2[0] = '\0'; - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %ld%s bufsz %u %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd drq %jd%s bufsz %u %s", rman_get_start(sb->io_base), rman_get_start(sb->irq), rman_get_start(sb->drq1), status2, sb->bufsize, PCM_KLDSTRING(snd_sb16)); Index: sys/dev/sound/isa/sb8.c =================================================================== --- sys/dev/sound/isa/sb8.c +++ sys/dev/sound/isa/sb8.c @@ -749,7 +749,7 @@ goto no; } - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %ld bufsz %u %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd drq %jd bufsz %u %s", rman_get_start(sb->io_base), rman_get_start(sb->irq), rman_get_start(sb->drq), sb->bufsize, PCM_KLDSTRING(snd_sb8)); Index: sys/dev/sound/isa/sbc.c =================================================================== --- sys/dev/sound/isa/sbc.c +++ sys/dev/sound/isa/sbc.c @@ -80,7 +80,7 @@ static void sbc_intr(void *p); static struct resource *sbc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int sbc_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); static int sbc_setup_intr(device_t dev, device_t child, struct resource *irq, @@ -573,7 +573,7 @@ static struct resource * sbc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct sbc_softc *scp; int *alloced, rid_max, alloced_max; Index: sys/dev/sound/pci/als4000.c =================================================================== --- sys/dev/sound/pci/als4000.c +++ sys/dev/sound/pci/als4000.c @@ -848,7 +848,7 @@ pcm_addchan(dev, PCMDIR_PLAY, &alspchan_class, sc); pcm_addchan(dev, PCMDIR_REC, &alsrchan_class, sc); - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(sc->reg), rman_get_start(sc->irq),PCM_KLDSTRING(snd_als4000)); pcm_setstatus(dev, status); return 0; Index: sys/dev/sound/pci/atiixp.c =================================================================== --- sys/dev/sound/pci/atiixp.c +++ sys/dev/sound/pci/atiixp.c @@ -1097,7 +1097,7 @@ "polling", CTLTYPE_INT | CTLFLAG_RW, sc->dev, sizeof(sc->dev), sysctl_atiixp_polling, "I", "Enable polling mode"); - snprintf(status, SND_STATUSLEN, "at memory 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at memory 0x%jx irq %jd %s", rman_get_start(sc->reg), rman_get_start(sc->irq), PCM_KLDSTRING(snd_atiixp)); Index: sys/dev/sound/pci/aureal.c =================================================================== --- sys/dev/sound/pci/aureal.c +++ sys/dev/sound/pci/aureal.c @@ -645,7 +645,7 @@ goto bad; } - snprintf(status, SND_STATUSLEN, "at %s 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at %s 0x%jx irq %jd %s", (type[0] == SYS_RES_IOPORT)? "io" : "memory", rman_get_start(reg[0]), rman_get_start(irq),PCM_KLDSTRING(snd_aureal)); Index: sys/dev/sound/pci/cmi.c =================================================================== --- sys/dev/sound/pci/cmi.c +++ sys/dev/sound/pci/cmi.c @@ -995,7 +995,7 @@ pcm_addchan(dev, PCMDIR_PLAY, &cmichan_class, sc); pcm_addchan(dev, PCMDIR_REC, &cmichan_class, sc); - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(sc->reg), rman_get_start(sc->irq),PCM_KLDSTRING(snd_cmi)); pcm_setstatus(dev, status); Index: sys/dev/sound/pci/cs4281.c =================================================================== --- sys/dev/sound/pci/cs4281.c +++ sys/dev/sound/pci/cs4281.c @@ -850,7 +850,7 @@ pcm_addchan(dev, PCMDIR_PLAY, &cs4281chan_class, sc); pcm_addchan(dev, PCMDIR_REC, &cs4281chan_class, sc); - snprintf(status, SND_STATUSLEN, "at %s 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at %s 0x%jx irq %jd %s", (sc->regtype == SYS_RES_IOPORT)? "io" : "memory", rman_get_start(sc->reg), rman_get_start(sc->irq),PCM_KLDSTRING(snd_cs4281)); pcm_setstatus(dev, status); Index: sys/dev/sound/pci/csa.c =================================================================== --- sys/dev/sound/pci/csa.c +++ sys/dev/sound/pci/csa.c @@ -81,7 +81,8 @@ static int csa_probe(device_t dev); static int csa_attach(device_t dev); static struct resource *csa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags); + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); static int csa_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); static int csa_setup_intr(device_t bus, device_t child, @@ -396,7 +397,7 @@ static struct resource * csa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { sc_p scp; csa_res *resp; Index: sys/dev/sound/pci/csapcm.c =================================================================== --- sys/dev/sound/pci/csapcm.c +++ sys/dev/sound/pci/csapcm.c @@ -821,7 +821,7 @@ return (ENXIO); } - snprintf(status, SND_STATUSLEN, "at irq %ld %s", + snprintf(status, SND_STATUSLEN, "at irq %jd %s", rman_get_start(resp->irq),PCM_KLDSTRING(snd_csa)); /* Enable interrupt. */ Index: sys/dev/sound/pci/ds1.c =================================================================== --- sys/dev/sound/pci/ds1.c +++ sys/dev/sound/pci/ds1.c @@ -1010,7 +1010,7 @@ goto bad; } - snprintf(status, SND_STATUSLEN, "at memory 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at memory 0x%jx irq %jd %s", rman_get_start(sc->reg), rman_get_start(sc->irq),PCM_KLDSTRING(snd_ds1)); if (pcm_register(dev, sc, DS1_CHANS, 2)) Index: sys/dev/sound/pci/emu10k1.c =================================================================== --- sys/dev/sound/pci/emu10k1.c +++ sys/dev/sound/pci/emu10k1.c @@ -2132,7 +2132,7 @@ goto bad; } - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(sc->reg), rman_get_start(sc->irq), PCM_KLDSTRING(snd_emu10k1)); Index: sys/dev/sound/pci/emu10kx.c =================================================================== --- sys/dev/sound/pci/emu10kx.c +++ sys/dev/sound/pci/emu10kx.c @@ -3225,7 +3225,7 @@ device_printf(dev, "unable to create control device\n"); goto bad; } - snprintf(status, 255, "rev %d at io 0x%lx irq %ld", sc->rev, rman_get_start(sc->reg), rman_get_start(sc->irq)); + snprintf(status, 255, "rev %d at io 0x%jx irq %jd", sc->rev, rman_get_start(sc->reg), rman_get_start(sc->irq)); /* Voices */ for (i = 0; i < NUM_G; i++) { Index: sys/dev/sound/pci/envy24.c =================================================================== --- sys/dev/sound/pci/envy24.c +++ sys/dev/sound/pci/envy24.c @@ -2599,7 +2599,7 @@ /* set status iformation */ snprintf(status, SND_STATUSLEN, - "at io 0x%lx:%ld,0x%lx:%ld,0x%lx:%ld,0x%lx:%ld irq %ld", + "at io 0x%jx:%jd,0x%jx:%jd,0x%jx:%jd,0x%jx:%jd irq %jd", rman_get_start(sc->cs), rman_get_end(sc->cs) - rman_get_start(sc->cs) + 1, rman_get_start(sc->ddma), Index: sys/dev/sound/pci/envy24ht.c =================================================================== --- sys/dev/sound/pci/envy24ht.c +++ sys/dev/sound/pci/envy24ht.c @@ -2507,7 +2507,7 @@ /* set status iformation */ snprintf(status, SND_STATUSLEN, - "at io 0x%lx:%ld,0x%lx:%ld irq %ld", + "at io 0x%jx:%jd,0x%jx:%jd irq %jd", rman_get_start(sc->cs), rman_get_end(sc->cs) - rman_get_start(sc->cs) + 1, rman_get_start(sc->mt), Index: sys/dev/sound/pci/es137x.c =================================================================== --- sys/dev/sound/pci/es137x.c +++ sys/dev/sound/pci/es137x.c @@ -1856,7 +1856,7 @@ goto bad; } - snprintf(status, SND_STATUSLEN, "at %s 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at %s 0x%jx irq %jd %s", (es->regtype == SYS_RES_IOPORT)? "io" : "memory", rman_get_start(es->reg), rman_get_start(es->irq), PCM_KLDSTRING(snd_es137x)); Index: sys/dev/sound/pci/fm801.c =================================================================== --- sys/dev/sound/pci/fm801.c +++ sys/dev/sound/pci/fm801.c @@ -639,7 +639,7 @@ goto oops; } - snprintf(status, 64, "at %s 0x%lx irq %ld %s", + snprintf(status, 64, "at %s 0x%jx irq %jd %s", (fm801->regtype == SYS_RES_IOPORT)? "io" : "memory", rman_get_start(fm801->reg), rman_get_start(fm801->irq),PCM_KLDSTRING(snd_fm801)); @@ -716,7 +716,8 @@ static struct resource * fm801_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct fm801_info *fm801; Index: sys/dev/sound/pci/hdspe-pcm.c =================================================================== --- sys/dev/sound/pci/hdspe-pcm.c +++ sys/dev/sound/pci/hdspe-pcm.c @@ -668,7 +668,7 @@ scp->chnum++; } - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(scp->sc->cs), rman_get_start(scp->sc->irq), PCM_KLDSTRING(snd_hdspe)); Index: sys/dev/sound/pci/ich.c =================================================================== --- sys/dev/sound/pci/ich.c +++ sys/dev/sound/pci/ich.c @@ -687,7 +687,7 @@ char status[SND_STATUSLEN]; snprintf(status, SND_STATUSLEN, - "at io 0x%lx, 0x%lx irq %ld bufsz %u %s", + "at io 0x%jx, 0x%jx irq %jd bufsz %u %s", rman_get_start(sc->nambar), rman_get_start(sc->nabmbar), rman_get_start(sc->irq), sc->bufsz,PCM_KLDSTRING(snd_ich)); Index: sys/dev/sound/pci/maestro.c =================================================================== --- sys/dev/sound/pci/maestro.c +++ sys/dev/sound/pci/maestro.c @@ -1917,7 +1917,7 @@ adjust_pchbase(ess->pch, ess->playchns, ess->bufsz); snprintf(status, SND_STATUSLEN, - "port 0x%lx-0x%lx irq %ld at device %d.%d on pci%d", + "port 0x%jx-0x%jx irq %jd at device %d.%d on pci%d", rman_get_start(reg), rman_get_end(reg), rman_get_start(irq), pci_get_slot(dev), pci_get_function(dev), pci_get_bus(dev)); pcm_setstatus(dev, status); Index: sys/dev/sound/pci/maestro3.c =================================================================== --- sys/dev/sound/pci/maestro3.c +++ sys/dev/sound/pci/maestro3.c @@ -1440,7 +1440,7 @@ goto bad; } } - snprintf(status, SND_STATUSLEN, "at %s 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at %s 0x%jx irq %jd %s", (sc->regtype == SYS_RES_IOPORT)? "io" : "memory", rman_get_start(sc->reg), rman_get_start(sc->irq), PCM_KLDSTRING(snd_maestro3)); Index: sys/dev/sound/pci/neomagic.c =================================================================== --- sys/dev/sound/pci/neomagic.c +++ sys/dev/sound/pci/neomagic.c @@ -702,7 +702,7 @@ goto bad; } - snprintf(status, SND_STATUSLEN, "at memory 0x%lx, 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at memory 0x%jx, 0x%jx irq %jd %s", rman_get_start(sc->buf), rman_get_start(sc->reg), rman_get_start(sc->irq),PCM_KLDSTRING(snd_neomagic)); Index: sys/dev/sound/pci/solo.c =================================================================== --- sys/dev/sound/pci/solo.c +++ sys/dev/sound/pci/solo.c @@ -1051,7 +1051,7 @@ if (mixer_init(dev, &solomixer_class, sc)) goto no; - snprintf(status, SND_STATUSLEN, "at io 0x%lx,0x%lx,0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx,0x%jx,0x%jx irq %jd %s", rman_get_start(sc->io), rman_get_start(sc->sb), rman_get_start(sc->vc), rman_get_start(sc->irq),PCM_KLDSTRING(snd_solo)); Index: sys/dev/sound/pci/t4dwave.c =================================================================== --- sys/dev/sound/pci/t4dwave.c +++ sys/dev/sound/pci/t4dwave.c @@ -948,7 +948,7 @@ goto bad; } - snprintf(status, 64, "at io 0x%lx irq %ld %s", + snprintf(status, 64, "at io 0x%jx irq %jd %s", rman_get_start(tr->reg), rman_get_start(tr->irq),PCM_KLDSTRING(snd_t4dwave)); if (pcm_register(dev, tr, dacn, 1)) Index: sys/dev/sound/pci/via8233.c =================================================================== --- sys/dev/sound/pci/via8233.c +++ sys/dev/sound/pci/via8233.c @@ -1348,7 +1348,7 @@ ac97_setextmode(via->codec, ext); } - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(via->reg), rman_get_start(via->irq), PCM_KLDSTRING(snd_via8233)); Index: sys/dev/sound/pci/via82c686.c =================================================================== --- sys/dev/sound/pci/via82c686.c +++ sys/dev/sound/pci/via82c686.c @@ -590,7 +590,7 @@ NSEGS * sizeof(struct via_dma_op), dma_cb, via, 0) != 0) goto bad; - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(via->reg), rman_get_start(via->irq), PCM_KLDSTRING(snd_via82c686)); Index: sys/dev/sound/pci/vibes.c =================================================================== --- sys/dev/sound/pci/vibes.c +++ sys/dev/sound/pci/vibes.c @@ -721,9 +721,10 @@ static int sv_attach(device_t dev) { struct sc_info *sc; + rman_res_t count, midi_start, games_start; u_int32_t data; char status[SND_STATUSLEN]; - u_long midi_start, games_start, count, sdmaa, sdmac, ml, mu; + u_long sdmaa, sdmac, ml, mu; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->dev = dev; @@ -815,7 +816,7 @@ ((mu - ml) % 0x200)) { device_printf(dev, "sv_attach: resource assumptions not met " "(midi 0x%08lx, games 0x%08lx)\n", - midi_start, games_start); + (u_long)midi_start, (u_long)games_start); goto fail; } @@ -876,7 +877,7 @@ pcm_addchan(dev, PCMDIR_PLAY, &svpchan_class, sc); pcm_addchan(dev, PCMDIR_REC, &svrchan_class, sc); - snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld %s", + snprintf(status, SND_STATUSLEN, "at io 0x%jx irq %jd %s", rman_get_start(sc->enh_reg), rman_get_start(sc->irq),PCM_KLDSTRING(snd_vibes)); pcm_setstatus(dev, status); Index: sys/dev/stg/tmc18c30_subr.c =================================================================== --- sys/dev/stg/tmc18c30_subr.c +++ sys/dev/stg/tmc18c30_subr.c @@ -65,7 +65,7 @@ stg_alloc_resource(device_t dev) { struct stg_softc * sc = device_get_softc(dev); - u_long maddr, msize; + rman_res_t maddr, msize; int error; mtx_init(&sc->sc_sclow.sl_lock, "stg", NULL, MTX_DEF); Index: sys/dev/wl/if_wl.c =================================================================== --- sys/dev/wl/if_wl.c +++ sys/dev/wl/if_wl.c @@ -388,7 +388,7 @@ struct wl_softc *sc; char *str = "wl%d: board out of range [0..%d]\n"; u_char inbuf[100]; - unsigned long junk, sirq; + rman_res_t junk, sirq; int error, irq; error = ISA_PNP_PROBE(device_get_parent(device), device, wl_ids); @@ -495,7 +495,7 @@ } #ifdef WLDEBUG - printf("wlattach: base %lx, unit %d\n", rman_get_start(sc->res_ioport), + printf("wlattach: base %jx, unit %d\n", rman_get_start(sc->res_ioport), device_get_unit(device)); #endif @@ -605,7 +605,7 @@ int ports = 16; /* Number of ports */ sc->res_ioport = bus_alloc_resource(device, SYS_RES_IOPORT, - &sc->rid_ioport, 0ul, ~0ul, ports, RF_ACTIVE); + &sc->rid_ioport, 0, ~0, ports, RF_ACTIVE); if (sc->res_ioport == NULL) goto errexit; Index: sys/dev/xe/if_xe.c =================================================================== --- sys/dev/xe/if_xe.c +++ sys/dev/xe/if_xe.c @@ -1964,7 +1964,7 @@ if (!sc->modem) { sc->port_rid = 0; /* 0 is managed by pccard */ sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid, 0ul, ~0ul, 16, RF_ACTIVE); + &sc->port_rid, 0, ~0, 16, RF_ACTIVE); } else if (sc->dingo) { /* * Find a 16 byte aligned ioport for the card. @@ -1983,7 +1983,7 @@ sc->port_res); start = (rman_get_start(sc->port_res) + 15) & ~0xf; } while (1); - DEVPRINTF(1, (dev, "RealPort port 0x%0lx, size 0x%0lx\n", + DEVPRINTF(1, (dev, "RealPort port 0x%0jx, size 0x%0jx\n", bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid), bus_get_resource_count(dev, SYS_RES_IOPORT, sc->port_rid))); } else if (sc->ce2) { @@ -1998,7 +1998,7 @@ DEVPRINTF(1, (dev, "Finding I/O port for CEM2/CEM3\n")); sc->ce2_port_rid = 0; /* 0 is managed by pccard */ sc->ce2_port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->ce2_port_rid, 0ul, ~0ul, 8, RF_ACTIVE); + &sc->ce2_port_rid, 0, ~0, 8, RF_ACTIVE); if (sc->ce2_port_res == NULL) { DEVPRINTF(1, (dev, "Cannot allocate I/O port for modem\n")); @@ -2023,7 +2023,7 @@ sc->port_res); sc->port_res = NULL; } - DEVPRINTF(1, (dev, "CEM2/CEM3 port 0x%0lx, size 0x%0lx\n", + DEVPRINTF(1, (dev, "CEM2/CEM3 port 0x%0jx, size 0x%0jx\n", bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid), bus_get_resource_count(dev, SYS_RES_IOPORT, sc->port_rid))); } Index: sys/dev/xe/if_xe_pccard.c =================================================================== --- sys/dev/xe/if_xe_pccard.c +++ sys/dev/xe/if_xe_pccard.c @@ -140,7 +140,7 @@ DEVPRINTF(2, (dev, "cemfix\n")); - DEVPRINTF(1, (dev, "CEM I/O port 0x%0lx, size 0x%0lx\n", + DEVPRINTF(1, (dev, "CEM I/O port 0x%0jx, size 0x%0jx\n", bus_get_resource_start(dev, SYS_RES_IOPORT, sc->port_rid), bus_get_resource_count(dev, SYS_RES_IOPORT, sc->port_rid))); Index: sys/isa/isa_common.h =================================================================== --- sys/isa/isa_common.h +++ sys/isa/isa_common.h @@ -69,7 +69,8 @@ */ extern void isa_init(device_t dev); extern struct resource *isa_alloc_resource(device_t bus, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags); extern int isa_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); Index: sys/isa/isa_common.c =================================================================== --- sys/isa/isa_common.c +++ sys/isa/isa_common.c @@ -483,7 +483,7 @@ if (!rle->res) { rid = rle->rid; resource_list_alloc(rl, dev, child, rle->type, &rid, - 0ul, ~0ul, 1, 0); + 0, ~0, 1, 0); } } } @@ -928,7 +928,7 @@ static int isa_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct isa_device* idev = DEVTOISA(child); struct resource_list *rl = &idev->id_resources; Index: sys/kern/bus_if.m =================================================================== --- sys/kern/bus_if.m +++ sys/kern/bus_if.m @@ -44,8 +44,8 @@ CODE { static struct resource * null_alloc_resource(device_t dev, device_t child, - int type, int *rid, u_long start, u_long end, - u_long count, u_int flags) + int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags) { return (0); } @@ -247,9 +247,9 @@ * @param _type the type of resource to allocate * @param _rid a pointer to the resource identifier * @param _start hint at the start of the resource range - pass - * @c 0UL for any start address + * @c 0 for any start address * @param _end hint at the end of the resource range - pass - * @c ~0UL for any end address + * @c ~0 for any end address * @param _count hint at the size of range required - pass @c 1 * for any size * @param _flags any extra flags to control the resource @@ -264,9 +264,9 @@ device_t _child; int _type; int *_rid; - u_long _start; - u_long _end; - u_long _count; + rman_res_t _start; + rman_res_t _end; + rman_res_t _count; u_int _flags; } DEFAULT null_alloc_resource; @@ -332,8 +332,8 @@ device_t _child; int _type; struct resource *_res; - u_long _start; - u_long _end; + rman_res_t _start; + rman_res_t _end; }; /** @@ -433,8 +433,8 @@ device_t _child; int _type; int _rid; - u_long _start; - u_long _count; + rman_res_t _start; + rman_res_t _count; }; /** @@ -457,8 +457,8 @@ device_t _child; int _type; int _rid; - u_long *_startp; - u_long *_countp; + rman_res_t *_startp; + rman_res_t *_countp; }; /** Index: sys/kern/kern_cons.c =================================================================== --- sys/kern/kern_cons.c +++ sys/kern/kern_cons.c @@ -161,7 +161,7 @@ /* * Release early console. */ - early_putc = NULL; + //early_putc = NULL; #endif } Index: sys/kern/subr_bus.c =================================================================== --- sys/kern/subr_bus.c +++ sys/kern/subr_bus.c @@ -3063,8 +3063,8 @@ * @param count XXX end-start+1 */ int -resource_list_add_next(struct resource_list *rl, int type, u_long start, - u_long end, u_long count) +resource_list_add_next(struct resource_list *rl, int type, rman_res_t start, + rman_res_t end, rman_res_t count) { int rid; @@ -3092,7 +3092,7 @@ */ struct resource_list_entry * resource_list_add(struct resource_list *rl, int type, int rid, - u_long start, u_long end, u_long count) + rman_res_t start, rman_res_t end, rman_res_t count) { struct resource_list_entry *rle; @@ -3236,9 +3236,9 @@ * @param type the type of resource to allocate * @param rid a pointer to the resource identifier * @param start hint at the start of the resource range - pass - * @c 0UL for any start address + * @c 0 for any start address * @param end hint at the end of the resource range - pass - * @c ~0UL for any end address + * @c ~0 for any end address * @param count hint at the size of range required - pass @c 1 * for any size * @param flags any extra flags to control the resource @@ -3250,7 +3250,7 @@ */ struct resource * resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, u_int flags) + int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list_entry *rle = NULL; int passthrough = (device_get_parent(child) != bus); @@ -3293,9 +3293,9 @@ * @param type the type of resource to allocate * @param rid a pointer to the resource identifier * @param start hint at the start of the resource range - pass - * @c 0UL for any start address + * @c 0 for any start address * @param end hint at the end of the resource range - pass - * @c ~0UL for any end address + * @c ~0 for any end address * @param count hint at the size of range required - pass @c 1 * for any size * @param flags any extra flags to control the resource @@ -3307,11 +3307,11 @@ */ struct resource * resource_list_alloc(struct resource_list *rl, device_t bus, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, u_int flags) + int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list_entry *rle = NULL; int passthrough = (device_get_parent(child) != bus); - int isdefault = (start == 0UL && end == ~0UL); + int isdefault = (start == 0 && end == ~0); if (passthrough) { return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, @@ -3949,7 +3949,7 @@ */ int bus_generic_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { /* Propagate up the bus hierarchy until someone handles it. */ if (dev->parent) @@ -3966,7 +3966,7 @@ */ struct resource * bus_generic_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { /* Propagate up the bus hierarchy until someone handles it. */ if (dev->parent) @@ -4104,7 +4104,7 @@ */ int bus_generic_rl_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { struct resource_list * rl = NULL; struct resource_list_entry * rle = NULL; @@ -4135,7 +4135,7 @@ */ int bus_generic_rl_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct resource_list * rl = NULL; @@ -4203,7 +4203,7 @@ */ struct resource * bus_generic_rl_alloc_resource(device_t dev, device_t child, int type, - int *rid, u_long start, u_long end, u_long count, u_int flags) + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list * rl = NULL; @@ -4289,8 +4289,8 @@ * parent of @p dev. */ struct resource * -bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end, - u_long count, u_int flags) +bus_alloc_resource(device_t dev, int type, int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags) { if (dev->parent == NULL) return (NULL); @@ -4305,8 +4305,8 @@ * parent of @p dev. */ int -bus_adjust_resource(device_t dev, int type, struct resource *r, u_long start, - u_long end) +bus_adjust_resource(device_t dev, int type, struct resource *r, rman_res_t start, + rman_res_t end) { if (dev->parent == NULL) return (EINVAL); @@ -4436,7 +4436,7 @@ */ int bus_set_resource(device_t dev, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { return (BUS_SET_RESOURCE(device_get_parent(dev), dev, type, rid, start, count)); @@ -4450,7 +4450,7 @@ */ int bus_get_resource(device_t dev, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { return (BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, startp, countp)); @@ -4462,10 +4462,11 @@ * This function simply calls the BUS_GET_RESOURCE() method of the * parent of @p dev and returns the start value. */ -u_long +rman_res_t bus_get_resource_start(device_t dev, int type, int rid) { - u_long start, count; + rman_res_t start; + rman_res_t count; int error; error = BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, @@ -4481,10 +4482,11 @@ * This function simply calls the BUS_GET_RESOURCE() method of the * parent of @p dev and returns the count value. */ -u_long +rman_res_t bus_get_resource_count(device_t dev, int type, int rid) { - u_long start, count; + rman_res_t start; + rman_res_t count; int error; error = BUS_GET_RESOURCE(device_get_parent(dev), dev, type, rid, Index: sys/kern/subr_rman.c =================================================================== --- sys/kern/subr_rman.c +++ sys/kern/subr_rman.c @@ -90,8 +90,8 @@ TAILQ_ENTRY(resource_i) r_link; LIST_ENTRY(resource_i) r_sharelink; LIST_HEAD(, resource_i) *r_sharehead; - u_long r_start; /* index of the first entry in this resource */ - u_long r_end; /* index of the last entry (inclusive) */ + rman_res_t r_start; /* index of the first entry in this resource */ + rman_res_t r_end; /* index of the last entry (inclusive) */ u_int r_flags; void *r_virtual; /* virtual address of this resource */ struct device *r_dev; /* device which has allocated this resource */ @@ -135,7 +135,7 @@ } if (rm->rm_start == 0 && rm->rm_end == 0) - rm->rm_end = ~0ul; + rm->rm_end = ~0; if (rm->rm_type == RMAN_UNINIT) panic("rman_init"); if (rm->rm_type == RMAN_GAUGE) @@ -154,12 +154,12 @@ } int -rman_manage_region(struct rman *rm, u_long start, u_long end) +rman_manage_region(struct rman *rm, rman_res_t start, rman_res_t end) { struct resource_i *r, *s, *t; int rv = 0; - DPRINTF(("rman_manage_region: <%s> request: start %#lx, end %#lx\n", + DPRINTF(("rman_manage_region: <%s> request: start %#jx, end %#jx\n", rm->rm_descr, start, end)); if (start < rm->rm_start || end > rm->rm_end) return EINVAL; @@ -174,7 +174,7 @@ /* Skip entries before us. */ TAILQ_FOREACH(s, &rm->rm_list, r_link) { - if (s->r_end == ULONG_MAX) + if (s->r_end == ~0) break; if (s->r_end + 1 >= r->r_start) break; @@ -274,7 +274,7 @@ } int -rman_first_free_region(struct rman *rm, u_long *start, u_long *end) +rman_first_free_region(struct rman *rm, rman_res_t *start, rman_res_t *end) { struct resource_i *r; @@ -292,7 +292,7 @@ } int -rman_last_free_region(struct rman *rm, u_long *start, u_long *end) +rman_last_free_region(struct rman *rm, rman_res_t *start, rman_res_t *end) { struct resource_i *r; @@ -311,7 +311,7 @@ /* Shrink or extend one or both ends of an allocated resource. */ int -rman_adjust_resource(struct resource *rr, u_long start, u_long end) +rman_adjust_resource(struct resource *rr, rman_res_t start, rman_res_t end) { struct resource_i *r, *s, *t, *new; struct rman *rm; @@ -434,18 +434,18 @@ #define SHARE_TYPE(f) (f & (RF_SHAREABLE | RF_PREFETCHABLE)) struct resource * -rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end, - u_long count, u_long bound, u_int flags, +rman_reserve_resource_bound(struct rman *rm, rman_res_t start, rman_res_t end, + rman_res_t count, rman_res_t bound, u_int flags, struct device *dev) { u_int new_rflags; struct resource_i *r, *s, *rv; - u_long rstart, rend, amask, bmask; + rman_res_t rstart, rend, amask, bmask; rv = NULL; - DPRINTF(("rman_reserve_resource_bound: <%s> request: [%#lx, %#lx], " - "length %#lx, flags %u, device %s\n", rm->rm_descr, start, end, + DPRINTF(("rman_reserve_resource_bound: <%s> request: [%#jx, %#jx], " + "length %#jx, flags %x, device %s\n", rm->rm_descr, start, end, count, flags, dev == NULL ? "" : device_get_nameunit(dev))); KASSERT((flags & RF_FIRSTSHARE) == 0, @@ -454,19 +454,29 @@ mtx_lock(rm->rm_mtx); + r = TAILQ_FIRST(&rm->rm_list); + if (r == NULL) { + DPRINTF(("NULL list head\n")); + } else { + DPRINTF(("rman_reserve_resource_bound: trying %#jx <%#jx,%#jx>\n", + r->r_end, start, count-1)); + } for (r = TAILQ_FIRST(&rm->rm_list); r && r->r_end < start + count - 1; - r = TAILQ_NEXT(r, r_link)) + r = TAILQ_NEXT(r, r_link)) { ; + DPRINTF(("rman_reserve_resource_bound: tried %#jx <%#jx,%#jx>\n", + r->r_end, start, count-1)); + } if (r == NULL) { DPRINTF(("could not find a region\n")); goto out; } - amask = (1ul << RF_ALIGNMENT(flags)) - 1; - KASSERT(start <= ULONG_MAX - amask, - ("start (%#lx) + amask (%#lx) would wrap around", start, amask)); + amask = (1ull << RF_ALIGNMENT(flags)) - 1; + KASSERT(start <= RM_MAX_END - amask, + ("start (%#jx) + amask (%#jx) would wrap around", start, amask)); /* If bound is 0, bmask will also be 0 */ bmask = ~(bound - 1); @@ -474,18 +484,18 @@ * First try to find an acceptable totally-unshared region. */ for (s = r; s; s = TAILQ_NEXT(s, r_link)) { - DPRINTF(("considering [%#lx, %#lx]\n", s->r_start, s->r_end)); + DPRINTF(("considering [%#jx, %#jx]\n", s->r_start, s->r_end)); /* * The resource list is sorted, so there is no point in * searching further once r_start is too large. */ if (s->r_start > end - (count - 1)) { - DPRINTF(("s->r_start (%#lx) + count - 1> end (%#lx)\n", + DPRINTF(("s->r_start (%#jx) + count - 1> end (%#jx)\n", s->r_start, end)); break; } - if (s->r_start > ULONG_MAX - amask) { - DPRINTF(("s->r_start (%#lx) + amask (%#lx) too large\n", + if (s->r_start > RM_MAX_END - amask) { + DPRINTF(("s->r_start (%#jx) + amask (%#jx) too large\n", s->r_start, amask)); break; } @@ -493,7 +503,7 @@ DPRINTF(("region is allocated\n")); continue; } - rstart = ulmax(s->r_start, start); + rstart = ummax(s->r_start, start); /* * Try to find a region by adjusting to boundary and alignment * until both conditions are satisfied. This is not an optimal @@ -505,16 +515,16 @@ rstart += bound - (rstart & ~bmask); } while ((rstart & amask) != 0 && rstart < end && rstart < s->r_end); - rend = ulmin(s->r_end, ulmax(rstart + count - 1, end)); + rend = ummin(s->r_end, ummax(rstart + count - 1, end)); if (rstart > rend) { DPRINTF(("adjusted start exceeds end\n")); continue; } - DPRINTF(("truncated region: [%#lx, %#lx]; size %#lx (requested %#lx)\n", + DPRINTF(("truncated region: [%#jx, %#jx]; size %#jx (requested %#jx)\n", rstart, rend, (rend - rstart + 1), count)); if ((rend - rstart + 1) >= count) { - DPRINTF(("candidate region: [%#lx, %#lx], size %#lx\n", + DPRINTF(("candidate region: [%#jx, %#jx], size %#jx\n", rstart, rend, (rend - rstart + 1))); if ((s->r_end - s->r_start + 1) == count) { DPRINTF(("candidate region is entire chunk\n")); @@ -545,7 +555,7 @@ if (s->r_start < rv->r_start && s->r_end > rv->r_end) { DPRINTF(("splitting region in three parts: " - "[%#lx, %#lx]; [%#lx, %#lx]; [%#lx, %#lx]\n", + "[%#jx, %#jx]; [%#jx, %#jx]; [%#jx, %#jx]\n", s->r_start, rv->r_start - 1, rv->r_start, rv->r_end, rv->r_end + 1, s->r_end)); @@ -641,8 +651,8 @@ } struct resource * -rman_reserve_resource(struct rman *rm, u_long start, u_long end, u_long count, - u_int flags, struct device *dev) +rman_reserve_resource(struct rman *rm, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags, struct device *dev) { return (rman_reserve_resource_bound(rm, start, end, count, 0, flags, @@ -803,13 +813,13 @@ } void -rman_set_start(struct resource *r, u_long start) +rman_set_start(struct resource *r, rman_res_t start) { r->__r_i->r_start = start; } -u_long +rman_res_t rman_get_start(struct resource *r) { @@ -817,20 +827,20 @@ } void -rman_set_end(struct resource *r, u_long end) +rman_set_end(struct resource *r, rman_res_t end) { r->__r_i->r_end = end; } -u_long +rman_res_t rman_get_end(struct resource *r) { return (r->__r_i->r_end); } -u_long +rman_res_t rman_get_size(struct resource *r) { @@ -1032,8 +1042,8 @@ if (db_pager_quit) return; - db_printf("rman %p: %s (0x%lx-0x%lx full range)\n", - rm, rm->rm_descr, rm->rm_start, rm->rm_end); + db_printf("rman %p: %s (0x%jx-0x%jx full range)\n", + rm, rm->rm_descr, (rman_res_t)rm->rm_start, (rman_res_t)rm->rm_end); } static void @@ -1051,7 +1061,7 @@ devname = "nomatch"; } else devname = NULL; - db_printf(" 0x%lx-0x%lx (RID=%d) ", + db_printf(" 0x%jx-0x%jx (RID=%d) ", r->r_start, r->r_end, r->r_rid); if (devname != NULL) db_printf("(%s)\n", devname); Index: sys/mips/adm5120/admpci.c =================================================================== --- sys/mips/adm5120/admpci.c +++ sys/mips/adm5120/admpci.c @@ -356,7 +356,7 @@ static struct resource * admpci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { return (NULL); Index: sys/mips/adm5120/obio.c =================================================================== --- sys/mips/adm5120/obio.c +++ sys/mips/adm5120/obio.c @@ -103,8 +103,8 @@ struct resource *); static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * - obio_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + obio_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static int obio_attach(device_t); static int obio_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -222,7 +222,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc = device_get_softc(bus); struct obio_ivar *ivar = device_get_ivars(child); Index: sys/mips/alchemy/obio.c =================================================================== --- sys/mips/alchemy/obio.c +++ sys/mips/alchemy/obio.c @@ -103,8 +103,8 @@ struct resource *); static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * - obio_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + obio_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static int obio_attach(device_t); static int obio_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -223,7 +223,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc = device_get_softc(bus); struct obio_ivar *ivar = device_get_ivars(child); @@ -232,7 +232,7 @@ struct rman *rm; int isdefault, needactivate, passthrough; - isdefault = (start == 0UL && end == ~0UL && count == 1); + isdefault = (start == 0 && end == ~0 && count == 1); needactivate = flags & RF_ACTIVE; passthrough = (device_get_parent(child) != bus); rle = NULL; Index: sys/mips/atheros/apb.c =================================================================== --- sys/mips/atheros/apb.c +++ sys/mips/atheros/apb.c @@ -63,8 +63,8 @@ struct resource *); static device_t apb_add_child(device_t, u_int, const char *, int); static struct resource * - apb_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + apb_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static int apb_attach(device_t); static int apb_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -161,7 +161,7 @@ static struct resource * apb_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct apb_softc *sc = device_get_softc(bus); struct apb_ivar *ivar = device_get_ivars(child); @@ -170,7 +170,7 @@ struct rman *rm; int isdefault, needactivate, passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); needactivate = flags & RF_ACTIVE; /* * Pass memory requests to nexus device @@ -178,7 +178,7 @@ 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); Index: sys/mips/atheros/ar71xx_pci.c =================================================================== --- sys/mips/atheros/ar71xx_pci.c +++ sys/mips/atheros/ar71xx_pci.c @@ -500,7 +500,7 @@ static struct resource * ar71xx_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ar71xx_pci_softc *sc = device_get_softc(bus); Index: sys/mips/atheros/ar724x_pci.c =================================================================== --- sys/mips/atheros/ar724x_pci.c +++ sys/mips/atheros/ar724x_pci.c @@ -465,7 +465,7 @@ static struct resource * ar724x_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ar71xx_pci_softc *sc = device_get_softc(bus); struct resource *rv; Index: sys/mips/atheros/qca955x_pci.c =================================================================== --- sys/mips/atheros/qca955x_pci.c +++ sys/mips/atheros/qca955x_pci.c @@ -398,7 +398,7 @@ static struct resource * qca955x_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ar71xx_pci_softc *sc = device_get_softc(bus); struct resource *rv; Index: sys/mips/beri/beri_simplebus.c =================================================================== --- sys/mips/beri/beri_simplebus.c +++ sys/mips/beri/beri_simplebus.c @@ -85,7 +85,7 @@ static int simplebus_activate_resource(device_t, device_t, int, int, struct resource *); static struct resource *simplebus_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int simplebus_deactivate_resource(device_t, device_t, int, int, struct resource *); static int simplebus_release_resource(device_t, device_t, int, int, @@ -250,7 +250,7 @@ static struct resource * simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { device_t ic; struct simplebus_devinfo *di; @@ -260,7 +260,7 @@ * Request for the default allocation with a given rid: use resource * list stored in the local device info. */ - if ((start == 0UL) && (end == ~0UL)) { + if ((start == 0) && (end == ~0)) { if ((di = device_get_ivars(child)) == NULL) return (NULL); Index: sys/mips/cavium/ciu.c =================================================================== --- sys/mips/cavium/ciu.c +++ sys/mips/cavium/ciu.c @@ -75,7 +75,8 @@ static int ciu_probe(device_t); static int ciu_attach(device_t); static struct resource *ciu_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, + u_int); static int ciu_setup_intr(device_t, device_t, struct resource *, int, driver_filter_t *, driver_intr_t *, void *, void **); @@ -171,7 +172,7 @@ static struct resource * ciu_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; struct ciu_softc *sc; Index: sys/mips/cavium/obio.c =================================================================== --- sys/mips/cavium/obio.c +++ sys/mips/cavium/obio.c @@ -119,7 +119,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *rv; struct rman *rm; Index: sys/mips/cavium/octopci.c =================================================================== --- sys/mips/cavium/octopci.c +++ sys/mips/cavium/octopci.c @@ -86,7 +86,8 @@ static int octopci_read_ivar(device_t, device_t, int, uintptr_t *); static struct resource *octopci_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, + rman_res_t, u_int); static int octopci_activate_resource(device_t, device_t, int, int, struct resource *); static int octopci_maxslots(device_t); @@ -231,7 +232,7 @@ static struct resource * octopci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct octopci_softc *sc; struct resource *res; Index: sys/mips/idt/idtpci.c =================================================================== --- sys/mips/idt/idtpci.c +++ sys/mips/idt/idtpci.c @@ -465,7 +465,7 @@ static struct resource * idtpci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct idtpci_softc *sc = device_get_softc(bus); Index: sys/mips/idt/obio.c =================================================================== --- sys/mips/idt/obio.c +++ sys/mips/idt/obio.c @@ -59,8 +59,8 @@ struct resource *); static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * - obio_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + obio_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static int obio_attach(device_t); static int obio_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -156,7 +156,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc = device_get_softc(bus); struct obio_ivar *ivar = device_get_ivars(child); @@ -165,7 +165,7 @@ struct rman *rm; int isdefault, needactivate, passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); needactivate = flags & RF_ACTIVE; passthrough = (device_get_parent(child) != bus); rle = NULL; Index: sys/mips/malta/gt.c =================================================================== --- sys/mips/malta/gt.c +++ sys/mips/malta/gt.c @@ -76,7 +76,7 @@ static struct resource * gt_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, start, end, count, flags)); Index: sys/mips/malta/gt_pci.c =================================================================== --- sys/mips/malta/gt_pci.c +++ sys/mips/malta/gt_pci.c @@ -150,7 +150,7 @@ uint32_t, int); static int gt_pci_route_interrupt(device_t pcib, device_t dev, int pin); static struct resource * gt_pci_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static void gt_pci_mask_irq(void *source) @@ -631,7 +631,7 @@ static struct resource * gt_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct gt_pci_softc *sc = device_get_softc(bus); struct resource *rv = NULL; Index: sys/mips/malta/obio.c =================================================================== --- sys/mips/malta/obio.c +++ sys/mips/malta/obio.c @@ -111,7 +111,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *rv; struct rman *rm; Index: sys/mips/mips/cpu.c =================================================================== --- sys/mips/mips/cpu.c +++ sys/mips/mips/cpu.c @@ -400,7 +400,8 @@ static int cpu_probe(device_t); static int cpu_attach(device_t); static struct resource *cpu_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, + u_int); static int cpu_setup_intr(device_t, device_t, struct resource *, int, driver_filter_t *f, driver_intr_t *, void *, void **); @@ -473,7 +474,7 @@ static struct resource * cpu_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; Index: sys/mips/mips/nexus.c =================================================================== --- sys/mips/mips/nexus.c +++ sys/mips/mips/nexus.c @@ -81,22 +81,22 @@ static struct rman mem_rman; static struct resource * - nexus_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + nexus_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static device_t nexus_add_child(device_t, u_int, const char *, int); static int nexus_attach(device_t); static void nexus_delete_resource(device_t, device_t, int, int); static struct resource_list * nexus_get_reslist(device_t, device_t); -static int nexus_get_resource(device_t, device_t, int, int, u_long *, - u_long *); +static int nexus_get_resource(device_t, device_t, int, int, rman_res_t *, + rman_res_t *); static int nexus_print_child(device_t, device_t); static int nexus_print_all_resources(device_t dev); static int nexus_probe(device_t); static int nexus_release_resource(device_t, device_t, int, int, struct resource *); -static int nexus_set_resource(device_t, device_t, int, int, u_long, - u_long); +static int nexus_set_resource(device_t, device_t, int, int, rman_res_t, + rman_res_t); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); static int nexus_deactivate_resource(device_t, device_t, int, int, @@ -154,7 +154,7 @@ } mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = BUS_SPACE_MAXADDR; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "Memory addresses"; if (rman_init(&mem_rman) != 0 || @@ -236,7 +236,7 @@ */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct nexus_device *ndev = DEVTONX(child); struct resource *rv; @@ -244,12 +244,12 @@ 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); - isdefault = (start == 0UL && end == ~0UL && count == 1); + isdefault = (start == 0 && end == ~0 && count == 1); needactivate = flags & RF_ACTIVE; passthrough = (device_get_parent(child) != bus); rle = NULL; @@ -313,13 +313,13 @@ static int nexus_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct nexus_device *ndev = DEVTONX(child); 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, @@ -332,7 +332,7 @@ static int nexus_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) + rman_res_t *startp, rman_res_t *countp) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; Index: sys/mips/nlm/xlp_pci.c =================================================================== --- sys/mips/nlm/xlp_pci.c +++ sys/mips/nlm/xlp_pci.c @@ -433,7 +433,7 @@ 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); } Index: sys/mips/nlm/xlp_simplebus.c =================================================================== --- sys/mips/nlm/xlp_simplebus.c +++ sys/mips/nlm/xlp_simplebus.c @@ -72,7 +72,7 @@ */ static int xlp_simplebus_probe(device_t dev); static struct resource *xlp_simplebus_alloc_resource(device_t, device_t, int, - int *, u_long, u_long, u_long, u_int); + int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int xlp_simplebus_activate_resource(device_t, device_t, int, int, struct resource *); static int xlp_simplebus_setup_intr(device_t, device_t, @@ -116,7 +116,7 @@ panic("xlp_simplebus_init_resources irq_rman"); port_rman.rm_start = 0; - port_rman.rm_end = ~0ul; + port_rman.rm_end = ~0; port_rman.rm_type = RMAN_ARRAY; port_rman.rm_descr = "I/O ports"; if (rman_init(&port_rman) @@ -124,7 +124,7 @@ panic("xlp_simplebus_init_resources port_rman"); mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = ~0; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory"; if (rman_init(&mem_rman) @@ -132,7 +132,7 @@ panic("xlp_simplebus_init_resources mem_rman"); pci_ecfg_rman.rm_start = 0; - pci_ecfg_rman.rm_end = ~0ul; + pci_ecfg_rman.rm_end = ~0; pci_ecfg_rman.rm_type = RMAN_ARRAY; pci_ecfg_rman.rm_descr = "PCI ECFG IO"; if (rman_init(&pci_ecfg_rman) || rman_manage_region(&pci_ecfg_rman, @@ -140,7 +140,7 @@ panic("xlp_simplebus_init_resources pci_ecfg_rman"); gbu_rman.rm_start = 0; - gbu_rman.rm_end = ~0ul; + gbu_rman.rm_end = ~0; gbu_rman.rm_type = RMAN_ARRAY; gbu_rman.rm_descr = "Flash region"; if (rman_init(&gbu_rman) @@ -174,7 +174,7 @@ static struct resource * xlp_simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct rman *rm; struct resource *rv; @@ -192,7 +192,7 @@ bustag = NULL; if (!passthrough) { - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); if (isdefault) { rle = resource_list_find(&di->rl, type, *rid); if (rle == NULL) @@ -218,7 +218,7 @@ 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); } } @@ -244,7 +244,7 @@ } else { if (bootverbose) device_printf(bus, "Invalid MEM range" - "%#lx-%#lx\n", start, end); + "%#jx-%#jx\n", start, end); return (NULL); } break; Index: sys/mips/rmi/iodi.c =================================================================== --- sys/mips/rmi/iodi.c +++ sys/mips/rmi/iodi.c @@ -67,7 +67,7 @@ static struct resource * iodi_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int iodi_activate_resource(device_t, device_t, int, int, @@ -126,7 +126,7 @@ static struct resource * iodi_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res = malloc(sizeof(*res), M_DEVBUF, M_WAITOK); const char *name = device_get_name(child); @@ -135,17 +135,17 @@ #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; } Index: sys/mips/rmi/xlr_pci.c =================================================================== --- sys/mips/rmi/xlr_pci.c +++ sys/mips/rmi/xlr_pci.c @@ -126,7 +126,7 @@ panic("pci_init_resources irq_rman"); port_rman.rm_start = 0; - port_rman.rm_end = ~0ul; + port_rman.rm_end = ~0; port_rman.rm_type = RMAN_ARRAY; port_rman.rm_descr = "I/O ports"; if (rman_init(&port_rman) @@ -134,7 +134,7 @@ panic("pci_init_resources port_rman"); mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; + mem_rman.rm_end = ~0; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory"; if (rman_init(&mem_rman) @@ -468,7 +468,7 @@ 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); } @@ -516,7 +516,7 @@ static struct resource * xlr_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct rman *rm; struct resource *rv; Index: sys/mips/rt305x/obio.c =================================================================== --- sys/mips/rt305x/obio.c +++ sys/mips/rt305x/obio.c @@ -98,8 +98,8 @@ struct resource *); static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * - obio_alloc_resource(device_t, device_t, int, int *, u_long, - u_long, u_long, u_int); + obio_alloc_resource(device_t, device_t, int, int *, rman_res_t, + rman_res_t, rman_res_t, u_int); static int obio_attach(device_t); static int obio_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -278,7 +278,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc = device_get_softc(bus); struct obio_ivar *ivar = device_get_ivars(child); @@ -287,7 +287,7 @@ struct rman *rm; int isdefault, needactivate, passthrough; - isdefault = (start == 0UL && end == ~0UL && count == 1); + isdefault = (start == 0 && end == ~0 && count == 1); needactivate = flags & RF_ACTIVE; passthrough = (device_get_parent(child) != bus); rle = NULL; Index: sys/mips/rt305x/rt305x_gpio.c =================================================================== --- sys/mips/rt305x/rt305x_gpio.c +++ sys/mips/rt305x/rt305x_gpio.c @@ -546,7 +546,7 @@ #ifdef notyet static struct resource * rt305x_gpio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct obio_softc *sc = device_get_softc(bus); struct resource *rv; Index: sys/mips/rt305x/rt305x_pci.c =================================================================== --- sys/mips/rt305x/rt305x_pci.c +++ sys/mips/rt305x/rt305x_pci.c @@ -204,7 +204,7 @@ static struct resource * rt305x_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct rt305x_pci_softc *sc = device_get_softc(bus); struct resource *rv; Index: sys/mips/sentry5/obio.c =================================================================== --- sys/mips/sentry5/obio.c +++ sys/mips/sentry5/obio.c @@ -113,7 +113,7 @@ static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *rv; struct rman *rm; Index: sys/mips/sibyte/sb_zbbus.c =================================================================== --- sys/mips/sibyte/sb_zbbus.c +++ sys/mips/sibyte/sb_zbbus.c @@ -280,7 +280,7 @@ static struct resource * zbbus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; int intrnum, intsrc, isdefault; @@ -288,7 +288,7 @@ struct resource_list_entry *rle; struct zbbus_devinfo *dinfo; - isdefault = (start == 0UL && end == ~0UL && count == 1); + isdefault = (start == 0 && end == ~0 && count == 1); /* * Our direct child is asking for a default resource allocation. Index: sys/mips/sibyte/sb_zbpci.c =================================================================== --- sys/mips/sibyte/sb_zbpci.c +++ sys/mips/sibyte/sb_zbpci.c @@ -165,7 +165,7 @@ static struct resource * zbpci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; Index: sys/pc98/cbus/pmc.c =================================================================== --- sys/pc98/cbus/pmc.c +++ sys/pc98/cbus/pmc.c @@ -101,7 +101,7 @@ rid = 0; sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, PMC_ISA_PORTSIZE, + 0, ~0, PMC_ISA_PORTSIZE, RF_ACTIVE); if (sc->port_res == NULL) { return (ENOMEM); Index: sys/pc98/pc98/canbus.c =================================================================== --- sys/pc98/pc98/canbus.c +++ sys/pc98/pc98/canbus.c @@ -84,7 +84,7 @@ static int canbus_print_child(device_t, device_t); static device_t canbus_add_child(device_t, u_int, const char *, int); static struct resource * canbus_alloc_resource( - device_t, device_t, int, int *, u_long, u_long, u_long, u_int); + device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int canbus_activate_resource( device_t, device_t, int, int, struct resource *); static int canbus_deactivate_resource( @@ -92,7 +92,7 @@ static int canbus_release_resource( device_t, device_t, int, int, struct resource *); static int canbus_set_resource ( - device_t, device_t, int, int, u_long, u_long); + device_t, device_t, int, int, rman_res_t, rman_res_t); static void canbus_delete_resource(device_t, device_t, int, int); /* canbus local function */ @@ -254,7 +254,7 @@ static struct resource * canbus_alloc_resource(device_t dev, device_t child, int type, - int *rid, u_long start, u_long end, u_long count, u_int flags) + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, start, end, count, flags)); @@ -286,7 +286,8 @@ static int canbus_set_resource ( - device_t dev, device_t child, int type, int rid, u_long start, u_long count) + device_t dev, device_t child, int type, int rid, rman_res_t start, + rman_res_t count) { struct canbus_device *cbdev = (struct canbus_device *)device_get_ivars(child); Index: sys/powerpc/mpc85xx/isa.c =================================================================== --- sys/powerpc/mpc85xx/isa.c +++ sys/powerpc/mpc85xx/isa.c @@ -52,7 +52,7 @@ struct resource_list *rl = &idev->id_resources; int isdefault, passthrough, rids; - isdefault = (start == 0UL && end == ~0UL) ? 1 : 0; + isdefault = (start == 0 && end == ~0) ? 1 : 0; passthrough = (device_get_parent(child) != bus) ? 1 : 0; if (!passthrough && !isdefault && Index: sys/powerpc/mpc85xx/lbc.c =================================================================== --- sys/powerpc/mpc85xx/lbc.c +++ sys/powerpc/mpc85xx/lbc.c @@ -69,7 +69,7 @@ static int lbc_attach(device_t); static int lbc_shutdown(device_t); static struct resource *lbc_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int lbc_print_child(device_t, device_t); static int lbc_release_resource(device_t, device_t, int, int, struct resource *); @@ -663,7 +663,7 @@ static struct resource * lbc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct lbc_softc *sc; struct lbc_devinfo *di; @@ -673,7 +673,7 @@ int needactivate; /* We only support default allocations. */ - if (start != 0ul || end != ~0ul) + if (start != 0 || end != ~0) return (NULL); sc = device_get_softc(bus); @@ -712,8 +712,8 @@ 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); } @@ -743,8 +743,8 @@ 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); Index: sys/powerpc/ofw/ofw_pci.c =================================================================== --- sys/powerpc/ofw/ofw_pci.c +++ sys/powerpc/ofw/ofw_pci.c @@ -62,8 +62,8 @@ static int ofw_pci_read_ivar(device_t, device_t, int, uintptr_t *); static struct resource * ofw_pci_alloc_resource(device_t bus, - device_t child, int type, int *rid, u_long start, - u_long end, u_long count, u_int flags); + device_t child, int type, int *rid, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags); static int ofw_pci_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res); static int ofw_pci_activate_resource(device_t bus, device_t child, @@ -72,8 +72,8 @@ device_t child, int type, int rid, struct resource *res); static int ofw_pci_adjust_resource(device_t bus, device_t child, - int type, struct resource *res, u_long start, - u_long end); + int type, struct resource *res, rman_res_t start, + rman_res_t end); /* * pcib interface. @@ -308,7 +308,7 @@ static struct resource * ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ofw_pci_softc *sc; struct resource *rv; @@ -388,10 +388,10 @@ } 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 @@ -420,8 +420,8 @@ } 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) @@ -454,7 +454,7 @@ static int ofw_pci_adjust_resource(device_t bus, device_t child, int type, - struct resource *res, u_long start, u_long end) + struct resource *res, rman_res_t start, rman_res_t end) { struct rman *rm = NULL; struct ofw_pci_softc *sc = device_get_softc(bus); Index: sys/powerpc/powermac/macgpio.c =================================================================== --- sys/powerpc/powermac/macgpio.c +++ sys/powerpc/powermac/macgpio.c @@ -71,7 +71,7 @@ static int macgpio_print_child(device_t dev, device_t child); static void macgpio_probe_nomatch(device_t, device_t); static struct resource *macgpio_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int macgpio_activate_resource(device_t, device_t, int, int, struct resource *); static int macgpio_deactivate_resource(device_t, device_t, int, int, @@ -267,7 +267,8 @@ static struct resource * macgpio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct macgpio_devinfo *dinfo; Index: sys/powerpc/powermac/macio.c =================================================================== --- sys/powerpc/powermac/macio.c +++ sys/powerpc/powermac/macio.c @@ -78,7 +78,8 @@ static int macio_print_child(device_t dev, device_t child); static void macio_probe_nomatch(device_t, device_t); static struct resource *macio_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, + u_int); static int macio_activate_resource(device_t, device_t, int, int, struct resource *); static int macio_deactivate_resource(device_t, device_t, int, int, @@ -479,7 +480,8 @@ static struct resource * macio_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct macio_softc *sc; int needactivate; Index: sys/powerpc/powermac/uninorth.c =================================================================== --- sys/powerpc/powermac/uninorth.c +++ sys/powerpc/powermac/uninorth.c @@ -72,7 +72,8 @@ static int unin_chip_print_child(device_t dev, device_t child); static void unin_chip_probe_nomatch(device_t, device_t); static struct resource *unin_chip_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, + rman_res_t, u_int); static int unin_chip_activate_resource(device_t, device_t, int, int, struct resource *); static int unin_chip_deactivate_resource(device_t, device_t, int, int, @@ -455,7 +456,8 @@ static struct resource * unin_chip_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct unin_chip_softc *sc; int needactivate; @@ -589,7 +591,7 @@ 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)); Index: sys/powerpc/powerpc/nexus.c =================================================================== --- sys/powerpc/powerpc/nexus.c +++ sys/powerpc/powerpc/nexus.c @@ -189,13 +189,13 @@ { if (type == SYS_RES_MEMORY) { - vm_offset_t start; + vm_paddr_t start; void *p; - start = (vm_offset_t) rman_get_start(r); + start = rman_get_start(r); if (bootverbose) - printf("nexus mapdev: start %zx, len %ld\n", start, - rman_get_size(r)); + printf("nexus mapdev: start %jx, len %jd\n", + (rman_res_t)start, rman_get_size(r)); p = pmap_mapdev(start, (vm_size_t) rman_get_size(r)); if (p == NULL) Index: sys/powerpc/psim/ata_iobus.c =================================================================== --- sys/powerpc/psim/ata_iobus.c +++ sys/powerpc/psim/ata_iobus.c @@ -59,7 +59,8 @@ static int ata_iobus_probe(device_t dev); static int ata_iobus_print_child(device_t dev, device_t child); struct resource *ata_iobus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, + u_int); static int ata_iobus_release_resource(device_t, device_t, int, int, struct resource *); @@ -135,7 +136,8 @@ struct resource * ata_iobus_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct resource *res = NULL; int myrid; Index: sys/powerpc/psim/iobus.c =================================================================== --- sys/powerpc/psim/iobus.c +++ sys/powerpc/psim/iobus.c @@ -72,7 +72,8 @@ static int iobus_read_ivar(device_t, device_t, int, uintptr_t *); static int iobus_write_ivar(device_t, device_t, int, uintptr_t); static struct resource *iobus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, + u_int); static int iobus_activate_resource(device_t, device_t, int, int, struct resource *); static int iobus_deactivate_resource(device_t, device_t, int, int, @@ -305,7 +306,8 @@ static struct resource * iobus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct iobus_softc *sc; int needactivate; Index: sys/sparc64/central/central.c =================================================================== --- sys/sparc64/central/central.c +++ sys/sparc64/central/central.c @@ -183,8 +183,8 @@ static int central_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *r __unused, u_long start __unused, - u_long end __unused) + int type __unused, struct resource *r __unused, rman_res_t start __unused, + rman_res_t end __unused) { return (ENXIO); @@ -215,7 +215,7 @@ static struct resource * central_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list *rl; struct resource_list_entry *rle; @@ -228,7 +228,7 @@ int passthrough; int i; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != bus); res = NULL; rle = NULL; Index: sys/sparc64/ebus/ebus.c =================================================================== --- sys/sparc64/ebus/ebus.c +++ sys/sparc64/ebus/ebus.c @@ -427,7 +427,7 @@ static struct resource * ebus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ebus_softc *sc; struct resource_list *rl; @@ -438,7 +438,7 @@ uint64_t cend, cstart, offset; int i, isdefault, passthrough, ridx; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != bus); sc = device_get_softc(bus); rl = BUS_GET_RESOURCE_LIST(bus, child); @@ -544,8 +544,8 @@ static int ebus_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *res __unused, u_long start __unused, - u_long end __unused) + int type __unused, struct resource *res __unused, rman_res_t start __unused, + rman_res_t end __unused) { return (ENXIO); Index: sys/sparc64/fhc/fhc.c =================================================================== --- sys/sparc64/fhc/fhc.c +++ sys/sparc64/fhc/fhc.c @@ -420,7 +420,7 @@ static struct resource * fhc_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list *rl; struct resource_list_entry *rle; @@ -433,7 +433,7 @@ int passthrough; int i; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != bus); res = NULL; rle = NULL; @@ -479,8 +479,8 @@ static int fhc_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *r __unused, u_long start __unused, - u_long end __unused) + int type __unused, struct resource *r __unused, rman_res_t start __unused, + rman_res_t end __unused) { return (ENXIO); Index: sys/sparc64/isa/isa.c =================================================================== --- sys/sparc64/isa/isa.c +++ sys/sparc64/isa/isa.c @@ -273,16 +273,16 @@ struct resource * isa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { /* * Consider adding a resource definition. */ int passthrough = (device_get_parent(child) != bus); - int isdefault = (start == 0UL && end == ~0UL); + int isdefault = (start == 0 && end == ~0); struct resource_list *rl; struct resource_list_entry *rle; - u_long base, limit; + rman_res_t base, limit; rl = BUS_GET_RESOURCE_LIST(bus, child); if (!passthrough && !isdefault) { Index: sys/sparc64/pci/apb.c =================================================================== --- sys/sparc64/pci/apb.c +++ sys/sparc64/pci/apb.c @@ -130,13 +130,13 @@ } static void -apb_map_print(uint8_t map, u_long scale) +apb_map_print(uint8_t map, rman_res_t scale) { int i, first; for (first = 1, i = 0; i < 8; i++) { if ((map & (1 << i)) != 0) { - printf("%s0x%lx-0x%lx", first ? "" : ", ", + printf("%s0x%jx-0x%jx", first ? "" : ", ", i * scale, (i + 1) * scale - 1); first = 0; } @@ -144,7 +144,7 @@ } static int -apb_checkrange(uint8_t map, u_long scale, u_long start, u_long end) +apb_checkrange(uint8_t map, rman_res_t scale, rman_res_t start, rman_res_t end) { int i, ei; @@ -227,7 +227,7 @@ */ static struct resource * apb_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct apb_softc *sc; @@ -253,26 +253,26 @@ case SYS_RES_IOPORT: if (!apb_checkrange(sc->sc_iomap, APB_IO_SCALE, start, end)) { device_printf(dev, "device %s requested unsupported " - "I/O range 0x%lx-0x%lx\n", + "I/O range 0x%jx-0x%jx\n", device_get_nameunit(child), start, end); return (NULL); } if (bootverbose) device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device " - "%s requested decoded I/O range 0x%lx-0x%lx\n", + "%s requested decoded I/O range 0x%jx-0x%jx\n", device_get_nameunit(child), start, end); break; case SYS_RES_MEMORY: if (!apb_checkrange(sc->sc_memmap, APB_MEM_SCALE, start, end)) { device_printf(dev, "device %s requested unsupported " - "memory range 0x%lx-0x%lx\n", + "memory range 0x%jx-0x%jx\n", device_get_nameunit(child), start, end); return (NULL); } if (bootverbose) device_printf(sc->sc_bsc.ops_pcib_sc.dev, "device " - "%s requested decoded memory range 0x%lx-0x%lx\n", + "%s requested decoded memory range 0x%jx-0x%jx\n", device_get_nameunit(child), start, end); break; } @@ -287,7 +287,7 @@ static int apb_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct apb_softc *sc; Index: sys/sparc64/pci/fire.c =================================================================== --- sys/sparc64/pci/fire.c +++ sys/sparc64/pci/fire.c @@ -1852,7 +1852,7 @@ static struct resource * fire_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct fire_softc *sc; Index: sys/sparc64/pci/ofw_pci.c =================================================================== --- sys/sparc64/pci/ofw_pci.c +++ sys/sparc64/pci/ofw_pci.c @@ -287,7 +287,7 @@ struct resource * ofw_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ofw_pci_softc *sc; struct resource *rv; @@ -362,7 +362,7 @@ int ofw_pci_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct ofw_pci_softc *sc; struct rman *rm; Index: sys/sparc64/pci/psycho.c =================================================================== --- sys/sparc64/pci/psycho.c +++ sys/sparc64/pci/psycho.c @@ -1038,7 +1038,7 @@ static struct resource * psycho_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct psycho_softc *sc; Index: sys/sparc64/pci/sbbc.c =================================================================== --- sys/sparc64/pci/sbbc.c +++ sys/sparc64/pci/sbbc.c @@ -397,7 +397,7 @@ static struct resource * sbbc_bus_alloc_resource(device_t dev, device_t child __unused, int type, - int *rid, u_long start, u_long end, u_long count, u_int flags) + int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct sbbc_softc *sc; @@ -435,8 +435,8 @@ static int sbbc_bus_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *res __unused, u_long start __unused, - u_long end __unused) + int type __unused, struct resource *res __unused, rman_res_t start __unused, + rman_res_t end __unused) { return (ENXIO); Index: sys/sparc64/pci/schizo.c =================================================================== --- sys/sparc64/pci/schizo.c +++ sys/sparc64/pci/schizo.c @@ -1196,7 +1196,7 @@ static struct resource * schizo_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct schizo_softc *sc; Index: sys/sparc64/sbus/sbus.c =================================================================== --- sys/sparc64/sbus/sbus.c +++ sys/sparc64/sbus/sbus.c @@ -710,7 +710,7 @@ static struct resource * sbus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct sbus_softc *sc; struct rman *rm; @@ -723,7 +723,7 @@ int i, slot; int isdefault, passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != bus); rle = NULL; sc = device_get_softc(bus); @@ -821,7 +821,7 @@ static int sbus_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct sbus_softc *sc; int i; Index: sys/sparc64/sparc64/nexus.c =================================================================== --- sys/sparc64/sparc64/nexus.c +++ sys/sparc64/sparc64/nexus.c @@ -231,7 +231,7 @@ rman_init(&sc->sc_mem_rman) != 0 || rman_manage_region(&sc->sc_intr_rman, 0, IV_MAX - 1) != 0 || - rman_manage_region(&sc->sc_mem_rman, 0ULL, ~0ULL) != 0) + rman_manage_region(&sc->sc_mem_rman, 0ULL, BUS_SPACE_MAXADDR) != 0) panic("%s: failed to set up rmans.", __func__); } else node = ofw_bus_get_node(dev); @@ -359,7 +359,7 @@ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct nexus_softc *sc; struct rman *rm; @@ -368,7 +368,7 @@ device_t nexus; int isdefault, passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != bus); nexus = bus; while (strcmp(device_get_name(device_get_parent(nexus)), "root") != 0) @@ -445,7 +445,7 @@ static int nexus_adjust_resource(device_t bus, device_t child __unused, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct nexus_softc *sc; struct rman *rm; Index: sys/sparc64/sparc64/upa.c =================================================================== --- sys/sparc64/sparc64/upa.c +++ sys/sparc64/sparc64/upa.c @@ -194,7 +194,7 @@ int i, imr, j, rid; #if 1 device_t *children, schizo; - u_long scount, sstart, ucount, ustart; + rman_res_t scount, sstart, ucount, ustart; int nchildren; #endif @@ -403,7 +403,7 @@ static struct resource * upa_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list *rl; struct resource_list_entry *rle; @@ -412,7 +412,7 @@ bus_addr_t cend, cstart; int i, isdefault, passthrough; - isdefault = (start == 0UL && end == ~0UL); + isdefault = (start == 0 && end == ~0); passthrough = (device_get_parent(child) != dev); sc = device_get_softc(dev); rl = BUS_GET_RESOURCE_LIST(dev, child); @@ -510,8 +510,8 @@ static int upa_adjust_resource(device_t bus __unused, device_t child __unused, - int type __unused, struct resource *r __unused, u_long start __unused, - u_long end __unused) + int type __unused, struct resource *r __unused, rman_res_t start __unused, + rman_res_t end __unused) { return (ENXIO); Index: sys/sys/_types.h =================================================================== --- sys/sys/_types.h +++ sys/sys/_types.h @@ -112,4 +112,6 @@ __int64_t _mbstateL; /* for alignment */ } __mbstate_t; +typedef __uintmax_t __rman_res_t; + #endif /* !_SYS__TYPES_H_ */ Index: sys/sys/bus.h =================================================================== --- sys/sys/bus.h +++ sys/sys/bus.h @@ -29,6 +29,7 @@ #ifndef _SYS_BUS_H_ #define _SYS_BUS_H_ +#include #include #include #include @@ -292,9 +293,9 @@ int rid; /**< @brief resource identifier */ int flags; /**< @brief resource flags */ struct resource *res; /**< @brief the real resource when allocated */ - u_long start; /**< @brief start of resource range */ - u_long end; /**< @brief end of resource range */ - u_long count; /**< @brief count within range */ + rman_res_t start; /**< @brief start of resource range */ + rman_res_t end; /**< @brief end of resource range */ + rman_res_t count; /**< @brief count within range */ }; STAILQ_HEAD(resource_list, resource_list_entry); @@ -307,10 +308,10 @@ struct resource_list_entry * resource_list_add(struct resource_list *rl, int type, int rid, - u_long start, u_long end, u_long count); + rman_res_t start, rman_res_t end, rman_res_t count); int resource_list_add_next(struct resource_list *rl, int type, - u_long start, u_long end, u_long count); + rman_res_t start, rman_res_t end, rman_res_t count); int resource_list_busy(struct resource_list *rl, int type, int rid); int resource_list_reserved(struct resource_list *rl, int type, int rid); @@ -323,8 +324,8 @@ resource_list_alloc(struct resource_list *rl, device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, - u_long count, u_int flags); + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); int resource_list_release(struct resource_list *rl, device_t bus, device_t child, int type, int rid, struct resource *res); @@ -335,8 +336,8 @@ resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, - u_long count, u_int flags); + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); int resource_list_unreserve(struct resource_list *rl, device_t bus, device_t child, int type, int rid); @@ -362,12 +363,12 @@ bus_generic_add_child(device_t dev, u_int order, const char *name, int unit); int bus_generic_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, - u_long end); + struct resource *r, rman_res_t start, + rman_res_t end); struct resource * bus_generic_alloc_resource(device_t bus, device_t child, int type, - int *rid, u_long start, u_long end, - u_long count, u_int flags); + int *rid, rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); int bus_generic_attach(device_t dev); int bus_generic_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu); @@ -405,12 +406,12 @@ struct resource * bus_generic_rl_alloc_resource (device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); void bus_generic_rl_delete_resource (device_t, device_t, int, int); -int bus_generic_rl_get_resource (device_t, device_t, int, int, u_long *, - u_long *); -int bus_generic_rl_set_resource (device_t, device_t, int, int, u_long, - u_long); +int bus_generic_rl_get_resource (device_t, device_t, int, int, rman_res_t *, + rman_res_t *); +int bus_generic_rl_set_resource (device_t, device_t, int, int, rman_res_t, + rman_res_t); int bus_generic_rl_release_resource (device_t, device_t, int, int, struct resource *); @@ -439,10 +440,10 @@ struct resource **res); int bus_adjust_resource(device_t child, int type, struct resource *r, - u_long start, u_long end); + rman_res_t start, rman_res_t end); struct resource *bus_alloc_resource(device_t dev, int type, int *rid, - u_long start, u_long end, u_long count, - u_int flags); + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); int bus_activate_resource(device_t dev, int type, int rid, struct resource *r); int bus_deactivate_resource(device_t dev, int type, int rid, @@ -460,11 +461,11 @@ int bus_describe_intr(device_t dev, struct resource *irq, void *cookie, const char *fmt, ...); int bus_set_resource(device_t dev, int type, int rid, - u_long start, u_long count); + rman_res_t start, rman_res_t count); int bus_get_resource(device_t dev, int type, int rid, - u_long *startp, u_long *countp); -u_long bus_get_resource_start(device_t dev, int type, int rid); -u_long bus_get_resource_count(device_t dev, int type, int rid); + rman_res_t *startp, rman_res_t *countp); +rman_res_t bus_get_resource_start(device_t dev, int type, int rid); +rman_res_t bus_get_resource_count(device_t dev, int type, int rid); void bus_delete_resource(device_t dev, int type, int rid); int bus_child_present(device_t child); int bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen); @@ -474,7 +475,7 @@ static __inline struct resource * bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags) { - return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)); + return (bus_alloc_resource(dev, type, rid, 0, ~0, 1, flags)); } /* Index: sys/sys/libkern.h =================================================================== --- sys/sys/libkern.h +++ sys/sys/libkern.h @@ -65,6 +65,16 @@ static __inline u_quad_t uqmin(u_quad_t a, u_quad_t b) { return (a < b ? a : b); } static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } +static __inline __uintmax_t ummax(__uintmax_t a, __uintmax_t b) +{ + + return (a > b ? a : b); +} +static __inline __uintmax_t ummin(__uintmax_t a, __uintmax_t b) +{ + + return (a < b ? a : b); +} static __inline off_t omax(off_t a, off_t b) { return (a > b ? a : b); } static __inline off_t omin(off_t a, off_t b) { return (a < b ? a : b); } Index: sys/sys/rman.h =================================================================== --- sys/sys/rman.h +++ sys/sys/rman.h @@ -61,6 +61,8 @@ */ #define RM_TEXTLEN 32 +#define RM_MAX_END ((rman_res_t)~0) + /* * Userspace-exported structures. */ @@ -70,8 +72,8 @@ uintptr_t r_device; /* device owning this resource */ char r_devname[RM_TEXTLEN]; /* device name XXX obsolete */ - u_long r_start; /* offset in resource space */ - u_long r_size; /* size in resource space */ + rman_res_t r_start; /* offset in resource space */ + rman_res_t r_size; /* size in resource space */ u_int r_flags; /* RF_* flags */ }; @@ -79,8 +81,8 @@ uintptr_t rm_handle; /* rman uniquifier */ char rm_descr[RM_TEXTLEN]; /* rman description */ - u_long rm_start; /* base of managed region */ - u_long rm_size; /* size of managed region */ + rman_res_t rm_start; /* base of managed region */ + bus_size_t rm_size; /* size of managed region */ enum rman_type rm_type; /* region type */ }; @@ -108,47 +110,47 @@ struct resource_head rm_list; struct mtx *rm_mtx; /* mutex used to protect rm_list */ TAILQ_ENTRY(rman) rm_link; /* link in list of all rmans */ - u_long rm_start; /* index of globally first entry */ - u_long rm_end; /* index of globally last entry */ + rman_res_t rm_start; /* index of globally first entry */ + rman_res_t rm_end; /* index of globally last entry */ enum rman_type rm_type; /* what type of resource this is */ const char *rm_descr; /* text descripion of this resource */ }; TAILQ_HEAD(rman_head, rman); int rman_activate_resource(struct resource *r); -int rman_adjust_resource(struct resource *r, u_long start, u_long end); +int rman_adjust_resource(struct resource *r, rman_res_t start, rman_res_t end); int rman_await_resource(struct resource *r, int pri, int timo); -int rman_first_free_region(struct rman *rm, u_long *start, u_long *end); +int rman_first_free_region(struct rman *rm, rman_res_t *start, rman_res_t *end); bus_space_handle_t rman_get_bushandle(struct resource *); bus_space_tag_t rman_get_bustag(struct resource *); -u_long rman_get_end(struct resource *); +rman_res_t rman_get_end(struct resource *); struct device *rman_get_device(struct resource *); u_int rman_get_flags(struct resource *); int rman_get_rid(struct resource *); -u_long rman_get_size(struct resource *); -u_long rman_get_start(struct resource *); +rman_res_t rman_get_size(struct resource *); +rman_res_t rman_get_start(struct resource *); void *rman_get_virtual(struct resource *); int rman_deactivate_resource(struct resource *r); int rman_fini(struct rman *rm); int rman_init(struct rman *rm); int rman_init_from_resource(struct rman *rm, struct resource *r); -int rman_last_free_region(struct rman *rm, u_long *start, u_long *end); +int rman_last_free_region(struct rman *rm, rman_res_t *start, rman_res_t *end); uint32_t rman_make_alignment_flags(uint32_t size); -int rman_manage_region(struct rman *rm, u_long start, u_long end); +int rman_manage_region(struct rman *rm, rman_res_t start, rman_res_t end); int rman_is_region_manager(struct resource *r, struct rman *rm); int rman_release_resource(struct resource *r); -struct resource *rman_reserve_resource(struct rman *rm, u_long start, - u_long end, u_long count, +struct resource *rman_reserve_resource(struct rman *rm, rman_res_t start, + rman_res_t end, rman_res_t count, u_int flags, struct device *dev); -struct resource *rman_reserve_resource_bound(struct rman *rm, u_long start, - u_long end, u_long count, u_long bound, +struct resource *rman_reserve_resource_bound(struct rman *rm, rman_res_t start, + rman_res_t end, rman_res_t count, rman_res_t bound, u_int flags, struct device *dev); void rman_set_bushandle(struct resource *_r, bus_space_handle_t _h); void rman_set_bustag(struct resource *_r, bus_space_tag_t _t); void rman_set_device(struct resource *_r, struct device *_dev); -void rman_set_end(struct resource *_r, u_long _end); +void rman_set_end(struct resource *_r, rman_res_t _end); void rman_set_rid(struct resource *_r, int _rid); -void rman_set_start(struct resource *_r, u_long _start); +void rman_set_start(struct resource *_r, rman_res_t _start); void rman_set_virtual(struct resource *_r, void *_v); extern struct rman_head rman_head; Index: sys/sys/types.h =================================================================== --- sys/sys/types.h +++ sys/sys/types.h @@ -250,6 +250,8 @@ typedef __vm_pindex_t vm_pindex_t; typedef __vm_size_t vm_size_t; +typedef __rman_res_t rman_res_t; + #ifdef _KERNEL typedef int boolean_t; typedef struct device *device_t; Index: sys/x86/include/legacyvar.h =================================================================== --- sys/x86/include/legacyvar.h +++ sys/x86/include/legacyvar.h @@ -56,9 +56,10 @@ int legacy_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value); struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child, - int type, int *rid, u_long start, u_long end, u_long count, u_int flags); + int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags); int legacy_pcib_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, u_long start, u_long end); + struct resource *r, rman_res_t start, rman_res_t end); int legacy_pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, Index: sys/x86/include/pci_cfgreg.h =================================================================== --- sys/x86/include/pci_cfgreg.h +++ sys/x86/include/pci_cfgreg.h @@ -46,7 +46,7 @@ #define CONF2_ENABLE_CHK 0x0e #define CONF2_ENABLE_RES 0x0e -u_long hostb_alloc_start(int type, u_long start, u_long end, u_long count); +rman_res_t hostb_alloc_start(int type, rman_res_t start, rman_res_t end, rman_res_t count); int pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus); int pci_cfgregopen(void); u_int32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes); Index: sys/x86/isa/atrtc.c =================================================================== --- sys/x86/isa/atrtc.c +++ sys/x86/isa/atrtc.c @@ -241,7 +241,7 @@ atrtc_attach(device_t dev) { struct atrtc_softc *sc; - u_long s; + rman_res_t s; int i; sc = device_get_softc(dev); Index: sys/x86/isa/clock.c =================================================================== --- sys/x86/isa/clock.c +++ sys/x86/isa/clock.c @@ -656,7 +656,7 @@ attimer_attach(device_t dev) { struct attimer_softc *sc; - u_long s; + rman_res_t s; int i; attimer_sc = sc = device_get_softc(dev); Index: sys/x86/isa/isa.c =================================================================== --- sys/x86/isa/isa.c +++ sys/x86/isa/isa.c @@ -88,13 +88,13 @@ */ struct resource * isa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { /* * Consider adding a resource definition. */ int passthrough = (device_get_parent(child) != bus); - int isdefault = (start == 0UL && end == ~0UL); + int isdefault = (start == 0 && end == ~0); struct isa_device* idev = DEVTOISA(child); struct resource_list *rl = &idev->id_resources; struct resource_list_entry *rle; Index: sys/x86/pci/pci_bus.c =================================================================== --- sys/x86/pci/pci_bus.c +++ sys/x86/pci/pci_bus.c @@ -578,8 +578,8 @@ SYSCTL_ULONG(_hw_pci, OID_AUTO, host_mem_start, CTLFLAG_RDTUN, &host_mem_start, 0, "Limit the host bridge memory to being above this address."); -u_long -hostb_alloc_start(int type, u_long start, u_long end, u_long count) +rman_res_t +hostb_alloc_start(int type, rman_res_t start, rman_res_t end, rman_res_t count) { if (start + count - 1 != end) { @@ -593,7 +593,7 @@ struct resource * legacy_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { #if defined(NEW_PCIB) && defined(PCI_RES_BUS) @@ -609,7 +609,7 @@ #if defined(NEW_PCIB) && defined(PCI_RES_BUS) int legacy_pcib_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { if (type == PCI_RES_BUS) Index: sys/x86/pci/qpi.c =================================================================== --- sys/x86/pci/qpi.c +++ sys/x86/pci/qpi.c @@ -241,7 +241,7 @@ #if defined(NEW_PCIB) && defined(PCI_RES_BUS) static struct resource * qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { if (type == PCI_RES_BUS) Index: sys/x86/x86/io_apic.c =================================================================== --- sys/x86/x86/io_apic.c +++ sys/x86/x86/io_apic.c @@ -987,14 +987,6 @@ { int error; -#ifdef PAE - /* - * Resources use long's to track resources, so we can't - * include memory regions above 4GB. - */ - if (base >= ~0ul) - return; -#endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, base, length); if (error) panic("apic_add_resource: resource %d failed set with %d", rid, Index: sys/x86/x86/mptable_pci.c =================================================================== --- sys/x86/x86/mptable_pci.c +++ sys/x86/x86/mptable_pci.c @@ -75,7 +75,7 @@ #ifdef NEW_PCIB static int -mptable_is_isa_range(u_long start, u_long end) +mptable_is_isa_range(rman_res_t start, rman_res_t end) { if (end >= 0x10000) @@ -88,7 +88,7 @@ } static int -mptable_is_vga_range(u_long start, u_long end) +mptable_is_vga_range(rman_res_t start, rman_res_t end) { if (end >= 0x10000) return (0); @@ -101,7 +101,7 @@ static struct resource * mptable_hostb_alloc_resource(device_t dev, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct mptable_hostb_softc *sc; @@ -142,7 +142,7 @@ static int mptable_hostb_adjust_resource(device_t dev, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct mptable_hostb_softc *sc; Index: sys/x86/x86/nexus.c =================================================================== --- sys/x86/x86/nexus.c +++ sys/x86/x86/nexus.c @@ -99,9 +99,10 @@ static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, + u_int); static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - u_long, u_long); + rman_res_t, rman_res_t); #ifdef SMP static int nexus_bind_intr(device_t, device_t, struct resource *, int); #endif @@ -122,8 +123,10 @@ static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); static struct resource_list *nexus_get_reslist(device_t dev, device_t child); -static int nexus_set_resource(device_t, device_t, int, int, u_long, u_long); -static int nexus_get_resource(device_t, device_t, int, int, u_long *, u_long *); +static int nexus_set_resource(device_t, device_t, int, int, + rman_res_t, rman_res_t); +static int nexus_get_resource(device_t, device_t, int, int, + rman_res_t *, rman_res_t *); static void nexus_delete_resource(device_t, device_t, int, int); #ifdef DEV_APIC static int nexus_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs); @@ -259,11 +262,15 @@ panic("nexus_init_resources port_rman"); mem_rman.rm_start = 0; - mem_rman.rm_end = ~0ul; +#ifndef PAE + mem_rman.rm_end = BUS_SPACE_MAXADDR; +#else + mem_rman.rm_end = ((1ULL << cpu_maxphyaddr) - 1); +#endif mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(&mem_rman) - || rman_manage_region(&mem_rman, 0, ~0)) + || rman_manage_region(&mem_rman, 0, mem_rman.rm_end)) panic("nexus_init_resources mem_rman"); } @@ -359,7 +366,8 @@ */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, + u_int flags) { struct nexus_device *ndev = DEVTONX(child); struct resource *rv; @@ -373,7 +381,7 @@ * (ie. they aren't maintained by a child bus), then work out * the start/end values. */ - if ((start == 0UL) && (end == ~0UL) && (count == 1)) { + if ((start == 0) && (end == ~0) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) return(NULL); rle = resource_list_find(&ndev->nx_resources, type, *rid); @@ -406,7 +414,7 @@ static int nexus_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) + struct resource *r, rman_res_t start, rman_res_t end) { struct rman *rm; @@ -574,7 +582,8 @@ } static int -nexus_set_resource(device_t dev, device_t child, int type, int rid, u_long start, u_long count) +nexus_set_resource(device_t dev, device_t child, int type, int rid, + rman_res_t start, rman_res_t count) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; @@ -585,7 +594,8 @@ } static int -nexus_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp) +nexus_get_resource(device_t dev, device_t child, int type, int rid, + rman_res_t *startp, rman_res_t *countp) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; @@ -701,12 +711,12 @@ if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) continue; -#ifdef __i386__ +#if defined(__i386__) && !defined(PAE) /* - * Resources use long's to track resources, so - * we can't include memory regions above 4GB. + * Address ranges above 4GB can't be accessed with + * standard page tables. */ - if (smap->base > ~0ul) + if (smap->base > BUS_SPACE_MAXADDR) continue; #endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, @@ -735,14 +745,6 @@ * segment is 0. */ for (rid = 0, p = dump_avail; p[1] != 0; rid++, p += 2) { -#ifdef PAE - /* - * Resources use long's to track resources, so we can't - * include memory regions above 4GB. - */ - if (p[0] > ~0ul) - break; -#endif error = bus_set_resource(dev, SYS_RES_MEMORY, rid, p[0], p[1] - p[0]); if (error) Index: sys/x86/xen/xenpv.c =================================================================== --- sys/x86/xen/xenpv.c +++ sys/x86/xen/xenpv.c @@ -120,7 +120,7 @@ int error; res = bus_alloc_resource(child, SYS_RES_MEMORY, res_id, LOW_MEM_LIMIT, - ~0ul, size, RF_ACTIVE); + ~0, size, RF_ACTIVE); if (res == NULL) return (NULL); Index: usr.sbin/devinfo/devinfo.c =================================================================== --- usr.sbin/devinfo/devinfo.c +++ usr.sbin/devinfo/devinfo.c @@ -66,9 +66,9 @@ rman = devinfo_handle_to_rman(res->dr_rman); hexmode = (rman->dm_size > 1000) || (rman->dm_size == 0); - printf(hexmode ? "0x%lx" : "%lu", res->dr_start); + printf(hexmode ? "0x%jx" : "%ju", res->dr_start); if (res->dr_size > 1) - printf(hexmode ? "-0x%lx" : "-%lu", + printf(hexmode ? "-0x%jx" : "-%ju", res->dr_start + res->dr_size - 1); }