From owner-freebsd-arch@freebsd.org Sun Aug 30 05:49:34 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD7F9C5970 for ; Sun, 30 Aug 2015 05:49:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id E6AF0C04 for ; Sun, 30 Aug 2015 05:49:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id C0DA1D6551D; Sun, 30 Aug 2015 15:49:30 +1000 (AEST) Date: Sun, 30 Aug 2015 15:49:29 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Justin Hibbits , Adrian Chadd , "freebsd-arch@freebsd.org" , Marcel Moolenaar Subject: Re: Devices with 36-bit paddr on 32-bit system In-Reply-To: <20150830130612.L890@besplex.bde.org> Message-ID: <20150830153859.S1263@besplex.bde.org> References: <1568331.OrSoeYfXsf@ralph.baldwin.cx> <20150830130612.L890@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=L4TgOLn8 c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=xl9oN2MitZH6uz9LxZsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Aug 2015 05:49:34 -0000 On Sun, 30 Aug 2015, Bruce Evans wrote: > % ... > % Index: sys/sys/bus.h > % =================================================================== > % --- sys/sys/bus.h (revision 287189) > % +++ sys/sys/bus.h (working copy) > % @@ -29,6 +29,7 @@ > % #ifndef _SYS_BUS_H_ > % #define _SYS_BUS_H_ > % % +#include > % #include > % #include > % #include > % @@ -292,8 +293,8 @@ > % int rid; /**< @brief resource identifier */ > % int flags; /**< @brief resource flags */ > % struct resource *res; /**< @brief the real resource when > allocated */ > % - u_long start; /**< @brief start of resource range > */ > % - u_long end; /**< @brief end of resource range */ > % + bus_addr_t start; /**< @brief start of resource range > */ > % + bus_addr_t end; /**< @brief end of resource range */ Mail programs (mostly mine) corrupted the formatting more competely. > I think rman functions should use an rman type and not hard-code bus_addr_t. > Related bus functions should then use this type. Style bugs from blind > substitution can be reduced by using a less verbose name. > > % u_long count; /**< @brief count within range */ > % }; Or just use uintmax_t for everything in rman. rman was written before C99 broke C by making u_long no longer the largest integer type. It used u_long because it was the largest integer type (though it actually wasn't, since FreeBSD used nonstandard extensions in Gnu C) and it is easiest to use a single non-typedefed type that is large enough for all cases. uintmax_t is C99's replacement of u_long. I don't like the bloat from using uintmax_t for everything, but rman should only used for initialization so uintmax_t for rman should only give space bloat, only on 32-bit arches. An rman typedef for this type allows re-optimizing the 32-bit arches, but brings back the problem of typedefed types being hard to use. Bruce