resource: Per-CPU hardware resources support, step 2 of many
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 3 Oct 2011 14:05:56 +0000 (22:05 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 3 Oct 2011 14:05:56 +0000 (22:05 +0800)
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
sys/bus/isa/isa_common.c
sys/bus/isa/x86_64/isa.c
sys/bus/pccard/pccard.c
sys/bus/pci/pci.c
sys/kern/subr_bus.c
sys/sys/bus.h

index 4d9a306..ebccf20 100644 (file)
@@ -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
index fedf25c..5216363 100644 (file)
@@ -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);
                                }
                        }
                }
index 68def7a..72c9629 100644 (file)
@@ -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
index 26c3f09..3e0aabb 100644 (file)
@@ -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;
index 704eade..3efea2c 100644 (file)
@@ -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, &reg, 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
index 06a29b4..ca511f6 100644 (file)
@@ -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
index 713b077..a968a58 100644 (file)
@@ -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.