From 93fad5193b3d1007ac4bfe4f0154d6843df9270a Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Mon, 3 Oct 2011 22:05:56 +0800 Subject: [PATCH] resource: Per-CPU hardware resources support, step 2 of many Add cpuid parameter to resource_list_alloc, so that this parameter could be passed to bus_alloc_resource DEVMETHOD --- sys/bus/isa/i386/isa.c | 2 +- sys/bus/isa/isa_common.c | 16 ++++++---------- sys/bus/isa/x86_64/isa.c | 2 +- sys/bus/pccard/pccard.c | 2 +- sys/bus/pci/pci.c | 12 ++++++------ sys/kern/subr_bus.c | 5 +++-- sys/sys/bus.h | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/sys/bus/isa/i386/isa.c b/sys/bus/isa/i386/isa.c index 4d9a30606f..ebccf20111 100644 --- a/sys/bus/isa/i386/isa.c +++ b/sys/bus/isa/i386/isa.c @@ -129,7 +129,7 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, } return resource_list_alloc(rl, bus, child, type, rid, - start, end, count, flags); + start, end, count, flags, -1); } int diff --git a/sys/bus/isa/isa_common.c b/sys/bus/isa/isa_common.c index fedf25cae1..521636302d 100644 --- a/sys/bus/isa/isa_common.c +++ b/sys/bus/isa/isa_common.c @@ -503,10 +503,8 @@ isa_probe_children(device_t dev) if (!rle->res) { int rid = rle->rid; resource_list_alloc(rl, dev, child, - rle->type, - &rid, - 0, ~0, 1, - 0 /* !RF_ACTIVE */); + rle->type, &rid, 0, ~0, 1, + 0 /* !RF_ACTIVE */, -1); } } } @@ -808,8 +806,8 @@ isa_child_detached(device_t dev, device_t child) if (!rle->res) { int rid = rle->rid; resource_list_alloc(rl, dev, child, - rle->type, - &rid, 0, ~0, 1, 0); + rle->type, &rid, 0, ~0, 1, + 0 /* !RF_ACTIVE */, -1); } } } @@ -872,10 +870,8 @@ isa_driver_added(device_t dev, driver_t *driver) if (!rle->res) { int rid = rle->rid; resource_list_alloc(rl, dev, child, - rle->type, - &rid, - 0, ~0, 1, - 0 /* !RF_ACTIVE */); + rle->type, &rid, 0, ~0, 1, + 0 /* !RF_ACTIVE */, -1); } } } diff --git a/sys/bus/isa/x86_64/isa.c b/sys/bus/isa/x86_64/isa.c index 68def7a157..72c96299a1 100644 --- a/sys/bus/isa/x86_64/isa.c +++ b/sys/bus/isa/x86_64/isa.c @@ -123,7 +123,7 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, } return resource_list_alloc(rl, bus, child, type, rid, - start, end, count, flags); + start, end, count, flags, -1); } int diff --git a/sys/bus/pccard/pccard.c b/sys/bus/pccard/pccard.c index 26c3f0921a..3e0aabbbd1 100644 --- a/sys/bus/pccard/pccard.c +++ b/sys/bus/pccard/pccard.c @@ -904,7 +904,7 @@ pccard_set_resource(device_t dev, device_t child, int type, int rid, resource_list_add(rl, type, rid, start, start + count - 1, count, -1); if (NULL != resource_list_alloc(rl, device_get_parent(dev), dev, - type, &rid, start, start + count - 1, count, 0)) + type, &rid, start, start + count - 1, count, 0, -1)) return 0; else return ENOMEM; diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index 704eade334..3efea2ca8b 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -2721,7 +2721,7 @@ pci_add_map(device_t pcib, device_t bus, device_t dev, * pci_alloc_resource(). */ res = resource_list_alloc(rl, bus, dev, type, ®, start, end, count, - prefetch ? RF_PREFETCHABLE : 0); + prefetch ? RF_PREFETCHABLE : 0, -1); if (res == NULL) { /* * If the allocation fails, delete the resource list @@ -2788,11 +2788,11 @@ pci_ata_maps(device_t pcib, device_t bus, device_t dev, int b, rid = PCIR_BAR(0); resource_list_add(rl, type, rid, 0x1f0, 0x1f7, 8, -1); resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7, 8, - 0); + 0, -1); rid = PCIR_BAR(1); resource_list_add(rl, type, rid, 0x3f6, 0x3f6, 1, -1); resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6, 1, - 0); + 0, -1); } if (progif & PCIP_STORAGE_IDE_MODESEC) { pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(2), rl, force, @@ -2803,11 +2803,11 @@ pci_ata_maps(device_t pcib, device_t bus, device_t dev, int b, rid = PCIR_BAR(2); resource_list_add(rl, type, rid, 0x170, 0x177, 8, -1); resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177, 8, - 0); + 0, -1); rid = PCIR_BAR(3); resource_list_add(rl, type, rid, 0x376, 0x376, 1, -1); resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376, 1, - 0); + 0, -1); } pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(4), rl, force, prefetchmask & (1 << 4)); @@ -3930,7 +3930,7 @@ pci_alloc_resource(device_t dev, device_t child, int type, int *rid, } } return (resource_list_alloc(rl, dev, child, type, rid, - start, end, count, flags)); + start, end, count, flags, -1)); } void diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 06a29b44ee..ca511f69de 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2221,7 +2221,7 @@ 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) + u_long count, u_int flags, int cpuid) { struct resource_list_entry *rle = 0; int passthrough = (device_get_parent(child) != bus); @@ -2246,6 +2246,7 @@ resource_list_alloc(struct resource_list *rl, count = max(count, rle->count); end = max(rle->end, start + count - 1); } + cpuid = rle->cpuid; rle->res = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid, start, end, count, flags); @@ -2754,7 +2755,7 @@ bus_generic_rl_alloc_resource(device_t dev, device_t child, int type, return(NULL); return(resource_list_alloc(rl, dev, child, type, rid, - start, end, count, flags)); + start, end, count, flags, -1)); } int diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 713b077cb3..a968a5843f 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -203,7 +203,7 @@ struct resource * device_t bus, device_t child, int type, int *rid, u_long start, u_long end, - u_long count, u_int flags); + u_long count, u_int flags, int cpuid); /* * Implement BUS_RELEASE_RESOURCE. -- 2.41.0