From owner-freebsd-arch@FreeBSD.ORG Tue Jun 18 19:36:35 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by hub.freebsd.org (Postfix) with ESMTP id 731F054D; Tue, 18 Jun 2013 19:36:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Message-ID: <51C0B6A7.10505@FreeBSD.org> Date: Tue, 18 Jun 2013 15:36:07 -0400 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130517 Thunderbird/17.0.6 MIME-Version: 1.0 To: Warner Losh Subject: Re: Bus space routines References: <51C0345E.4000309@freebsd.org> <51C0AC01.8070007@FreeBSD.org> <1AF8EDA9-3403-49F2-B16F-B324084908FD@bsdimp.com> In-Reply-To: <1AF8EDA9-3403-49F2-B16F-B324084908FD@bsdimp.com> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: arch@freebsd.org, Niclas Zeising , Robert Millan X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jun 2013 19:36:35 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-06-18 15:17:13 -0400, Warner Losh wrote: > On Jun 18, 2013, at 12:50 PM, Jung-uk Kim wrote: >> On 2013-06-18 06:56:15 -0400, Robert Millan wrote: >>> I think the BSD world did the right thing by introducing new >>> semantics. Plus they're also more portable (on the hardware >>> sense), have a look, e.g.: >> ... >>> So why not just use those? It seems very natural to me that if >>> you have something which is unambigous and reliable, you use >>> this instead of something else which is prone to nasty errors. >> >> bus_space(9!) is KPI and it must not be used on userland. >> Actually, it only works on X86 by pure luck, e.g., >> bus_space_tag_t is an integral type, it has very simple >> instructions to directly access I/O space, etc. > > There's nothing preventing a bus_space implementation in user > space. It's just that we don't have one yet, except on x86 where it > works by luck. Yeah, that's actually what I meant to say. > On most architectures other than x86, however, it would likely be > tricky to implement. Linux implementation just uses native instructions for x86 and arm via sys/io.h. Other architectures (ab)use sysfs to expose PCI BARs to userland. http://cgit.freedesktop.org/xorg/lib/libpciaccess/tree/src/linux_sysfs.c We can simply use io(4) for non-X86 platforms. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJRwLanAAoJECXpabHZMqHO6UwIAI096rdiHVsY7C2vOx96MMBY W44gV04FtNqbUDNNZ0v/IwNGoUErd99t/OcVZfgGaSivTdFBZSc9yZUhSxPOXgHV W6ghgLokLedQMbmefXGuAubuXaAG0EARoxsIwipCTHuClrTlJzUtR74oSnirgKmY SK11Co70O95eWYiq4V+U3GrdyWx59WaOkKPWPzEtDb4ssrjyHNCBNFqKPAb4WY4y ginw8Or0TuUSuOK9JsDJQY1uXVdBJhe9XL+eVRfaKe6L7zEKVY3ihW12854XoKUZ pTWxAhAW9X1xIa02yhFBYieW2p1qR58n8EeOi4tSQNV7cxDMSQl7EM3RhDMmErE= =r8Hl -----END PGP SIGNATURE-----