]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r339618:
authortijl <tijl@FreeBSD.org>
Thu, 25 Oct 2018 16:01:10 +0000 (16:01 +0000)
committertijl <tijl@FreeBSD.org>
Thu, 25 Oct 2018 16:01:10 +0000 (16:01 +0000)
commitae2409aeb64ceca3648a195498c5cfb090145b05
treeb9f3e774193caab329eaa6269123a66d0a11605e
parent13f6a0b35881a2527aaefc07fab7324e8461d0a0
MFC r339618:

Define linuxkpi readq for 64-bit architectures.  It is used by drm-kmod.
Currently the compiler picks up the definition in machine/cpufunc.h.

Add compiler memory barriers to read* and write*.  The Linux x86
implementation of these functions uses inline asm with "memory" clobber.
The Linux x86 implementation of read_relaxed* and write_relaxed* uses the
same inline asm without "memory" clobber.

Implement ioread* and iowrite* in terms of read* and write* so they also
have memory barriers.

Qualify the addr parameter in write* as volatile.

Like Linux, define macros with the same name as the inline functions.

Only define 64-bit versions on 64-bit architectures because generally
32-bit architectures can't do atomic 64-bit loads and stores.

Regroup the functions a bit and add brief comments explaining what they do:
- __raw_read*, __raw_write*: atomic, no barriers, no byte swapping
- read_relaxed*, write_relaxed*: atomic, no barriers, little-endian
- read*, write*: atomic, with barriers, little-endian

Add a comment that says our implementation of ioread* and iowrite*
only handles MMIO and does not support port IO.

Reviewed by: hselasky
Approved by: re (gjb)
sys/compat/linuxkpi/common/include/linux/io.h