xref: /kvm-unit-tests/lib/x86/asm/io.h (revision f1abb07b7692593d59990805010d8fdc990cb70e)
1 #ifndef _ASM_X86_IO_H_
2 #define _ASM_X86_IO_H_
3 
4 #define __iomem
5 
6 static inline unsigned char inb(unsigned short port)
7 {
8     unsigned char value;
9     asm volatile("inb %w1, %0" : "=a" (value) : "Nd" (port));
10     return value;
11 }
12 
13 static inline unsigned short inw(unsigned short port)
14 {
15     unsigned short value;
16     asm volatile("inw %w1, %0" : "=a" (value) : "Nd" (port));
17     return value;
18 }
19 
20 static inline unsigned int inl(unsigned short port)
21 {
22     unsigned int value;
23     asm volatile("inl %w1, %0" : "=a" (value) : "Nd" (port));
24     return value;
25 }
26 
27 static inline void outb(unsigned char value, unsigned short port)
28 {
29     asm volatile("outb %b0, %w1" : : "a"(value), "Nd"(port));
30 }
31 
32 static inline void outw(unsigned short value, unsigned short port)
33 {
34     asm volatile("outw %w0, %w1" : : "a"(value), "Nd"(port));
35 }
36 
37 static inline void outl(unsigned int value, unsigned short port)
38 {
39     asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port));
40 }
41 
42 static inline unsigned long virt_to_phys(const void *virt)
43 {
44     return (unsigned long)virt;
45 }
46 
47 static inline void *phys_to_virt(unsigned long phys)
48 {
49     return (void *)phys;
50 }
51 
52 void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
53 
54 #endif
55