7 /* Reads and returns a byte from PORT. */
12 asm volatile ("inb %w1,%0" : "=a" (data) : "d" (port));
16 /* Reads CNT bytes from PORT, one after another, and stores them
17 into the buffer starting at ADDR. */
19 insb (uint16_t port, void *addr, size_t cnt)
21 asm volatile ("cld; repne; insb"
22 : "=D" (addr), "=c" (cnt)
23 : "d" (port), "0" (addr), "1" (cnt)
27 /* Reads and returns 16 bits from PORT. */
28 static inline uint16_t
32 asm volatile ("inw %w1,%0" : "=a" (data) : "d" (port));
36 /* Reads CNT 16-bit (halfword) units from PORT, one after
37 another, and stores them into the buffer starting at ADDR. */
39 insw (uint16_t port, void *addr, size_t cnt)
41 asm volatile ("cld; repne; insw"
42 : "=D" (addr), "=c" (cnt)
43 : "d" (port), "0" (addr), "1" (cnt)
47 /* Reads and returns 32 bits from PORT. */
48 static inline uint32_t
52 asm volatile ("inl %w1,%0" : "=a" (data) : "d" (port));
56 /* Reads CNT 32-bit (word) units from PORT, one after another,
57 and stores them into the buffer starting at ADDR. */
59 insl (uint16_t port, void *addr, size_t cnt)
61 asm volatile ("cld; repne; insl"
62 : "=D" (addr), "=c" (cnt)
63 : "d" (port), "0" (addr), "1" (cnt)
67 /* Writes byte DATA to PORT. */
69 outb (uint16_t port, uint8_t data)
71 asm volatile ("outb %0,%w1" : : "a" (data), "d" (port));
74 /* Writes to PORT each byte of data in the CNT-byte buffer
77 outsb (uint16_t port, const void *addr, size_t cnt)
79 asm volatile ("cld; repne; outsb"
80 : "=S" (addr), "=c" (cnt)
81 : "d" (port), "0" (addr), "1" (cnt)
85 /* Writes the 16-bit DATA to PORT. */
87 outw (uint16_t port, uint16_t data)
89 asm volatile ("outw %0,%w1" : : "a" (data), "d" (port));
92 /* Writes to PORT each 16-bit unit (halfword) of data in the
93 CNT-halfword buffer starting at ADDR. */
95 outsw (uint16_t port, const void *addr, size_t cnt)
97 asm volatile ("cld; repne; outsw"
98 : "=S" (addr), "=c" (cnt)
99 : "d" (port), "0" (addr), "1" (cnt)
103 /* Writes the 32-bit DATA to PORT. */
105 outl (uint16_t port, uint32_t data)
107 asm volatile ("outl %0,%w1" : : "a" (data), "d" (port));
110 /* Writes to PORT each 32-bit unit (word) of data in the CNT-word
111 buffer starting at ADDR. */
113 outsl (uint16_t port, const void *addr, size_t cnt)
115 asm volatile ("cld; repne; outsl"
116 : "=S" (addr), "=c" (cnt)
117 : "d" (port), "0" (addr), "1" (cnt)