|
|
1.1.1.4 root 1: #ifndef _ASM_IO_H
2: #define _ASM_IO_H
3:
1.1.1.5 root 4: /*
5: * Thanks to James van Artsdalen for a better timing-fix than
6: * the two short jumps: using outb's to a nonexistent port seems
7: * to guarantee better timings even on fast machines.
8: *
1.1.1.8 ! root 9: * On the other hand, I'd like to be sure of a non-existent port:
! 10: * I feel a bit unsafe abou using 0x80.
! 11: *
1.1.1.5 root 12: * Linus
13: */
14:
1.1.1.8 ! root 15: #ifdef SLOW_IO_BY_JUMPING
! 16: #define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
! 17: #else
! 18: #define __SLOW_DOWN_IO __asm__ __volatile__("inb $0x61,%%al":::"ax")
! 19: #endif
! 20:
! 21: #ifdef REALLY_SLOW_IO
! 22: #define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
! 23: #else
! 24: #define SLOW_DOWN_IO __SLOW_DOWN_IO
! 25: #endif
! 26:
1.1.1.4 root 27: extern void inline outb(char value, unsigned short port)
1.1.1.2 root 28: {
1.1.1.8 ! root 29: __asm__ __volatile__ ("outb %%al,%%dx"
1.1.1.3 root 30: ::"a" ((char) value),"d" ((unsigned short) port));
1.1.1.2 root 31: }
1.1 root 32:
1.1.1.8 ! root 33: extern unsigned int inline inb(unsigned short port)
1.1.1.2 root 34: {
1.1.1.8 ! root 35: unsigned int _v;
! 36: __asm__ __volatile__ ("inb %%dx,%%al"
! 37: :"=a" (_v):"d" ((unsigned short) port),"0" (0));
! 38: return _v;
1.1.1.2 root 39: }
1.1 root 40:
1.1.1.8 ! root 41: extern void inline outb_p(char value, unsigned short port)
1.1.1.2 root 42: {
1.1.1.8 ! root 43: __asm__ __volatile__ ("outb %%al,%%dx"
! 44: ::"a" ((char) value),"d" ((unsigned short) port));
! 45: SLOW_DOWN_IO;
1.1.1.2 root 46: }
1.1 root 47:
1.1.1.8 ! root 48: extern unsigned int inline inb_p(unsigned short port)
1.1.1.2 root 49: {
1.1.1.8 ! root 50: unsigned int _v;
! 51: __asm__ __volatile__ ("inb %%dx,%%al"
! 52: :"=a" (_v):"d" ((unsigned short) port),"0" (0));
! 53: SLOW_DOWN_IO;
1.1.1.2 root 54: return _v;
55: }
1.1.1.4 root 56:
57: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.