PERFORCE change 101799 for review
Warner Losh
imp at FreeBSD.org
Mon Jul 17 20:32:17 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=101799
Change 101799 by imp at imp_lighthouse on 2006/07/17 20:31:52
Allow hinted/reserved devices to block only non-hinting
scenarios. For a hinted scenario, a reservation doesn't block
anything, but an actual device does.
Affected files ...
.. //depot/projects/arm/src/sys/kern/subr_bus.c#14 edit
Differences ...
==== //depot/projects/arm/src/sys/kern/subr_bus.c#14 (text+ko) ====
@@ -1286,13 +1286,14 @@
* @param dc the devclass to allocate from
* @param unitp points at the location for the allocated unit
* number
+ * @param reservedok Allow allocation of a hinted/reserved unit
*
* @retval 0 success
* @retval EEXIST the requested unit number is already allocated
* @retval ENOMEM memory allocation failure
*/
static int
-devclass_alloc_unit(devclass_t dc, int *unitp)
+devclass_alloc_unit(devclass_t dc, int *unitp, int reservedok)
{
int unit = *unitp;
const char *where;
@@ -1318,7 +1319,7 @@
*/
unit = 0;
while ((unit < dc->maxunit && dc->devices[unit] != NULL) ||
- resource_string_value(dc->name, unit, "at", &where) == 0)
+ (!reservedok && resource_string_value(dc->name, unit, "at", &where) == 0))
unit++;
}
@@ -1360,13 +1361,14 @@
*
* @param dc the devclass to add to
* @param dev the device to add
+ * @param reservedok Allocating reserved, but not busy, units is ok.
*
* @retval 0 success
* @retval EEXIST the requested unit number is already allocated
* @retval ENOMEM memory allocation failure
*/
static int
-devclass_add_device(devclass_t dc, device_t dev)
+devclass_add_device(devclass_t dc, device_t dev, int reservedok)
{
int buflen, error;
@@ -1379,7 +1381,7 @@
if (!dev->nameunit)
return (ENOMEM);
- if ((error = devclass_alloc_unit(dc, &dev->unit)) != 0) {
+ if ((error = devclass_alloc_unit(dc, &dev->unit, reservedok)) != 0) {
free(dev->nameunit, M_BUS);
dev->nameunit = NULL;
return (error);
@@ -1474,7 +1476,7 @@
dev->flags |= DF_WILDCARD;
if (name) {
dev->flags |= DF_FIXEDCLASS;
- if (devclass_add_device(dc, dev)) {
+ if (devclass_add_device(dc, dev, 0)) {
kobj_delete((kobj_t) dev, M_BUS);
return (NULL);
}
@@ -1733,7 +1735,7 @@
if (childdc->devices[unit] != NULL)
continue;
child->unit = unit;
- devclass_add_device(childdc, child);
+ devclass_add_device(childdc, child, 1);
}
}
/* Fetch any flags for the device before probing. */
@@ -1822,7 +1824,7 @@
childdc = child->devclass;
devclass_delete_device(childdc, child);
child->unit = unit;
- devclass_add_device(childdc, child);
+ devclass_add_device(childdc, child, 1);
}
}
resource_int_value(best->driver->name, child->unit,
@@ -2272,7 +2274,7 @@
if (!dc)
return (ENOMEM);
- error = devclass_add_device(dc, dev);
+ error = devclass_add_device(dc, dev, 0); // XXXimp: right?
bus_data_generation_update();
return (error);
More information about the p4-projects
mailing list