Bus space routines
Jung-uk Kim
jkim at FreeBSD.org
Tue Jun 18 19:36:35 UTC 2013
-----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-----
More information about the freebsd-arch
mailing list