Index: ./alpha/isa/isa.c =================================================================== RCS file: /cache/ncvs/src/sys/alpha/isa/isa.c,v retrieving revision 1.38 diff -u -r1.38 isa.c --- ./alpha/isa/isa.c 25 Oct 2005 19:48:45 -0000 1.38 +++ ./alpha/isa/isa.c 19 Apr 2006 21:42:42 -0000 @@ -231,6 +231,7 @@ res = rman_reserve_resource(&isa_drq_rman, start, start, 1, 0, child); + rman_set_rid(res, *rid); if (res && !passthrough) { rle = resource_list_find(rl, type, *rid); rle->start = rman_get_start(res); Index: ./alpha/pci/apecs_pci.c =================================================================== RCS file: /cache/ncvs/src/sys/alpha/pci/apecs_pci.c,v retrieving revision 1.15 diff -u -r1.15 apecs_pci.c --- ./alpha/pci/apecs_pci.c 22 Aug 2003 07:20:27 -0000 1.15 +++ ./alpha/pci/apecs_pci.c 19 Apr 2006 21:47:28 -0000 @@ -79,12 +79,17 @@ apecs_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) { + struct resource *rv = NULL; + if ((hwrpb->rpb_type == ST_DEC_2100_A50) && (type == SYS_RES_IRQ)) - return isa_alloc_intr(bus, child, start); + rv = isa_alloc_intr(bus, child, start); else - return alpha_pci_alloc_resource(bus, child, type, rid, - start, end, count, flags); + rv = alpha_pci_alloc_resource(bus, child, type, rid, + start, end, count, flags); + if (rv != NULL) + rman_set_rid(rv, *rid); + return (rv); } static int Index: ./alpha/pci/lca_pci.c =================================================================== RCS file: /cache/ncvs/src/sys/alpha/pci/lca_pci.c,v retrieving revision 1.17 diff -u -r1.17 lca_pci.c --- ./alpha/pci/lca_pci.c 22 Aug 2003 07:20:27 -0000 1.17 +++ ./alpha/pci/lca_pci.c 19 Apr 2006 21:50:07 -0000 @@ -78,11 +78,16 @@ lca_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) { + struct resource *rv = NULL; + if (type == SYS_RES_IRQ) - return isa_alloc_intr(bus, child, start); + rv = isa_alloc_intr(bus, child, start); else - return alpha_pci_alloc_resource(bus, child, type, rid, - start, end, count, flags); + rv = alpha_pci_alloc_resource(bus, child, type, rid, + start, end, count, flags); + if (rv != NULL) + rman_set_rid(rv, *rid); + return (rv); } static int Index: ./alpha/pci/pcibus.c =================================================================== RCS file: /cache/ncvs/src/sys/alpha/pci/pcibus.c,v retrieving revision 1.37 diff -u -r1.37 pcibus.c --- ./alpha/pci/pcibus.c 25 Sep 2005 20:12:29 -0000 1.37 +++ ./alpha/pci/pcibus.c 19 Apr 2006 21:46:36 -0000 @@ -96,7 +96,12 @@ alpha_platform_alloc_ide_intr(int chan) { int irqs[2] = { 14, 15 }; - return isa_alloc_intr(0, 0, irqs[chan]); + struct resource *rv; + + rv = isa_alloc_intr(0, 0, irqs[chan]); + if (rv != NULL) + rman_set_rid(rv, *rid); + return (rv); } int @@ -230,9 +235,11 @@ #ifdef DEV_ISA if((start >= ISA_IRQ_OFFSET) && (end < ISA_IRQ_OFFSET + ISA_IRQ_LEN)) { - return isa_alloc_intrs(bus, child, - start - ISA_IRQ_OFFSET, - end - ISA_IRQ_OFFSET); + rv = isa_alloc_intrs(bus, child, + start - ISA_IRQ_OFFSET, end - ISA_IRQ_OFFSET); + if (rv != NULL) + rman_set_rid(rv, *rid); + return (rv); } else #endif @@ -252,6 +259,7 @@ if (rv == 0) return 0; + rman_set_rid(rv, *rid); rstart = rman_get_start(rv); rman_set_bustag(rv, ALPHAPCI_GET_BUSTAG(bus, type)); rman_set_bushandle(rv, rstart); Index: ./amd64/amd64/nexus.c =================================================================== RCS file: /cache/ncvs/src/sys/amd64/amd64/nexus.c,v retrieving revision 1.67 diff -u -r1.67 nexus.c --- ./amd64/amd64/nexus.c 25 Sep 2005 20:03:41 -0000 1.67 +++ ./amd64/amd64/nexus.c 19 Apr 2006 21:39:26 -0000 @@ -340,7 +340,7 @@ rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == 0) return 0; - + rman_set_rid(rv, *rid); if (type == SYS_RES_MEMORY) { rman_set_bustag(rv, AMD64_BUS_SPACE_MEM); } else if (type == SYS_RES_IOPORT) { Index: ./arm/arm/nexus.c =================================================================== RCS file: /cache/ncvs/src/sys/arm/arm/nexus.c,v retrieving revision 1.6 diff -u -r1.6 nexus.c --- ./arm/arm/nexus.c 25 Sep 2005 21:06:49 -0000 1.6 +++ ./arm/arm/nexus.c 19 Apr 2006 21:41:48 -0000 @@ -214,6 +214,7 @@ if (rv == 0) return 0; + rman_set_rid(rv, *rid); rman_set_bustag(rv, (void*)ARM_BUS_SPACE_MEM); rman_set_bushandle(rv, rman_get_start(rv)); Index: ./arm/at91/at91.c =================================================================== RCS file: /cache/ncvs/src/sys/arm/at91/at91.c,v retrieving revision 1.4 diff -u -r1.4 at91.c --- ./arm/at91/at91.c 6 Apr 2006 04:32:29 -0000 1.4 +++ ./arm/at91/at91.c 19 Apr 2006 21:40:04 -0000 @@ -497,6 +497,7 @@ rle->start = rman_get_start(rle->res); rle->end = rman_get_end(rle->res); rle->count = count; + rman_set_rid(rle->res, *rid); } return (rle->res); } Index: ./arm/sa11x0/sa11x0.c =================================================================== RCS file: /cache/ncvs/src/sys/arm/sa11x0/sa11x0.c,v retrieving revision 1.5 diff -u -r1.5 sa11x0.c --- ./arm/sa11x0/sa11x0.c 25 Sep 2005 21:06:50 -0000 1.5 +++ ./arm/sa11x0/sa11x0.c 19 Apr 2006 21:41:40 -0000 @@ -127,6 +127,8 @@ res = rman_reserve_resource(&sa11x0_softc->sa11x0_rman, *rid, *rid, count, flags, child); + if (res != NULL) + rman_set_rid(res, *rid); return (res); } Index: ./arm/xscale/i80321/i80321_pci.c =================================================================== RCS file: /cache/ncvs/src/sys/arm/xscale/i80321/i80321_pci.c,v retrieving revision 1.7 diff -u -r1.7 i80321_pci.c --- ./arm/xscale/i80321/i80321_pci.c 13 Apr 2006 15:07:59 -0000 1.7 +++ ./arm/xscale/i80321/i80321_pci.c 19 Apr 2006 21:41:16 -0000 @@ -380,6 +380,7 @@ rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) return (NULL); + rman_set_rid(rv, *rid); if (type != SYS_RES_IRQ) { if (type == SYS_RES_MEMORY) bh += (rman_get_start(rv)); Index: ./arm/xscale/i80321/iq80321.c =================================================================== RCS file: /cache/ncvs/src/sys/arm/xscale/i80321/iq80321.c,v retrieving revision 1.10 diff -u -r1.10 iq80321.c --- ./arm/xscale/i80321/iq80321.c 3 Oct 2005 14:19:55 -0000 1.10 +++ ./arm/xscale/i80321/iq80321.c 19 Apr 2006 21:41:06 -0000 @@ -300,10 +300,14 @@ u_long start, u_long end, u_long count, u_int flags) { struct i80321_softc *sc = device_get_softc(dev); - - if (type == SYS_RES_IRQ) - return (rman_reserve_resource(&sc->sc_irq_rman, - start, end, count, flags, child)); + struct resource *rv; + + if (type == SYS_RES_IRQ) { + rv = rman_reserve_resource(&sc->sc_irq_rman, + start, end, count, flags, child); + if (rv != NULL) + rman_set_rid(rv, *rid); + } return (NULL); } Index: ./arm/xscale/i80321/obio.c =================================================================== RCS file: /cache/ncvs/src/sys/arm/xscale/i80321/obio.c,v retrieving revision 1.3 diff -u -r1.3 obio.c --- ./arm/xscale/i80321/obio.c 25 Sep 2005 21:06:50 -0000 1.3 +++ ./arm/xscale/i80321/obio.c 19 Apr 2006 21:40:15 -0000 @@ -124,6 +124,7 @@ return (NULL); if (type == SYS_RES_IRQ) return (rv); + rman_set_rid(rv, *rid); rman_set_bustag(rv, bt); rman_set_bushandle(rv, bh); Index: ./dev/acpica/acpi.c =================================================================== RCS file: /cache/ncvs/src/sys/dev/acpica/acpi.c,v retrieving revision 1.221 diff -u -r1.221 acpi.c --- ./dev/acpica/acpi.c 15 Apr 2006 12:31:32 -0000 1.221 +++ ./dev/acpica/acpi.c 19 Apr 2006 21:39:48 -0000 @@ -1015,6 +1015,7 @@ goto out; /* Copy the bus tag and handle from the pre-allocated resource. */ + rman_set_rid(res, *rid); rman_set_bustag(res, rman_get_bustag(rle->res)); rman_set_bushandle(res, rman_get_start(res)); Index: ./i386/i386/nexus.c =================================================================== RCS file: /cache/ncvs/src/sys/i386/i386/nexus.c,v retrieving revision 1.62 diff -u -r1.62 nexus.c --- ./i386/i386/nexus.c 10 May 2005 12:02:15 -0000 1.62 +++ ./i386/i386/nexus.c 19 Apr 2006 21:39:35 -0000 @@ -145,6 +145,10 @@ nexus_probe(device_t dev) { int irq, last; +#if 0 + struct vm86frame vmf; + struct vm86context vmc; +#endif device_quiet(dev); /* suppress attach message for neatness */ @@ -230,6 +234,69 @@ || rman_manage_region(&mem_rman, 0, ~0)) panic("nexus_probe mem_rman"); +#if 0 + /* + */ + /* + * get memory map with INT 15:E820 + */ + vmc.npages = 0; + kva = (vm_offset_t)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + smap = (void *)vm86_addpage(&vmc, 1, kva); + vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); + + physmap_idx = 0; + vmf.vmf_ebx = 0; + do { + vmf.vmf_eax = 0xE820; + vmf.vmf_edx = SMAP_SIG; + vmf.vmf_ecx = sizeof(struct bios_smap); + i = vm86_datacall(0x15, &vmf, &vmc); + if (i || vmf.vmf_eax != SMAP_SIG) + break; + if (boothowto & RB_VERBOSE) + printf("SMAP type=%02x base=%016llx len=%016llx\n", + smap->type, smap->base, smap->length); + + if (smap->type != 0x01) + goto next_run; + + if (smap->length == 0) + goto next_run; + +#ifndef PAE + if (smap->base >= 0xffffffff) { + printf("%uK of memory above 4GB ignored\n", + (u_int)(smap->length / 1024)); + goto next_run; + } +#endif + + for (i = 0; i <= physmap_idx; i += 2) { + if (smap->base < physmap[i + 1]) { + if (boothowto & RB_VERBOSE) + printf( + "Overlapping or non-montonic memory region, ignoring second region\n"); + goto next_run; + } + } + + if (smap->base == physmap[physmap_idx + 1]) { + physmap[physmap_idx + 1] += smap->length; + goto next_run; + } + + physmap_idx += 2; + if (physmap_idx == PHYSMAP_SIZE) { + printf( + "Too many segments in the physical address map, giving up\n"); + break; + } + physmap[physmap_idx] = smap->base; + physmap[physmap_idx + 1] = smap->base + smap->length; +next_run: ; + } while (vmf.vmf_ebx != 0); +#endif return 0; } @@ -352,7 +419,7 @@ rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == 0) return 0; - + rman_set_rid(rv, *rid); if (type == SYS_RES_MEMORY) { rman_set_bustag(rv, I386_BUS_SPACE_MEM); } else if (type == SYS_RES_IOPORT) { Index: ./ia64/ia64/nexus.c =================================================================== RCS file: /cache/ncvs/src/sys/ia64/ia64/nexus.c,v retrieving revision 1.12 diff -u -r1.12 nexus.c --- ./ia64/ia64/nexus.c 6 Oct 2005 17:39:18 -0000 1.12 +++ ./ia64/ia64/nexus.c 19 Apr 2006 21:36:49 -0000 @@ -401,6 +401,7 @@ if (rv == 0) return 0; + rman_set_rid(rv, *rid); if (type == SYS_RES_MEMORY) { rman_set_bustag(rv, IA64_BUS_SPACE_MEM); } else if (type == SYS_RES_IOPORT) { Index: ./powerpc/powermac/grackle.c =================================================================== RCS file: /cache/ncvs/src/sys/powerpc/powermac/grackle.c,v retrieving revision 1.7 diff -u -r1.7 grackle.c --- ./powerpc/powermac/grackle.c 7 Jan 2005 02:29:20 -0000 1.7 +++ ./powerpc/powermac/grackle.c 19 Apr 2006 21:39:11 -0000 @@ -398,6 +398,7 @@ return (NULL); } + rman_set_rid(rv, *rid); rman_set_bustag(rv, bt); rman_set_bushandle(rv, rman_get_start(rv)); Index: ./powerpc/powermac/hrowpic.c =================================================================== RCS file: /cache/ncvs/src/sys/powerpc/powermac/hrowpic.c,v retrieving revision 1.10 diff -u -r1.10 hrowpic.c --- ./powerpc/powermac/hrowpic.c 7 Jan 2005 02:29:20 -0000 1.10 +++ ./powerpc/powermac/hrowpic.c 19 Apr 2006 21:38:53 -0000 @@ -214,6 +214,7 @@ device_get_nameunit(child)); return (NULL); } + rman_set_rid(rv, *rid); return (rv); } Index: ./powerpc/powermac/macio.c =================================================================== RCS file: /cache/ncvs/src/sys/powerpc/powermac/macio.c,v retrieving revision 1.19 diff -u -r1.19 macio.c --- ./powerpc/powermac/macio.c 3 Dec 2005 11:59:26 -0000 1.19 +++ ./powerpc/powermac/macio.c 19 Apr 2006 21:38:41 -0000 @@ -448,6 +448,7 @@ return (NULL); } + rman_set_rid(rv, *rid); rman_set_bustag(rv, tagval); rman_set_bushandle(rv, rman_get_start(rv)); Index: ./powerpc/powermac/uninorth.c =================================================================== RCS file: /cache/ncvs/src/sys/powerpc/powermac/uninorth.c,v retrieving revision 1.13 diff -u -r1.13 uninorth.c --- ./powerpc/powermac/uninorth.c 29 May 2005 08:51:21 -0000 1.13 +++ ./powerpc/powermac/uninorth.c 19 Apr 2006 21:38:34 -0000 @@ -384,6 +384,7 @@ return (NULL); } + rman_set_rid(rv, *rid); rman_set_bustag(rv, bt); rman_set_bushandle(rv, rman_get_start(rv)); Index: ./powerpc/powerpc/openpic.c =================================================================== RCS file: /cache/ncvs/src/sys/powerpc/powerpc/openpic.c,v retrieving revision 1.13 diff -u -r1.13 openpic.c --- ./powerpc/powerpc/openpic.c 7 Jan 2005 02:29:20 -0000 1.13 +++ ./powerpc/powerpc/openpic.c 19 Apr 2006 21:38:21 -0000 @@ -212,7 +212,7 @@ device_get_nameunit(child)); return (NULL); } - + rman_set_rid(rv, *rid); if (needactivate) { if (bus_activate_resource(child, SYS_RES_IRQ, *rid, rv) != 0) { device_printf(dev, Index: ./powerpc/psim/iobus.c =================================================================== RCS file: /cache/ncvs/src/sys/powerpc/psim/iobus.c,v retrieving revision 1.8 diff -u -r1.8 iobus.c --- ./powerpc/psim/iobus.c 7 Jan 2005 02:29:21 -0000 1.8 +++ ./powerpc/psim/iobus.c 19 Apr 2006 21:38:28 -0000 @@ -341,6 +341,7 @@ return (NULL); } + rman_set_rid(rv, *rid); rman_set_bustag(rv, tagval); rman_set_bushandle(rv, rman_get_start(rv)); Index: ./sparc64/ebus/ebus.c =================================================================== RCS file: /cache/ncvs/src/sys/sparc64/ebus/ebus.c,v retrieving revision 1.25 diff -u -r1.25 ebus.c --- ./sparc64/ebus/ebus.c 26 Jan 2006 21:14:31 -0000 1.25 +++ ./sparc64/ebus/ebus.c 19 Apr 2006 21:38:09 -0000 @@ -321,6 +321,7 @@ flags, child); if (res == NULL) return (NULL); + rman_set_rid(res, *rid); bt = rman_get_bustag(ri->eri_res); rman_set_bustag(res, bt); rv = bus_space_subregion(bt, rman_get_bushandle(ri->eri_res), Index: ./sparc64/pci/psycho.c =================================================================== RCS file: /cache/ncvs/src/sys/sparc64/pci/psycho.c,v retrieving revision 1.59 diff -u -r1.59 psycho.c --- ./sparc64/pci/psycho.c 26 Jan 2006 21:14:31 -0000 1.59 +++ ./sparc64/pci/psycho.c 19 Apr 2006 21:37:44 -0000 @@ -1057,7 +1057,7 @@ rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) return (NULL); - + rman_set_rid(rv, *rid); bh += rman_get_start(rv); rman_set_bustag(rv, bt); rman_set_bushandle(rv, bh); Index: ./sparc64/sbus/sbus.c =================================================================== RCS file: /cache/ncvs/src/sys/sparc64/sbus/sbus.c,v retrieving revision 1.37 diff -u -r1.37 sbus.c --- ./sparc64/sbus/sbus.c 26 Jan 2006 21:14:32 -0000 1.37 +++ ./sparc64/sbus/sbus.c 19 Apr 2006 21:37:32 -0000 @@ -805,6 +805,7 @@ child); if (rv == NULL) return (NULL); + rman_set_rid(rv, *rid); rman_set_bustag(rv, sc->sc_cbustag); rman_set_bushandle(rv, bh + rman_get_start(rv)); if (needactivate) { Index: ./sparc64/sparc64/nexus.c =================================================================== RCS file: /cache/ncvs/src/sys/sparc64/sparc64/nexus.c,v retrieving revision 1.17 diff -u -r1.17 nexus.c --- ./sparc64/sparc64/nexus.c 21 May 2005 20:19:27 -0000 1.17 +++ ./sparc64/sparc64/nexus.c 19 Apr 2006 21:37:21 -0000 @@ -367,6 +367,7 @@ rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) return (NULL); + rman_set_rid(rv, *rid); if (type == SYS_RES_MEMORY) { rman_set_bustag(rv, &nexus_bustag); rman_set_bushandle(rv, rman_get_start(rv));