From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 4 17:20:58 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 979381065670 for ; Thu, 4 Oct 2012 17:20:58 +0000 (UTC) (envelope-from carl.r.delsey@intel.com) Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by mx1.freebsd.org (Postfix) with ESMTP id 710E68FC0C for ; Thu, 4 Oct 2012 17:20:58 +0000 (UTC) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 04 Oct 2012 10:20:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,537,1344236400"; d="scan'208";a="152468880" Received: from crdelsey-fbsd.ch.intel.com (HELO [10.2.105.127]) ([10.2.105.127]) by AZSMGA002.ch.intel.com with ESMTP; 04 Oct 2012 10:20:52 -0700 Message-ID: <506DC574.9010300@intel.com> Date: Thu, 04 Oct 2012 10:20:52 -0700 From: Carl Delsey User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120724 Thunderbird/13.0.1 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: No bus_space_read_8 on x86 ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2012 17:20:58 -0000 I noticed that the bus_space_*_8 functions are unimplemented for x86. Looking at the code, it seems this is intentional. Is this done because on 32-bit systems we don't know, in the general case, whether to read the upper or lower 32-bits first? If that's the reason, I was thinking we could provide two implementations for i386: bus_space_read_8_upper_first and bus_space_read_8_lower_first. For amd64 we would just have bus_space_read_8 Anybody who wants to use bus_space_read_8 in their file would do something like: #define BUS_SPACE_8_BYTES LOWER_FIRST or #define BUS_SPACE_8_BYTES UPPER_FIRST whichever is appropriate for their hardware. This would go in their source file before including bus.h and we would take care of mapping to the correct implementation. With the prevalence of 64-bit registers these days, if we don't provide an implementation, I expect many drivers will end up rolling their own. If this seems like a good idea, I'll happily whip up a patch and submit it.