io.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __UM_IO_H
  2. #define __UM_IO_H
  3. #include "asm/page.h"
  4. #define IO_SPACE_LIMIT 0xdeadbeef /* Sure hope nothing uses this */
  5. static inline int inb(unsigned long i) { return(0); }
  6. static inline void outb(char c, unsigned long i) { }
  7. /*
  8. * Change virtual addresses to physical addresses and vv.
  9. * These are pretty trivial
  10. */
  11. static inline unsigned long virt_to_phys(volatile void * address)
  12. {
  13. return __pa((void *) address);
  14. }
  15. static inline void * phys_to_virt(unsigned long address)
  16. {
  17. return __va(address);
  18. }
  19. /*
  20. * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  21. * access
  22. */
  23. #define xlate_dev_mem_ptr(p) __va(p)
  24. /*
  25. * Convert a virtual cached pointer to an uncached pointer
  26. */
  27. #define xlate_dev_kmem_ptr(p) p
  28. static inline void writeb(unsigned char b, volatile void __iomem *addr)
  29. {
  30. *(volatile unsigned char __force *) addr = b;
  31. }
  32. static inline void writew(unsigned short b, volatile void __iomem *addr)
  33. {
  34. *(volatile unsigned short __force *) addr = b;
  35. }
  36. static inline void writel(unsigned int b, volatile void __iomem *addr)
  37. {
  38. *(volatile unsigned int __force *) addr = b;
  39. }
  40. static inline void writeq(unsigned int b, volatile void __iomem *addr)
  41. {
  42. *(volatile unsigned long long __force *) addr = b;
  43. }
  44. #define __raw_writeb writeb
  45. #define __raw_writew writew
  46. #define __raw_writel writel
  47. #define __raw_writeq writeq
  48. #endif