#ifndef PORT_IO_H #define PORT_IO_H #include static inline void outb(uint16_t port, uint8_t val) { asm volatile ( "outb %b0, %w1" : : "a"(val), "Nd"(port) ); } static inline uint8_t inb(uint16_t port) { uint8_t ret; asm volatile ( "inb %w1, %b0" : "=a"(ret) : "Nd"(port) ); return ret; } static inline void io_wait(void) { /* Port 0x80 is used for 'checkpoints' during POST. */ /* The Linux kernel seems to think it is free for use :-/ */ asm volatile ( "outb %%al, $0x80" : : "a"(0) ); } #endif