Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 2013 15:36:07 -0400
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        arch@freebsd.org, Niclas Zeising <zeising@freebsd.org>, Robert Millan <rmh@freebsd.org>
Subject:   Re: Bus space routines
Message-ID:  <51C0B6A7.10505@FreeBSD.org>
In-Reply-To: <1AF8EDA9-3403-49F2-B16F-B324084908FD@bsdimp.com>
References:  <51C0345E.4000309@freebsd.org> <CAOfDtXNWMO-D1D9UAcvG_nhv4uqMQmrpEvsPd-PAEB1-FdoXtA@mail.gmail.com> <51C0AC01.8070007@FreeBSD.org> <1AF8EDA9-3403-49F2-B16F-B324084908FD@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51C0B6A7.10505>