From owner-freebsd-arch@FreeBSD.ORG Fri Sep 3 17:51:25 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E88A610656A6; Fri, 3 Sep 2010 17:51:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B604E8FC14; Fri, 3 Sep 2010 17:51:25 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 57CB046B2A; Fri, 3 Sep 2010 13:51:25 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7651B8A04E; Fri, 3 Sep 2010 13:51:24 -0400 (EDT) From: John Baldwin To: "M. Warner Losh" Date: Fri, 3 Sep 2010 13:50:36 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <4C80A728.6090002@freebsd.org> <201009031001.58036.jhb@freebsd.org> <20100903.105927.70320533242210716.imp@bsdimp.com> In-Reply-To: <20100903.105927.70320533242210716.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009031350.36931.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 03 Sep 2010 13:51:24 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: avg@freebsd.org, freebsd-arch@freebsd.org Subject: Re: newbus: type (max value) for device order X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 17:51:26 -0000 On Friday, September 03, 2010 12:59:27 pm M. Warner Losh wrote: > In message: <201009031001.58036.jhb@freebsd.org> > John Baldwin writes: > : On Friday, September 03, 2010 3:43:36 am Andriy Gapon wrote: > : > > : > device_add_child_ordered() takes order as a parameter of int type. > : > struct device stores it as u_char. > : > > : > This can be confusing, can't it? > : > In fact, up to r203776 we used to use order value of 100000 in acpi.c (which > : > effectively was 160 according to my calculations). > : > > : > Not sure what I want to suggest, perhaps defining DEVICE_MAX_ORDER or something. > : > Or changing the type in struct device to int. > : > : Just fix device_t to store an int I think. Also, it should probably be a > : u_int as negative values don't really make sense. > > One caution: > u_short flags; /**< internal device flags */ > #define DF_ENABLED 1 /* device should be probed/attached */ > #define DF_FIXEDCLASS 2 /* devclass specified at create time */ > #define DF_WILDCARD 4 /* unit was originally wildcard */ > #define DF_DESCMALLOCED 8 /* description was malloced */ > #define DF_QUIET 16 /* don't print verbose attach message */ > #define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ > #define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ > #define DF_REBID 128 /* Can rebid after attach */ > #define DF_REMAPPED 256 /* all remapping completed */ > u_char order; /**< order from device_add_child_ordered() */ > u_char pad; > > I'd be inclined to change this to: > > u_int flags; /**< internal device flags */ > #define DF_ENABLED 1 /* device should be probed/attached */ > #define DF_FIXEDCLASS 2 /* devclass specified at create time */ > #define DF_WILDCARD 4 /* unit was originally wildcard */ > #define DF_DESCMALLOCED 8 /* description was malloced */ > #define DF_QUIET 16 /* don't print verbose attach message */ > #define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ > #define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ > #define DF_REBID 128 /* Can rebid after attach */ > #define DF_REMAPPED 256 /* all remapping completed */ > u_int order; /**< order from device_add_child_ordered() */ > > so that the padding and such remains consistent. Agreed. > I think this is even an MFCable change, since device_t's size isn't > exposed outside of subr_bus.c... Yes. -- John Baldwin