162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_X86_SHARED_IO_H 362306a36Sopenharmony_ci#define _ASM_X86_SHARED_IO_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/types.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define BUILDIO(bwl, bw, type) \ 862306a36Sopenharmony_cistatic __always_inline void __out##bwl(type value, u16 port) \ 962306a36Sopenharmony_ci{ \ 1062306a36Sopenharmony_ci asm volatile("out" #bwl " %" #bw "0, %w1" \ 1162306a36Sopenharmony_ci : : "a"(value), "Nd"(port)); \ 1262306a36Sopenharmony_ci} \ 1362306a36Sopenharmony_ci \ 1462306a36Sopenharmony_cistatic __always_inline type __in##bwl(u16 port) \ 1562306a36Sopenharmony_ci{ \ 1662306a36Sopenharmony_ci type value; \ 1762306a36Sopenharmony_ci asm volatile("in" #bwl " %w1, %" #bw "0" \ 1862306a36Sopenharmony_ci : "=a"(value) : "Nd"(port)); \ 1962306a36Sopenharmony_ci return value; \ 2062306a36Sopenharmony_ci} 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciBUILDIO(b, b, u8) 2362306a36Sopenharmony_ciBUILDIO(w, w, u16) 2462306a36Sopenharmony_ciBUILDIO(l, , u32) 2562306a36Sopenharmony_ci#undef BUILDIO 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci#define inb __inb 2862306a36Sopenharmony_ci#define inw __inw 2962306a36Sopenharmony_ci#define inl __inl 3062306a36Sopenharmony_ci#define outb __outb 3162306a36Sopenharmony_ci#define outw __outw 3262306a36Sopenharmony_ci#define outl __outl 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#endif 35