There are two implementations of port I/O helpers: one in the kernel and one in the boot stub. Move the helpers required for both to <asm/shared/io.h> and use the one implementation everywhere. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20220405232939.73860-15-kirill.shutemov@linux.intel.com
34 lines
724 B
C
34 lines
724 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_SHARED_IO_H
|
|
#define _ASM_X86_SHARED_IO_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define BUILDIO(bwl, bw, type) \
|
|
static inline void __out##bwl(type value, u16 port) \
|
|
{ \
|
|
asm volatile("out" #bwl " %" #bw "0, %w1" \
|
|
: : "a"(value), "Nd"(port)); \
|
|
} \
|
|
\
|
|
static inline type __in##bwl(u16 port) \
|
|
{ \
|
|
type value; \
|
|
asm volatile("in" #bwl " %w1, %" #bw "0" \
|
|
: "=a"(value) : "Nd"(port)); \
|
|
return value; \
|
|
}
|
|
|
|
BUILDIO(b, b, u8)
|
|
BUILDIO(w, w, u16)
|
|
BUILDIO(l, , u32)
|
|
#undef BUILDIO
|
|
|
|
#define inb __inb
|
|
#define inw __inw
|
|
#define inl __inl
|
|
#define outb __outb
|
|
#define outw __outw
|
|
#define outl __outl
|
|
|
|
#endif
|