From b47b327582fa55b3c19174b14c0a078333b3e0f0 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 4 Oct 2011 16:15:27 +0800 Subject: [PATCH] resource: Per-CPU hardware resources support, step 3 of many - Add cpuid parameter to bus_set_resource() and bus_set_resource DEVMETHOD; Pass this parameter to resource_list_add() - Obtain interrupt resource's owner CPU, i.e. target CPU, from MachIntrABI and pass it to bus_set_resource(), so that the owner CPU of the interrupt resource could be correctly setup - Rest of types of resources, e.g. IOPORT, MEMORY and DRQ, are shared across CPUs, so their cpuids are set to -1 --- sys/bus/isa/i386/isa_compat.c | 37 +++++++++++++------------ sys/bus/isa/isa_common.c | 14 ++++++---- sys/bus/isa/isahint.c | 13 +++++---- sys/bus/isa/vga_isa.c | 4 +-- sys/bus/pccard/pccard.c | 7 +++-- sys/dev/acpica5/Osd/OsdInterrupt.c | 4 ++- sys/dev/acpica5/acpi.c | 2 +- sys/dev/acpica5/acpi_ec.c | 4 +-- sys/dev/acpica5/acpi_hpet.c | 2 +- sys/dev/acpica5/acpi_resource.c | 15 ++++++---- sys/dev/acpica5/acpi_timer.c | 2 +- sys/dev/disk/advansys/adv_isa.c | 18 +++++++----- sys/dev/disk/aic/aic_isa.c | 13 ++++++--- sys/dev/disk/ata/ata-card.c | 4 +-- sys/dev/disk/ata/ata-isa.c | 2 +- sys/dev/disk/ata/ata-pci.c | 4 ++- sys/dev/disk/buslogic/bt_isa.c | 6 ++-- sys/dev/disk/fd/fd.c | 3 +- sys/dev/disk/nata/ata-chipset.c | 4 ++- sys/dev/disk/nata/ata-isa.c | 2 +- sys/dev/misc/atkbdc_layer/atkbdc_isa.c | 2 +- sys/dev/misc/orm/orm.c | 4 +-- sys/dev/misc/ppc/ppc.c | 2 +- sys/dev/misc/psm/psm.c | 10 +++++-- sys/dev/netif/ar/if_ar_isa.c | 3 +- sys/dev/netif/cs/if_cs.c | 6 ++-- sys/dev/netif/ed/if_ed.c | 15 +++++++--- sys/dev/netif/ep/if_ep_isa.c | 6 ++-- sys/dev/netif/ex/if_ex_isa.c | 9 ++++-- sys/dev/netif/fe/if_fe_isa.c | 9 ++++-- sys/dev/powermng/amdpm/amdpm.c | 4 +-- sys/dev/powermng/aps/aps.c | 2 +- sys/dev/powermng/intpm/intpm.c | 7 +++-- sys/dev/powermng/uguru/uguru.c | 2 +- sys/dev/powermng/viapm/viapm.c | 4 +-- sys/dev/powermng/wbsio/wbsio.c | 4 +-- sys/dev/serial/digi/digi_isa.c | 4 +-- sys/dev/sound/isa/gusc.c | 4 +-- sys/dev/sound/isa/mss.c | 14 ++++++---- sys/dev/sound/isa/sbc.c | 2 +- sys/dev/sound/pci/vibes.c | 6 ++-- sys/kern/bus_if.m | 1 + sys/kern/subr_bus.c | 13 +++++---- sys/net/i4b/layer1/isic/i4b_avm_a1.c | 2 +- sys/net/i4b/layer1/isic/i4b_ctx_s0P.c | 10 +++---- sys/net/i4b/layer1/isic/i4b_tel_s0163.c | 8 +++--- sys/net/i4b/layer1/isic/i4b_usr_sti.c | 8 +++--- sys/platform/pc32/i386/nexus.c | 9 ++++-- sys/platform/pc64/x86_64/nexus.c | 9 ++++-- sys/sys/bus.h | 8 +++--- 50 files changed, 208 insertions(+), 139 deletions(-) diff --git a/sys/bus/isa/i386/isa_compat.c b/sys/bus/isa/i386/isa_compat.c index 1e632436ef..9b769e5b1a 100644 --- a/sys/bus/isa/i386/isa_compat.c +++ b/sys/bus/isa/i386/isa_compat.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -209,28 +210,30 @@ isa_compat_probe(device_t dev) portsize = dvp->id_driver->probe(dvp); isa_compat_release_resources(dev, &res); if (portsize != 0) { - if (portsize > 0 || dvp->id_iobase != old.id_iobase) - bus_set_resource(dev, SYS_RES_IOPORT, - 0, dvp->id_iobase, portsize); - if (dvp->id_irq != old.id_irq) - bus_set_resource(dev, SYS_RES_IRQ, 0, - ffs(dvp->id_irq) - 1, 1); - if (dvp->id_drq != old.id_drq) + if (portsize > 0 || dvp->id_iobase != old.id_iobase) { + bus_set_resource(dev, SYS_RES_IOPORT, 0, + dvp->id_iobase, portsize, -1); + } + if (dvp->id_irq != old.id_irq) { + int intr = ffs(dvp->id_irq) - 1; + + bus_set_resource(dev, SYS_RES_IRQ, 0, intr, 1, + machintr_intr_cpuid(intr)); + } + if (dvp->id_drq != old.id_drq) { bus_set_resource(dev, SYS_RES_DRQ, 0, - dvp->id_drq, 1); + dvp->id_drq, 1, -1); + } if (dvp->id_maddr != old.id_maddr || dvp->id_msize != old.id_msize) { maddr = dvp->id_maddr; - if (maddr != NULL) - bus_set_resource(dev, - SYS_RES_MEMORY, - 0, - kvtop(maddr), - dvp->id_msize); - else + if (maddr != NULL) { + bus_set_resource(dev, SYS_RES_MEMORY, 0, + kvtop(maddr), dvp->id_msize, -1); + } else { bus_delete_resource(dev, - SYS_RES_MEMORY, - 0); + SYS_RES_MEMORY, 0); + } } return 0; } diff --git a/sys/bus/isa/isa_common.c b/sys/bus/isa/isa_common.c index 521636302d..5944d35265 100644 --- a/sys/bus/isa/isa_common.c +++ b/sys/bus/isa/isa_common.c @@ -66,6 +66,7 @@ #include #include #include +#include #include "isavar.h" #include "isa_common.h" @@ -134,7 +135,7 @@ isa_find_memory(device_t child, start + size - 1 <= end; start += MAX(align, 1)) { bus_set_resource(child, SYS_RES_MEMORY, i, - start, size); + start, size, -1); res[i] = bus_alloc_resource(child, SYS_RES_MEMORY, &i, 0, ~0, 1, 0 /* !RF_ACTIVE */); @@ -198,7 +199,7 @@ isa_find_port(device_t child, start + size - 1 <= end; start += align) { bus_set_resource(child, SYS_RES_IOPORT, i, - start, size); + start, size, -1); res[i] = bus_alloc_resource(child, SYS_RES_IOPORT, &i, 0, ~0, 1, 0 /* !RF_ACTIVE */); @@ -283,7 +284,7 @@ isa_find_irq(device_t child, irq != -1; irq = find_next_bit(mask, irq)) { bus_set_resource(child, SYS_RES_IRQ, i, - irq, 1); + irq, 1, machintr_intr_cpuid(irq)); res[i] = bus_alloc_resource(child, SYS_RES_IRQ, &i, 0, ~0, 1, 0 /* !RF_ACTIVE */ ); @@ -342,7 +343,7 @@ isa_find_drq(device_t child, drq != -1; drq = find_next_bit(mask, drq)) { bus_set_resource(child, SYS_RES_DRQ, i, - drq, 1); + drq, 1, -1); res[i] = bus_alloc_resource(child, SYS_RES_DRQ, &i, 0, ~0, 1, 0 /* !RF_ACTIVE */); @@ -882,7 +883,7 @@ isa_driver_added(device_t dev, driver_t *driver) static int isa_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + u_long start, u_long count, int cpuid) { struct isa_device* idev = DEVTOISA(child); struct resource_list *rl = &idev->id_resources; @@ -901,7 +902,8 @@ isa_set_resource(device_t dev, device_t child, int type, int rid, if (type == SYS_RES_DRQ && rid >= ISA_NDRQ) return EINVAL; - resource_list_add(rl, type, rid, start, start + count - 1, count, -1); + resource_list_add(rl, type, rid, start, start + count - 1, count, + cpuid); return 0; } diff --git a/sys/bus/isa/isahint.c b/sys/bus/isa/isahint.c index ffa3062982..71e1e77723 100644 --- a/sys/bus/isa/isahint.c +++ b/sys/bus/isa/isahint.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "isavar.h" @@ -60,20 +61,22 @@ isahint_add_device(device_t parent, const char *name, int unit) resource_int_value(name, unit, "port", &start); resource_int_value(name, unit, "portsize", &count); if (start > 0 || count > 0) - bus_set_resource(child, SYS_RES_IOPORT, 0, start, count); + bus_set_resource(child, SYS_RES_IOPORT, 0, start, count, -1); start = 0; count = 0; resource_int_value(name, unit, "maddr", &start); resource_int_value(name, unit, "msize", &count); if (start > 0 || count > 0) - bus_set_resource(child, SYS_RES_MEMORY, 0, start, count); + bus_set_resource(child, SYS_RES_MEMORY, 0, start, count, -1); - if (resource_int_value(name, unit, "irq", &start) == 0 && start > 0) - bus_set_resource(child, SYS_RES_IRQ, 0, start, 1); + if (resource_int_value(name, unit, "irq", &start) == 0 && start > 0) { + bus_set_resource(child, SYS_RES_IRQ, 0, start, 1, + machintr_intr_cpuid(start)); + } if (resource_int_value(name, unit, "drq", &start) == 0 && start >= 0) - bus_set_resource(child, SYS_RES_DRQ, 0, start, 1); + bus_set_resource(child, SYS_RES_DRQ, 0, start, 1, -1); if (resource_int_value(name, unit, "flags", &t) == 0) device_set_flags(child, t); diff --git a/sys/bus/isa/vga_isa.c b/sys/bus/isa/vga_isa.c index 1d5d079a09..cf07860574 100644 --- a/sys/bus/isa/vga_isa.c +++ b/sys/bus/isa/vga_isa.c @@ -118,9 +118,9 @@ isavga_probe(device_t dev) error = vga_probe_unit(device_get_unit(dev), &adp, device_get_flags(dev)); if (error == 0) { bus_set_resource(dev, SYS_RES_IOPORT, 0, - adp.va_io_base, adp.va_io_size); + adp.va_io_base, adp.va_io_size, -1); bus_set_resource(dev, SYS_RES_MEMORY, 0, - adp.va_mem_base, adp.va_mem_size); + adp.va_mem_base, adp.va_mem_size, -1); #if 0 isa_set_port(dev, adp.va_io_base); isa_set_portsize(dev, adp.va_io_size); diff --git a/sys/bus/pccard/pccard.c b/sys/bus/pccard/pccard.c index 3e0aabbbd1..d8da8f30e2 100644 --- a/sys/bus/pccard/pccard.c +++ b/sys/bus/pccard/pccard.c @@ -98,7 +98,7 @@ static void pccard_print_resources(struct resource_list *rl, 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, u_long start, u_long count, int cpuid); static int pccard_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp); static void pccard_delete_resource(device_t dev, device_t child, int type, @@ -883,7 +883,7 @@ 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) + u_long start, u_long count, int cpuid) { struct pccard_ivar *devi = PCCARD_IVAR(child); struct resource_list *rl = &devi->resources; @@ -902,7 +902,8 @@ pccard_set_resource(device_t dev, device_t child, int type, int rid, if (type == SYS_RES_DRQ && rid >= PCCARD_NDRQ) return (EINVAL); - resource_list_add(rl, type, rid, start, start + count - 1, count, -1); + resource_list_add(rl, type, rid, start, start + count - 1, count, + cpuid); if (NULL != resource_list_alloc(rl, device_get_parent(dev), dev, type, &rid, start, start + count - 1, count, 0, -1)) return 0; diff --git a/sys/dev/acpica5/Osd/OsdInterrupt.c b/sys/dev/acpica5/Osd/OsdInterrupt.c index 5e5e62bf91..5d3a818bbf 100644 --- a/sys/dev/acpica5/Osd/OsdInterrupt.c +++ b/sys/dev/acpica5/Osd/OsdInterrupt.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "acpi.h" #include "accommon.h" @@ -93,7 +94,8 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, /* Set up the interrupt resource. */ sc->acpi_irq_rid = 0; - bus_set_resource(sc->acpi_dev, SYS_RES_IRQ, 0, InterruptNumber, 1); + bus_set_resource(sc->acpi_dev, SYS_RES_IRQ, 0, InterruptNumber, 1, + machintr_intr_cpuid(InterruptNumber)); sc->acpi_irq = bus_alloc_resource_any(sc->acpi_dev, SYS_RES_IRQ, &sc->acpi_irq_rid, flags); if (sc->acpi_irq == NULL) { diff --git a/sys/dev/acpica5/acpi.c b/sys/dev/acpica5/acpi.c index 4aa39ccf5b..d573405baf 100644 --- a/sys/dev/acpica5/acpi.c +++ b/sys/dev/acpica5/acpi.c @@ -1193,7 +1193,7 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas, return (EINVAL); bus_set_resource(dev, res_type, *rid, gas->Address, - gas->BitWidth / 8); + gas->BitWidth / 8, -1); *res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE | flags); if (*res != NULL) { *type = res_type; diff --git a/sys/dev/acpica5/acpi_ec.c b/sys/dev/acpica5/acpi_ec.c index e06747fee6..50e3fddd4f 100644 --- a/sys/dev/acpica5/acpi_ec.c +++ b/sys/dev/acpica5/acpi_ec.c @@ -309,9 +309,9 @@ acpi_ec_ecdt_probe(device_t parent) /* Set the data and CSR register addresses. */ bus_set_resource(child, SYS_RES_IOPORT, 0, ecdt->Data.Address, - /*count*/1); + /*count*/1, -1); bus_set_resource(child, SYS_RES_IOPORT, 1, ecdt->Control.Address, - /*count*/1); + /*count*/1, -1); /* * Store values for the probe/attach routines to use. Store the diff --git a/sys/dev/acpica5/acpi_hpet.c b/sys/dev/acpica5/acpi_hpet.c index 2677a7caf5..d712351c52 100644 --- a/sys/dev/acpica5/acpi_hpet.c +++ b/sys/dev/acpica5/acpi_hpet.c @@ -163,7 +163,7 @@ acpi_hpet_identify(driver_t *driver, device_t parent) acpi_hpet_res_start = hpet->Address.Address; if (bus_set_resource(child, SYS_RES_MEMORY, 0, - hpet->Address.Address, HPET_MEM_WIDTH)) { + hpet->Address.Address, HPET_MEM_WIDTH, -1)) { device_printf(child, "could not set iomem resources: " "0x%jx, %d\n", (uintmax_t)hpet->Address.Address, HPET_MEM_WIDTH); diff --git a/sys/dev/acpica5/acpi_resource.c b/sys/dev/acpica5/acpi_resource.c index cde842ea1a..43fc5958c4 100644 --- a/sys/dev/acpica5/acpi_resource.c +++ b/sys/dev/acpica5/acpi_resource.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -545,7 +546,7 @@ acpi_res_set_ioport(device_t dev, void *context, u_int32_t base, if (cp == NULL) return; - bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, base, length); + bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, base, length, -1); } static void @@ -568,7 +569,7 @@ acpi_res_set_memory(device_t dev, void *context, u_int32_t base, if (cp == NULL) return; - bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length); + bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length, -1); } static void @@ -595,7 +596,8 @@ acpi_res_set_irq(device_t dev, void *context, u_int8_t *irq, int count, if (count != 1) return; - bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1); + bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1, + machintr_intr_cpuid(*irq)); } static void @@ -611,7 +613,8 @@ acpi_res_set_ext_irq(device_t dev, void *context, u_int32_t *irq, int count, if (count != 1) return; - bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1); + bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1, + machintr_intr_cpuid(*irq)); } static void @@ -626,7 +629,7 @@ acpi_res_set_drq(device_t dev, void *context, u_int8_t *drq, int count) if (count != 1) return; - bus_set_resource(dev, SYS_RES_DRQ, cp->ar_ndrq++, *drq, 1); + bus_set_resource(dev, SYS_RES_DRQ, cp->ar_ndrq++, *drq, 1, -1); } static void @@ -754,7 +757,7 @@ acpi_sysres_attach(device_t dev) } else bus_rle = NULL; /* If we didn't merge with anything, add this resource. */ if (bus_rle == NULL) { - bus_set_resource(bus, type, acpi_sysres_rid++, start, count); + bus_set_resource(bus, type, acpi_sysres_rid++, start, count, -1); } } diff --git a/sys/dev/acpica5/acpi_timer.c b/sys/dev/acpica5/acpi_timer.c index d63ff4ddc2..9801e1ee69 100644 --- a/sys/dev/acpica5/acpi_timer.c +++ b/sys/dev/acpica5/acpi_timer.c @@ -145,7 +145,7 @@ acpi_timer_identify(driver_t *driver, device_t parent) SYS_RES_IOPORT : SYS_RES_MEMORY; rlen = AcpiGbl_FADT.PmTimerLength; rstart = AcpiGbl_FADT.XPmTimerBlock.Address; - if (bus_set_resource(dev, rtype, rid, rstart, rlen)) { + if (bus_set_resource(dev, rtype, rid, rstart, rlen, -1)) { device_printf(dev, "couldn't set resource (%s 0x%lx+0x%lx)\n", (rtype == SYS_RES_IOPORT) ? "port" : "mem", rstart, rlen); return (ENXIO); diff --git a/sys/dev/disk/advansys/adv_isa.c b/sys/dev/disk/advansys/adv_isa.c index 5c0b683a74..8de61ba900 100644 --- a/sys/dev/disk/advansys/adv_isa.c +++ b/sys/dev/disk/advansys/adv_isa.c @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -147,7 +148,7 @@ adv_isa_probe(device_t dev) /* Already been attached */ continue; - if (bus_set_resource(dev, SYS_RES_IOPORT, 0, port_addr, 1)) + if (bus_set_resource(dev, SYS_RES_IOPORT, 0, port_addr, 1, -1)) continue; /* XXX what is the real portsize? */ @@ -204,7 +205,7 @@ adv_isa_probe(device_t dev) adv->isa_dma_speed = ADV_DEF_ISA_DMA_SPEED; adv->isa_dma_channel = adv_get_isa_dma_channel(adv); bus_set_resource(dev, SYS_RES_DRQ, 0, - adv->isa_dma_channel, 1); + adv->isa_dma_channel, 1, -1); } else { panic("advisaprobe: Unknown card revision\n"); } @@ -308,11 +309,14 @@ adv_isa_probe(device_t dev) } /* Determine our IRQ */ - if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL)) - bus_set_resource(dev, SYS_RES_IRQ, 0, - adv_get_chip_irq(adv), 1); - else + if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL)) { + int chip_irq = adv_get_chip_irq(adv); + + bus_set_resource(dev, SYS_RES_IRQ, 0, chip_irq, 1, + machintr_intr_cpuid(chip_irq)); + } else { adv_set_chip_irq(adv, irq); + } irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_ACTIVE); @@ -334,7 +338,7 @@ adv_isa_probe(device_t dev) } if (user_iobase) - bus_set_resource(dev, SYS_RES_IOPORT, 0, iobase, iocount); + bus_set_resource(dev, SYS_RES_IOPORT, 0, iobase, iocount, -1); else bus_delete_resource(dev, SYS_RES_IOPORT, 0); diff --git a/sys/dev/disk/aic/aic_isa.c b/sys/dev/disk/aic/aic_isa.c index 4d151cc000..48ea5af4f0 100644 --- a/sys/dev/disk/aic/aic_isa.c +++ b/sys/dev/disk/aic/aic_isa.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "aic6360reg.h" @@ -140,7 +141,7 @@ aic_isa_probe(device_t dev) for (i = 0; i < numports; i++) { if (bus_set_resource(dev, SYS_RES_IOPORT, 0, ports[i], - AIC_ISA_PORTSIZE)) + AIC_ISA_PORTSIZE, -1)) continue; if (aic_isa_alloc_resources(dev)) continue; @@ -155,10 +156,14 @@ aic_isa_probe(device_t dev) return (ENXIO); porta = aic_inb(aic, PORTA); - if (isa_get_irq(dev) == -1) - bus_set_resource(dev, SYS_RES_IRQ, 0, PORTA_IRQ(porta), 1); + if (isa_get_irq(dev) == -1) { + int irq = PORTA_IRQ(porta); + + bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1, + machintr_intr_cpuid(irq)); + } if ((aic->flags & AIC_DMA_ENABLE) && isa_get_drq(dev) == -1) - bus_set_resource(dev, SYS_RES_DRQ, 0, PORTA_DRQ(porta), 1); + bus_set_resource(dev, SYS_RES_DRQ, 0, PORTA_DRQ(porta), 1, -1); device_set_desc(dev, "Adaptec 6260/6360 SCSI controller"); return (0); } diff --git a/sys/dev/disk/ata/ata-card.c b/sys/dev/disk/ata/ata-card.c index c3c2f4f0c3..d9aadae1c0 100644 --- a/sys/dev/disk/ata/ata-card.c +++ b/sys/dev/disk/ata/ata-card.c @@ -109,11 +109,11 @@ ata_pccard_probe(device_t dev) if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, &tmp, &tmp)) { if (len > ATA_IOSIZE) { bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, - start + ATA_PCCARD_ALTOFFSET, ATA_ALTIOSIZE); + start + ATA_PCCARD_ALTOFFSET, ATA_ALTIOSIZE, -1); } else { bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, - start + ATA_ALTOFFSET, ATA_ALTIOSIZE); + start + ATA_ALTOFFSET, ATA_ALTIOSIZE, -1); } } else diff --git a/sys/dev/disk/ata/ata-isa.c b/sys/dev/disk/ata/ata-isa.c index 04f9622396..05781c15f6 100644 --- a/sys/dev/disk/ata/ata-isa.c +++ b/sys/dev/disk/ata/ata-isa.c @@ -76,7 +76,7 @@ ata_isa_probe(device_t dev) /* set the altport range */ if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, &tmp, &tmp)) { bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, - rman_get_start(io) + ATA_ALTOFFSET, ATA_ALTIOSIZE); + rman_get_start(io) + ATA_ALTOFFSET, ATA_ALTIOSIZE, -1); } bus_release_resource(dev, SYS_RES_IOPORT, rid, io); diff --git a/sys/dev/disk/ata/ata-pci.c b/sys/dev/disk/ata/ata-pci.c index 9f4d4b01d8..c6c101426c 100644 --- a/sys/dev/disk/ata/ata-pci.c +++ b/sys/dev/disk/ata/ata-pci.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -339,7 +340,8 @@ ata_pci_match(device_t dev) return "Promise TX4 ATA100 controller (channel 0+1)"; } else if (pci_get_slot(dev) == 2 && start && end) { - bus_set_resource(dev, SYS_RES_IRQ, 0, start, end); + bus_set_resource(dev, SYS_RES_IRQ, 0, start, end, + machintr_intr_cpuid(start)); start = end = 0; return "Promise TX4 ATA100 controller (channel 2+3)"; } diff --git a/sys/dev/disk/buslogic/bt_isa.c b/sys/dev/disk/buslogic/bt_isa.c index e6c4a85174..c23cfd1d22 100644 --- a/sys/dev/disk/buslogic/bt_isa.c +++ b/sys/dev/disk/buslogic/bt_isa.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "btreg.h" @@ -167,8 +168,9 @@ bt_isa_probe(device_t dev) bt_isa_release_resources(dev); - bus_set_resource(dev, SYS_RES_DRQ, 0, info.drq, 1); - bus_set_resource(dev, SYS_RES_IRQ, 0, info.irq, 1); + bus_set_resource(dev, SYS_RES_DRQ, 0, info.drq, 1, -1); + bus_set_resource(dev, SYS_RES_IRQ, 0, info.irq, 1, + machintr_intr_cpuid(info.irq)); return (0); } diff --git a/sys/dev/disk/fd/fd.c b/sys/dev/disk/fd/fd.c index 9fb2182e88..ec54acff31 100644 --- a/sys/dev/disk/fd/fd.c +++ b/sys/dev/disk/fd/fd.c @@ -583,7 +583,8 @@ fdc_alloc_resources(struct fdc_data *fdc) ctlstart = rman_get_start(fdc->res_ioport) + fdc->port_off + 7; - bus_set_resource(dev, SYS_RES_IOPORT, 1, ctlstart, 1); + bus_set_resource(dev, SYS_RES_IOPORT, 1, ctlstart, 1, + -1); } /* diff --git a/sys/dev/disk/nata/ata-chipset.c b/sys/dev/disk/nata/ata-chipset.c index 91d44445d1..7191ab4cd8 100644 --- a/sys/dev/disk/nata/ata-chipset.c +++ b/sys/dev/disk/nata/ata-chipset.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -3465,7 +3466,8 @@ ata_promise_ident(device_t dev) strcat(buffer, " (channel 0+1)"); } else if (pci_get_slot(dev) == 2 && start && end) { - bus_set_resource(dev, SYS_RES_IRQ, 0, start, end); + bus_set_resource(dev, SYS_RES_IRQ, 0, start, end, + machintr_intr_cpuid(start)); strcat(buffer, " (channel 2+3)"); } else { diff --git a/sys/dev/disk/nata/ata-isa.c b/sys/dev/disk/nata/ata-isa.c index 8e75ed484f..0f1a8d0bf6 100644 --- a/sys/dev/disk/nata/ata-isa.c +++ b/sys/dev/disk/nata/ata-isa.c @@ -71,7 +71,7 @@ ata_isa_probe(device_t dev) /* set the altport range */ if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tmp)) { bus_set_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, - rman_get_start(io) + ATA_CTLOFFSET, ATA_CTLIOSIZE); + rman_get_start(io) + ATA_CTLOFFSET, ATA_CTLIOSIZE, -1); } /* allocate the altport range */ diff --git a/sys/dev/misc/atkbdc_layer/atkbdc_isa.c b/sys/dev/misc/atkbdc_layer/atkbdc_isa.c index 0fedd879f5..5b42626642 100644 --- a/sys/dev/misc/atkbdc_layer/atkbdc_isa.c +++ b/sys/dev/misc/atkbdc_layer/atkbdc_isa.c @@ -128,7 +128,7 @@ atkbdc_probe(device_t dev) /* XXX */ if (bus_get_resource_start(dev, SYS_RES_IOPORT, 1) <= 0) { bus_set_resource(dev, SYS_RES_IOPORT, 1, - rman_get_start(port0) + KBD_STATUS_PORT, 1); + rman_get_start(port0) + KBD_STATUS_PORT, 1, -1); } rid = 1; port1 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, diff --git a/sys/dev/misc/orm/orm.c b/sys/dev/misc/orm/orm.c index d199a1c781..3edb44284a 100644 --- a/sys/dev/misc/orm/orm.c +++ b/sys/dev/misc/orm/orm.c @@ -103,7 +103,7 @@ orm_identify(driver_t* driver, device_t parent) sc->rnum = 0; while (chunk < IOMEM_END) { bus_set_resource(child, SYS_RES_MEMORY, sc->rnum, chunk, - IOMEM_STEP); + IOMEM_STEP, -1); rid = sc->rnum; res = bus_alloc_resource(child, SYS_RES_MEMORY, &rid, 0ul, ~0ul, IOMEM_STEP, RF_ACTIVE); @@ -135,7 +135,7 @@ orm_identify(driver_t* driver, device_t parent) } rom_size = buf[2] << 9; bus_set_resource(child, SYS_RES_MEMORY, sc->rnum, chunk, - rom_size); + rom_size, -1); rid = sc->rnum; res = bus_alloc_resource(child, SYS_RES_MEMORY, &rid, 0ul, ~0ul, rom_size, 0); diff --git a/sys/dev/misc/ppc/ppc.c b/sys/dev/misc/ppc/ppc.c index 6836a9e8d2..565840fab5 100644 --- a/sys/dev/misc/ppc/ppc.c +++ b/sys/dev/misc/ppc/ppc.c @@ -1870,7 +1870,7 @@ ppc_probe(device_t dev) return ENXIO; } bus_set_resource(dev, SYS_RES_IOPORT, 0, port, - IO_LPTSIZE_EXTENDED); + IO_LPTSIZE_EXTENDED, -1); } #endif diff --git a/sys/dev/misc/psm/psm.c b/sys/dev/misc/psm/psm.c index d577f194b7..b320fc24af 100644 --- a/sys/dev/misc/psm/psm.c +++ b/sys/dev/misc/psm/psm.c @@ -76,6 +76,7 @@ #include #include #include +#include #include #include @@ -1102,7 +1103,8 @@ psmidentify(driver_t *driver, device_t parent) irq = bus_get_resource_start(psmc, SYS_RES_IRQ, 0); if (irq <= 0) return; - bus_set_resource(psm, SYS_RES_IRQ, KBDC_RID_AUX, irq, 1); + bus_set_resource(psm, SYS_RES_IRQ, KBDC_RID_AUX, irq, 1, + machintr_intr_cpuid(irq)); } #define endprobe(v) do { \ @@ -4643,7 +4645,8 @@ create_a_copy(device_t atkbdc, device_t me) /* move our resource to the found device */ irq = bus_get_resource_start(me, SYS_RES_IRQ, 0); - bus_set_resource(psm, SYS_RES_IRQ, KBDC_RID_AUX, irq, 1); + bus_set_resource(psm, SYS_RES_IRQ, KBDC_RID_AUX, irq, 1, + machintr_intr_cpuid(irq)); /* ...then probe and attach it */ return (device_probe_and_attach(psm)); @@ -4674,7 +4677,8 @@ psmcpnp_probe(device_t dev) irq = 12; /* XXX */ device_printf(dev, "irq resource info is missing; " "assuming irq %ld\n", irq); - bus_set_resource(dev, SYS_RES_IRQ, rid, irq, 1); + bus_set_resource(dev, SYS_RES_IRQ, rid, irq, 1, + machintr_intr_cpuid(irq)); } res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE); bus_release_resource(dev, SYS_RES_IRQ, rid, res); diff --git a/sys/dev/netif/ar/if_ar_isa.c b/sys/dev/netif/ar/if_ar_isa.c index 879a5ee985..24e68f51ab 100644 --- a/sys/dev/netif/ar/if_ar_isa.c +++ b/sys/dev/netif/ar/if_ar_isa.c @@ -124,7 +124,8 @@ ar_isa_probe(device_t device) memsize = ar_inb(hc, AR_REV); memsize = 1 << ((memsize & AR_WSIZ_MSK) >> AR_WSIZ_SHFT); memsize *= ARC_WIN_SIZ; - error = bus_set_resource(device, SYS_RES_MEMORY, 0, membase, memsize); + error = bus_set_resource(device, SYS_RES_MEMORY, 0, membase, memsize, + -1); ar_deallocate_resources(device); return (error); diff --git a/sys/dev/netif/cs/if_cs.c b/sys/dev/netif/cs/if_cs.c index dd6029cf2d..1de4a5a6c4 100644 --- a/sys/dev/netif/cs/if_cs.c +++ b/sys/dev/netif/cs/if_cs.c @@ -51,6 +51,7 @@ #include #include #include +#include #include @@ -425,9 +426,10 @@ cs_cs89x0_probe(device_t dev) } } - if (!error) + if (!error) { bus_set_resource(dev, SYS_RES_IRQ, 0, - irq, 1); + irq, 1, machintr_intr_cpuid(irq)); + } } } } diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c index 9064640958..9be8fbabbe 100644 --- a/sys/dev/netif/ed/if_ed.c +++ b/sys/dev/netif/ed/if_ed.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -415,8 +416,10 @@ ed_probe_WD80x3_generic(device_t dev, int flags, u_short *intr_vals[]) error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk); if (error && intr_vals[0] != NULL) { + int intr_val = intr_vals[0][iptr]; + error = bus_set_resource(dev, SYS_RES_IRQ, 0, - intr_vals[0][iptr], 1); + intr_val, 1, machintr_intr_cpuid(intr_val)); } if (error) return (error); @@ -442,8 +445,10 @@ ed_probe_WD80x3_generic(device_t dev, int flags, u_short *intr_vals[]) error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk); if (error && intr_vals[1] != NULL) { + int intr_val = intr_vals[1][iptr]; + error = bus_set_resource(dev, SYS_RES_IRQ, 0, - intr_vals[1][iptr], 1); + intr_val, 1, machintr_intr_cpuid(intr_val)); } if (error) return (error); @@ -1372,8 +1377,10 @@ ed_probe_HP_pclanp(device_t dev, int port_rid, int flags) error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); if (error) { - bus_set_resource(dev, SYS_RES_IRQ, 0, - ed_hpp_intr_val[irq], 1); + int intr_val = ed_hpp_intr_val[irq]; + + bus_set_resource(dev, SYS_RES_IRQ, 0, intr_val, 1, + machintr_intr_cpuid(intr_val)); } else { if (conf_irq != ed_hpp_intr_val[irq]) return (ENXIO); diff --git a/sys/dev/netif/ep/if_ep_isa.c b/sys/dev/netif/ep/if_ep_isa.c index 1eb8b375aa..8bba0e8eb0 100644 --- a/sys/dev/netif/ep/if_ep_isa.c +++ b/sys/dev/netif/ep/if_ep_isa.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -258,8 +259,9 @@ ep_isa_identify(driver_t *driver, device_t parent) ISA_ORDER_SPECULATIVE, "ep", -1); device_set_desc_copy(child, desc); device_set_driver(child, driver); - bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1); - bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE); + bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1, + machintr_intr_cpuid(irq)); + bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE, -1); if (bootverbose) { device_printf(parent, "if_ep: <%s> at port 0x%03x-0x%03x irq %d\n", diff --git a/sys/dev/netif/ex/if_ex_isa.c b/sys/dev/netif/ex/if_ex_isa.c index 5438559d22..8bc5c80808 100644 --- a/sys/dev/netif/ex/if_ex_isa.c +++ b/sys/dev/netif/ex/if_ex_isa.c @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -147,8 +148,9 @@ ex_isa_identify (driver_t *driver, device_t parent) ISA_ORDER_SPECULATIVE, "ex", -1); device_set_desc_copy(child, desc); device_set_driver(child, driver); - bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1); - bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EX_IOSIZE); + bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1, + machintr_intr_cpuid(irq)); + bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EX_IOSIZE, -1); ++count; if (bootverbose) @@ -220,7 +222,8 @@ ex_isa_probe(device_t dev) } } else { irq = ee2irq[tmp]; - bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); + bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1, + machintr_intr_cpuid(irq)); } if (irq == 0) { diff --git a/sys/dev/netif/fe/if_fe_isa.c b/sys/dev/netif/fe/if_fe_isa.c index 1f4dba85b5..8615bbca78 100644 --- a/sys/dev/netif/fe/if_fe_isa.c +++ b/sys/dev/netif/fe/if_fe_isa.c @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -303,8 +304,11 @@ fe_probe_fmv(device_t dev) irq = 0; bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); if (irq == NO_IRQ) { + int intr = irqmap[n]; + /* Just use the probed value. */ - bus_set_resource(dev, SYS_RES_IRQ, 0, irqmap[n], 1); + bus_set_resource(dev, SYS_RES_IRQ, 0, intr, 1, + machintr_intr_cpuid(intr)); } else if (irq != irqmap[n]) { /* Don't match. */ sc->stability |= UNSTABLE_IRQ; @@ -784,7 +788,8 @@ fe_probe_jli(device_t dev) return ENXIO; } else if (error && xirq != NO_IRQ) { /* Just use the probed IRQ value. */ - bus_set_resource(dev, SYS_RES_IRQ, 0, xirq, 1); + bus_set_resource(dev, SYS_RES_IRQ, 0, xirq, 1, + machintr_intr_cpuid(xirq)); } else if (!error && xirq == NO_IRQ) { /* No problem. Go ahead. */ } else if (irq == xirq) { diff --git a/sys/dev/powermng/amdpm/amdpm.c b/sys/dev/powermng/amdpm/amdpm.c index a38f3be2ac..29c96aeb67 100644 --- a/sys/dev/powermng/amdpm/amdpm.c +++ b/sys/dev/powermng/amdpm/amdpm.c @@ -162,7 +162,7 @@ amdpm_probe(device_t dev) base = pci_read_config(dev, AMDPCI_PMBASE, 4); base &= 0xff00; bus_set_resource(dev, SYS_RES_IOPORT, AMDPCI_PMBASE, - base+0xe0, 32); + base+0xe0, 32, -1); return (BUS_PROBE_DEFAULT); } @@ -177,7 +177,7 @@ amdpm_probe(device_t dev) base = pci_read_config(dev, NFPCI_PMBASE, 4); base &= 0xff00; bus_set_resource(dev, SYS_RES_IOPORT, NFPCI_PMBASE, - base, 32); + base, 32, -1); return (BUS_PROBE_DEFAULT); } diff --git a/sys/dev/powermng/aps/aps.c b/sys/dev/powermng/aps/aps.c index 2bb4fbdad0..0a7fce7f15 100644 --- a/sys/dev/powermng/aps/aps.c +++ b/sys/dev/powermng/aps/aps.c @@ -282,7 +282,7 @@ aps_identify(driver_t *driver, struct device *parent) } } if (bus_set_resource(child, SYS_RES_IOPORT, 0, - APS_ADDR_BASE, APS_ADDR_SIZE)) + APS_ADDR_BASE, APS_ADDR_SIZE, -1)) kprintf("%s: cannot set resource\n", __func__); } diff --git a/sys/dev/powermng/intpm/intpm.c b/sys/dev/powermng/intpm/intpm.c index f6eec44765..a2d5f859a3 100644 --- a/sys/dev/powermng/intpm/intpm.c +++ b/sys/dev/powermng/intpm/intpm.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "smbus_if.h" @@ -183,8 +184,10 @@ intsmb_attach(device_t dev) /* Force IRQ 9. */ rid = 0; - if (sc->cfg_irq9) - bus_set_resource(dev, SYS_RES_IRQ, rid, 9, 1); + if (sc->cfg_irq9) { + bus_set_resource(dev, SYS_RES_IRQ, rid, 9, 1, + machintr_intr_cpuid(9)); + } sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); diff --git a/sys/dev/powermng/uguru/uguru.c b/sys/dev/powermng/uguru/uguru.c index 434dec9d14..7cf7be0401 100644 --- a/sys/dev/powermng/uguru/uguru.c +++ b/sys/dev/powermng/uguru/uguru.c @@ -681,7 +681,7 @@ uguru_identify(driver_t *driver, struct device *parent) if (child == NULL) child = BUS_ADD_CHILD(parent, parent, ISA_ORDER_PNP, driver->name, 0); - if (bus_set_resource(child, SYS_RES_IOPORT, 0, port, UGURU_IOSIZE)) + if (bus_set_resource(child, SYS_RES_IOPORT, 0, port, UGURU_IOSIZE, -1)) kprintf("%s: cannot set resource for child\n", __func__); #endif } diff --git a/sys/dev/powermng/viapm/viapm.c b/sys/dev/powermng/viapm/viapm.c index 3c5c72e653..b673d8b1ff 100644 --- a/sys/dev/powermng/viapm/viapm.c +++ b/sys/dev/powermng/viapm/viapm.c @@ -216,7 +216,7 @@ viapm_586b_probe(device_t dev) * described outside the viapmope of the traditional maps */ if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid, - viapm->base, 256)) { + viapm->base, 256, -1)) { device_printf(dev, "could not set bus resource\n"); return ENXIO; } @@ -295,7 +295,7 @@ viapm_pro_probe(device_t dev) */ viapm->iorid = base_cfgreg; if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid, - viapm->base, 16)) { + viapm->base, 16, -1)) { device_printf(dev, "could not set bus resource 0x%x\n", viapm->base); return ENXIO; diff --git a/sys/dev/powermng/wbsio/wbsio.c b/sys/dev/powermng/wbsio/wbsio.c index 8d8dca3ebc..bbc2ffeb40 100644 --- a/sys/dev/powermng/wbsio/wbsio.c +++ b/sys/dev/powermng/wbsio/wbsio.c @@ -146,7 +146,7 @@ wbsio_identify(driver_t *driver, struct device *parent) } else continue; if (bus_set_resource(child[i], SYS_RES_IOPORT, 0, - port[i], WBSIO_IOSIZE)) + port[i], WBSIO_IOSIZE, -1)) kprintf("%s: cannot set resource for child[%i]\n", __func__, i); } @@ -319,7 +319,7 @@ wbsio_attach(struct device *dev) device_printf(dev, "cannot add child\n"); return ENXIO; } - if (bus_set_resource(child, SYS_RES_IOPORT, 0, iobase, 8)) { + if (bus_set_resource(child, SYS_RES_IOPORT, 0, iobase, 8, -1)) { device_printf(dev, "cannot set resource\n"); return ENXIO; } diff --git a/sys/dev/serial/digi/digi_isa.c b/sys/dev/serial/digi/digi_isa.c index 60db66b660..85a7596cf7 100644 --- a/sys/dev/serial/digi/digi_isa.c +++ b/sys/dev/serial/digi/digi_isa.c @@ -303,8 +303,8 @@ digi_isa_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, sc->res.io); /* Let digi_isa_attach() know what we've found */ - bus_set_resource(dev, SYS_RES_IOPORT, 0, sc->port, IO_SIZE); - bus_set_resource(dev, SYS_RES_MEMORY, 0, sc->pmem, sc->win_size); + bus_set_resource(dev, SYS_RES_IOPORT, 0, sc->port, IO_SIZE, -1); + bus_set_resource(dev, SYS_RES_MEMORY, 0, sc->pmem, sc->win_size, -1); DLOG(DIGIDB_INIT, (sc->dev, "Probe returns -10\n")); diff --git a/sys/dev/sound/isa/gusc.c b/sys/dev/sound/isa/gusc.c index 6f5928e4de..e46d630e3b 100644 --- a/sys/dev/sound/isa/gusc.c +++ b/sys/dev/sound/isa/gusc.c @@ -256,11 +256,11 @@ gusisa_probe(device_t dev) /* Looks like a GUS MAX. Set the rest of the resources. */ - bus_set_resource(dev, SYS_RES_IOPORT, 2, base + 0x10c, 8); + bus_set_resource(dev, SYS_RES_IOPORT, 2, base + 0x10c, 8, -1); if (flags & DV_F_DUAL_DMA) bus_set_resource(dev, SYS_RES_DRQ, 1, - flags & DV_F_DRQ_MASK, 1); + flags & DV_F_DRQ_MASK, 1, -1); /* We can support the CS4231 and MIDI devices. */ diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index 065c1e5a38..bb662615be 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -29,6 +29,7 @@ * $FreeBSD: src/sys/dev/sound/isa/mss.c,v 1.95.2.3 2006/04/04 17:30:59 ariff Exp $ */ +#include #include SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/mss.c,v 1.11 2007/06/16 20:07:18 dillon Exp $"); @@ -1290,7 +1291,7 @@ mss_probe(device_t dev) /* XXX verify this */ setres = 1; bus_set_resource(dev, SYS_RES_IOPORT, mss->io_rid, - 0x530, 8); + 0x530, 8, -1); mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->io_rid, 0, ~0, 8, RF_ACTIVE); } @@ -1782,7 +1783,7 @@ mss_attach(device_t dev) mss->drq2_rid = -1; if (flags & DV_F_DUAL_DMA) { bus_set_resource(dev, SYS_RES_DRQ, 1, - flags & DV_F_DRQ_MASK, 1); + flags & DV_F_DRQ_MASK, 1, -1); mss->drq2_rid = 1; } mss->bd_id = (device_get_flags(dev) & DV_F_DEV_MASK) >> DV_F_DEV_SHIFT; @@ -2050,7 +2051,7 @@ opti_init(device_t dev, struct mss_info *mss) if (!mss->conf_base) { bus_set_resource(dev, SYS_RES_IOPORT, mss->conf_rid, - mss->optibase, 0x9); + mss->optibase, 0x9, -1); mss->conf_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->conf_rid, mss->optibase, mss->optibase+0x9, @@ -2112,11 +2113,12 @@ opti_init(device_t dev, struct mss_info *mss) if (mss->bd_flags & BD_F_924PNP) { u_int32_t irq = isa_get_irq(dev); u_int32_t drq = isa_get_drq(dev); - bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); - bus_set_resource(dev, SYS_RES_DRQ, mss->drq1_rid, drq, 1); + bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1, + machintr_intr_cpuid(irq)); + bus_set_resource(dev, SYS_RES_DRQ, mss->drq1_rid, drq, 1, -1); if (flags & DV_F_DUAL_DMA) { bus_set_resource(dev, SYS_RES_DRQ, 1, - flags & DV_F_DRQ_MASK, 1); + flags & DV_F_DRQ_MASK, 1, -1); mss->drq2_rid = 1; } } diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index 434348e4e7..f4e4ca8b70 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -322,7 +322,7 @@ sbc_attach(device_t dev) if (!logical_id && (flags & DV_F_DUAL_DMA)) { bus_set_resource(dev, SYS_RES_DRQ, 1, - flags & DV_F_DRQ_MASK, 1); + flags & DV_F_DRQ_MASK, 1, -1); } scp = device_get_softc(dev); diff --git a/sys/dev/sound/pci/vibes.c b/sys/dev/sound/pci/vibes.c index 86ba5ece13..1c59100e65 100644 --- a/sys/dev/sound/pci/vibes.c +++ b/sys/dev/sound/pci/vibes.c @@ -821,8 +821,10 @@ sv_attach(device_t dev) { /* Add resources to list of pci resources for this device - from here on * they look like normal pci resources. */ - bus_set_resource(dev, SYS_RES_IOPORT, SV_PCI_DMAA, sdmaa, SV_PCI_DMAA_SIZE); - bus_set_resource(dev, SYS_RES_IOPORT, SV_PCI_DMAC, sdmac, SV_PCI_DMAC_SIZE); + bus_set_resource(dev, SYS_RES_IOPORT, SV_PCI_DMAA, + sdmaa, SV_PCI_DMAA_SIZE, -1); + bus_set_resource(dev, SYS_RES_IOPORT, SV_PCI_DMAC, + sdmac, SV_PCI_DMAC_SIZE, -1); /* Cache resource short-cuts for dma_a */ sc->dmaa_rid = SV_PCI_DMAA; diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 77d11a274e..20c97085d2 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -242,6 +242,7 @@ METHOD int set_resource { int rid; u_long start; u_long count; + int cpuid; }; # diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index ca511f69de..995f2556af 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2662,14 +2662,14 @@ bus_generic_get_resource(device_t dev, device_t child, int type, int rid, int bus_generic_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + u_long start, u_long count, int cpuid) { int error; error = EINVAL; if (dev->parent) { error = BUS_SET_RESOURCE(dev->parent, child, type, rid, - start, count); + start, count, cpuid); } return (error); } @@ -2706,7 +2706,7 @@ bus_generic_rl_get_resource(device_t dev, device_t child, int type, int rid, int bus_generic_rl_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + u_long start, u_long count, int cpuid) { struct resource_list *rl = NULL; @@ -2714,7 +2714,8 @@ bus_generic_rl_set_resource(device_t dev, device_t child, int type, int rid, if (!rl) return(EINVAL); - resource_list_add(rl, type, rid, start, (start + count - 1), count, -1); + resource_list_add(rl, type, rid, start, (start + count - 1), count, + cpuid); return(0); } @@ -2876,10 +2877,10 @@ bus_disable_intr(device_t dev, void *cookie) int bus_set_resource(device_t dev, int type, int rid, - u_long start, u_long count) + u_long start, u_long count, int cpuid) { return(BUS_SET_RESOURCE(device_get_parent(dev), dev, type, rid, - start, count)); + start, count, cpuid)); } int diff --git a/sys/net/i4b/layer1/isic/i4b_avm_a1.c b/sys/net/i4b/layer1/isic/i4b_avm_a1.c index f9b3c1007a..4b460aede2 100644 --- a/sys/net/i4b/layer1/isic/i4b_avm_a1.c +++ b/sys/net/i4b/layer1/isic/i4b_avm_a1.c @@ -142,7 +142,7 @@ isic_alloc_port(device_t dev, int rid, u_int base, u_int len) sc->sc_resources.io_rid[rid] = rid; - bus_set_resource(dev, SYS_RES_IOPORT, rid, base, len); + bus_set_resource(dev, SYS_RES_IOPORT, rid, base, len, -1); if(!(sc->sc_resources.io_base[rid] = bus_alloc_resource(dev, SYS_RES_IOPORT, diff --git a/sys/net/i4b/layer1/isic/i4b_ctx_s0P.c b/sys/net/i4b/layer1/isic/i4b_ctx_s0P.c index 2c98d2d362..fe92470a94 100644 --- a/sys/net/i4b/layer1/isic/i4b_ctx_s0P.c +++ b/sys/net/i4b/layer1/isic/i4b_ctx_s0P.c @@ -186,7 +186,7 @@ isic_attach_Cs0P(device_t dev) sc->sc_resources.io_rid[2] = 2; - bus_set_resource(dev, SYS_RES_IOPORT, 2, iobase1-0x20, 0x40); + bus_set_resource(dev, SYS_RES_IOPORT, 2, iobase1-0x20, 0x40, -1); if(!(sc->sc_resources.io_base[2] = bus_alloc_resource(dev, SYS_RES_IOPORT, @@ -211,9 +211,9 @@ isic_attach_Cs0P(device_t dev) */ #if 0 - bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x20); + bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x20, -1); #else - bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x10); + bus_set_resource(dev, SYS_RES_IOPORT, 3, iobase2-0x20, 0x10, -1); #endif if(!(sc->sc_resources.io_base[3] = @@ -230,7 +230,7 @@ isic_attach_Cs0P(device_t dev) sc->sc_resources.io_rid[4] = 4; - bus_set_resource(dev, SYS_RES_IOPORT, 4, iobase2, 0x40); + bus_set_resource(dev, SYS_RES_IOPORT, 4, iobase2, 0x40, -1); if(!(sc->sc_resources.io_base[4] = bus_alloc_resource(dev,SYS_RES_IOPORT, @@ -251,7 +251,7 @@ isic_attach_Cs0P(device_t dev) { sc->sc_resources.io_rid[5] = 5; - bus_set_resource(dev, SYS_RES_IOPORT, 5, iocfg, 0x01); + bus_set_resource(dev, SYS_RES_IOPORT, 5, iocfg, 0x01, -1); if(!(sc->sc_resources.io_base[5] = bus_alloc_resource(dev,SYS_RES_IOPORT, diff --git a/sys/net/i4b/layer1/isic/i4b_tel_s0163.c b/sys/net/i4b/layer1/isic/i4b_tel_s0163.c index 78e560cc3e..5369109b4c 100644 --- a/sys/net/i4b/layer1/isic/i4b_tel_s0163.c +++ b/sys/net/i4b/layer1/isic/i4b_tel_s0163.c @@ -184,7 +184,7 @@ isic_probe_s0163(device_t dev) /* set io port resources */ sc->sc_resources.io_rid[0] = 0; - bus_set_resource(dev, SYS_RES_IOPORT, 0, sc->sc_port, 0x20); + bus_set_resource(dev, SYS_RES_IOPORT, 0, sc->sc_port, 0x20, -1); sc->sc_resources.io_base[0] = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->sc_resources.io_rid[0], @@ -198,7 +198,7 @@ isic_probe_s0163(device_t dev) } sc->sc_resources.io_rid[1] = 1; bus_set_resource(dev, SYS_RES_IOPORT, 1, - sc->sc_port-ISAC_OFFS, 0x20); + sc->sc_port-ISAC_OFFS, 0x20, -1); sc->sc_resources.io_base[1] = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->sc_resources.io_rid[1], @@ -213,7 +213,7 @@ isic_probe_s0163(device_t dev) sc->sc_resources.io_rid[2] = 2; bus_set_resource(dev, SYS_RES_IOPORT, 2, - sc->sc_port-HSCXA_OFFS, 0x20); + sc->sc_port-HSCXA_OFFS, 0x20, -1); sc->sc_resources.io_base[2] = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->sc_resources.io_rid[2], @@ -228,7 +228,7 @@ isic_probe_s0163(device_t dev) sc->sc_resources.io_rid[3] = 3; bus_set_resource(dev, SYS_RES_IOPORT, 3, - sc->sc_port-HSCXB_OFFS, 0x20); + sc->sc_port-HSCXB_OFFS, 0x20, -1); sc->sc_resources.io_base[3] = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->sc_resources.io_rid[3], diff --git a/sys/net/i4b/layer1/isic/i4b_usr_sti.c b/sys/net/i4b/layer1/isic/i4b_usr_sti.c index b136530466..22460a475f 100644 --- a/sys/net/i4b/layer1/isic/i4b_usr_sti.c +++ b/sys/net/i4b/layer1/isic/i4b_usr_sti.c @@ -221,7 +221,7 @@ usrtai_alloc_port(device_t dev) return 1; sc->sc_resources.io_rid[num] = num; - bus_set_resource(dev, SYS_RES_IOPORT, num, base, 1); + bus_set_resource(dev, SYS_RES_IOPORT, num, base, 1, -1); if(!(sc->sc_resources.io_base[num] = bus_alloc_resource(dev, SYS_RES_IOPORT, @@ -241,7 +241,7 @@ usrtai_alloc_port(device_t dev) return 1; sc->sc_resources.io_rid[num] = num; - bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8); + bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8, -1); if(!(sc->sc_resources.io_base[num] = bus_alloc_resource(dev, SYS_RES_IOPORT, @@ -262,7 +262,7 @@ usrtai_alloc_port(device_t dev) return 1; sc->sc_resources.io_rid[num] = num; - bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8); + bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8, -1); if(!(sc->sc_resources.io_base[num] = bus_alloc_resource(dev, SYS_RES_IOPORT, @@ -283,7 +283,7 @@ usrtai_alloc_port(device_t dev) return 1; sc->sc_resources.io_rid[num] = num; - bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8); + bus_set_resource(dev, SYS_RES_IOPORT, num, base+i*1024, 8, -1); if(!(sc->sc_resources.io_base[num] = bus_alloc_resource(dev, SYS_RES_IOPORT, diff --git a/sys/platform/pc32/i386/nexus.c b/sys/platform/pc32/i386/nexus.c index 0527eb0da8..782b121127 100644 --- a/sys/platform/pc32/i386/nexus.c +++ b/sys/platform/pc32/i386/nexus.c @@ -101,7 +101,8 @@ static int nexus_setup_intr(device_t, device_t, struct resource *, int flags, void **, lwkt_serialize_t); static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); -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, u_long, u_long, + int); static int nexus_get_resource(device_t, device_t, int, int, u_long *, u_long *); static void nexus_delete_resource(device_t, device_t, int, int); @@ -531,13 +532,15 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) } 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, + u_long start, u_long count, int cpuid) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; /* XXX this should return a success/failure indicator */ - resource_list_add(rl, type, rid, start, start + count - 1, count, -1); + resource_list_add(rl, type, rid, start, start + count - 1, count, + cpuid); return(0); } diff --git a/sys/platform/pc64/x86_64/nexus.c b/sys/platform/pc64/x86_64/nexus.c index deef6ef6eb..96bf14f188 100644 --- a/sys/platform/pc64/x86_64/nexus.c +++ b/sys/platform/pc64/x86_64/nexus.c @@ -97,7 +97,8 @@ static int nexus_setup_intr(device_t, device_t, struct resource *, int flags, void **, lwkt_serialize_t); static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); -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, u_long, u_long, + int); static int nexus_get_resource(device_t, device_t, int, int, u_long *, u_long *); static void nexus_delete_resource(device_t, device_t, int, int); @@ -527,13 +528,15 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) } 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, + u_long start, u_long count, int cpuid) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; /* XXX this should return a success/failure indicator */ - resource_list_add(rl, type, rid, start, start + count - 1, count, -1); + resource_list_add(rl, type, rid, start, start + count - 1, count, + cpuid); return(0); } diff --git a/sys/sys/bus.h b/sys/sys/bus.h index a968a5843f..204cd23668 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -265,8 +265,8 @@ int bus_generic_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); int bus_generic_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp); -int bus_generic_set_resource(device_t dev, device_t child, int type, - int rid, u_long start, u_long count); +int bus_generic_set_resource(device_t dev, device_t child, + int type, int rid, u_long start, u_long count, int cpuid); void bus_generic_delete_resource(device_t dev, device_t child, int type, int rid); int bus_generic_resume(device_t dev); @@ -288,7 +288,7 @@ 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); + u_long, int); int bus_generic_rl_release_resource (device_t, device_t, int, int, struct resource *); @@ -323,7 +323,7 @@ int bus_setup_intr(device_t dev, struct resource *r, int flags, void **cookiep, lwkt_serialize_t serializer); int bus_teardown_intr(device_t dev, struct resource *r, void *cookie); int bus_set_resource(device_t dev, int type, int rid, - u_long start, u_long count); + u_long start, u_long count, int cpuid); 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); -- 2.41.0