HomeFreeBSD

MFC r339618:

Description

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)

Details

Provenance
tijlAuthored on
Reviewer
hselasky
Parents
rS339732: MFC r339709:
Branches
Unknown
Tags
Unknown