From owner-freebsd-arch Thu Mar 1 1:46:39 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 5AEC137B718 for ; Thu, 1 Mar 2001 01:46:35 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id UAA03617; Thu, 1 Mar 2001 20:46:28 +1100 Date: Thu, 1 Mar 2001 20:46:23 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Matthew Jacob Cc: arch@FreeBSD.ORG Subject: Re: lossage of a sort with using device hints... In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 28 Feb 2001, Matthew Jacob wrote: [bde wrote] > > I think it is not fundamentally broken for type 'long' on machines with > > >=64 bit longs, but subr_bus.c:resource_find_hard() is missing support > > for longs. It uses strtoul() to convert the string to a number and then > > blindly assigns the number to an int. It also ignores range errors > > reported by strtoul(), of course. > > But the main point here is that one doesn't really want longs- one wants the > size one wants, or one wants the string. One also wants error checking. The main point of having central handling of the conversion instead of making everything convert the string is to centralize the error handling. > > > hint.isp.0.portwnn="w50000000aaaa0000" > > > hint.isp.0.nodewnn="w50000000aaaa0001" > > > > > > in order to get the string so I can then do a kernel strtouq on the portion > > > past the 'w'... *phppptttttt* > > > > Try changing resource_find_hard() to produce a RES_LONG instead of a > > RES_INT. > > I don't believe this will help for anytihing but alpha, will it? No. i386's currently just don't support resource values with size > 32 bits. You mentioned a need for 128 bits in other mail. This would have to be handled as a string. Perhaps the same for > 32 bits or at least for > sizeof(long) bytes. > > BTW, resource_long_value() isn't used anywhere. This is probably an > > i386ism (resource_long_value() is useless when sizeof(int) == sizeof(long)). > > This is a bug in "machine-independent" code link /sys/isa/isahint.c > > (it uses resource_int_value() for memory addresses...). > > Memory addresses on ISA? Tsk... < 16MB... Is there a standard for isa memory addresses? They could be mapped anywhere. Another problem with resource_*_value() is that resource_long_value() doesn't return "int" resources although it could. The caller has to know the type. > I'm now inclined to think that RES_INT (unsized) an RES_STRING is sufficient > as long as you can coerce RES_STRING. The general usage of integers for hints > will satisfy most drivers that will use this stuff. The strings can then be > interpreted as need be- it's not really that bad in FreeBSD because there's a > very rich set of C-library like functions. I agree. The set is too rich :-). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message