Bus space routines

Robert Millan rmh at freebsd.org
Tue Jun 18 10:59:34 UTC 2013


2013/6/18 Robert Millan <rmh at freebsd.org>:
> static __inline void
> bus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh,
>                        bus_size_t offset, u_int8_t value)
> {
>
>         if (tag == X86_BUS_SPACE_IO)
>                 outb(bsh + offset, value);
>         else
>                 *(volatile u_int8_t *)(bsh + offset) = value;
> }
>
> 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.

(Yes, I'm aware that GNU systems in general don't have this, and that
using bus_space_* would introduce a portability nuissance, but IMHO
this is much better than encouraging them to use the non-portable
<sys/io.h> from Glibc right away. At least this forces them to think
about what they're doing)

--
Robert Millan


More information about the freebsd-arch mailing list