From owner-p4-projects@FreeBSD.ORG Mon Jul 17 20:32:17 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 27C1C16A501; Mon, 17 Jul 2006 20:32:17 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E282A16A508 for ; Mon, 17 Jul 2006 20:32:16 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4D9343D68 for ; Mon, 17 Jul 2006 20:32:14 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6HKWEFS041480 for ; Mon, 17 Jul 2006 20:32:14 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6HKWEnY041477 for perforce@freebsd.org; Mon, 17 Jul 2006 20:32:14 GMT (envelope-from imp@freebsd.org) Date: Mon, 17 Jul 2006 20:32:14 GMT Message-Id: <200607172032.k6HKWEnY041477@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 101799 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jul 2006 20:32:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=101799 Change 101799 by imp@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);