21 #define IOAPI_PREFIX_x86 23 #define IOAPI_PREFIX_x86 __x86_ 51 #define X86_READX( _api_func, _type ) \ 52 static inline __always_inline _type \ 53 IOAPI_INLINE ( x86, _api_func ) ( volatile _type *io_addr ) { \ 63 #define X86_WRITEX( _api_func, _type ) \ 64 static inline __always_inline void \ 65 IOAPI_INLINE ( x86, _api_func ) ( _type data, \ 66 volatile _type *io_addr ) { \ 81 #define X86_INX( _insn_suffix, _type, _reg_prefix ) \ 82 static inline __always_inline _type \ 83 IOAPI_INLINE ( x86, in ## _insn_suffix ) ( volatile _type *io_addr ) { \ 85 __asm__ __volatile__ ( "in" #_insn_suffix " %w1, %" _reg_prefix "0" \ 86 : "=a" ( data ) : "Nd" ( io_addr ) ); \ 89 static inline __always_inline void \ 90 IOAPI_INLINE ( x86, ins ## _insn_suffix ) ( volatile _type *io_addr, \ 92 unsigned int count ) { \ 93 unsigned int discard_D; \ 94 __asm__ __volatile__ ( "rep ins" #_insn_suffix \ 95 : "=D" ( discard_D ) \ 96 : "d" ( io_addr ), "c" ( count ), \ 103 #define X86_OUTX( _insn_suffix, _type, _reg_prefix ) \ 104 static inline __always_inline void \ 105 IOAPI_INLINE ( x86, out ## _insn_suffix ) ( _type data, \ 106 volatile _type *io_addr ) { \ 107 __asm__ __volatile__ ( "out" #_insn_suffix " %" _reg_prefix "0, %w1" \ 108 : : "a" ( data ), "Nd" ( io_addr ) ); \ 110 static inline __always_inline void \ 111 IOAPI_INLINE ( x86, outs ## _insn_suffix ) ( volatile _type *io_addr, \ 113 unsigned int count ) { \ 114 unsigned int discard_S; \ 115 __asm__ __volatile__ ( "rep outs" #_insn_suffix \ 116 : "=S" ( discard_S ) \ 117 : "d" ( io_addr ), "c" ( count ), \
uint8_t readb(volatile uint8_t *io_addr)
Read byte from memory-mapped device.
#define X86_READX(_api_func, _type)
uint64_t readq(volatile uint64_t *io_addr)
Read 64-bit qword from memory-mapped device.
uint16_t readw(volatile uint16_t *io_addr)
Read 16-bit word from memory-mapped device.
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
unsigned long long uint64_t
static __always_inline void unsigned long bus_addr
void writeb(uint8_t data, volatile uint8_t *io_addr)
Write byte to memory-mapped device.
#define X86_WRITEX(_api_func, _type)
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
#define X86_INX(_insn_suffix, _type, _reg_prefix)
static __always_inline unsigned long IOAPI_INLINE(x86, phys_to_bus)(unsigned long phys_addr)
#define __always_inline
Declare a function to be always inline.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned long phys_to_bus(unsigned long phys_addr)
Convert physical address to a bus address.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define X86_OUTX(_insn_suffix, _type, _reg_prefix)
void mb(void)
Memory barrier.
void iodelay(void)
Slow down I/O.
unsigned long bus_to_phys(unsigned long bus_addr)
Convert bus address to a physical address.
void writeq(uint64_t data, volatile uint64_t *io_addr)
Write 64-bit qword to memory-mapped device.