io.h 1.4 KB

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