io.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * I/O routines for Titan
  3. */
  4. #include <linux/pci.h>
  5. #include <asm/machvec.h>
  6. #include <asm/addrspace.h>
  7. #include <mach/titan.h>
  8. #include <asm/io.h>
  9. static inline unsigned int port2adr(unsigned int port)
  10. {
  11. maybebadio((unsigned long)port);
  12. return port;
  13. }
  14. u8 titan_inb(unsigned long port)
  15. {
  16. if (PXSEG(port))
  17. return ctrl_inb(port);
  18. return ctrl_inw(port2adr(port)) & 0xff;
  19. }
  20. u8 titan_inb_p(unsigned long port)
  21. {
  22. u8 v;
  23. if (PXSEG(port))
  24. v = ctrl_inb(port);
  25. else
  26. v = ctrl_inw(port2adr(port)) & 0xff;
  27. ctrl_delay();
  28. return v;
  29. }
  30. u16 titan_inw(unsigned long port)
  31. {
  32. if (PXSEG(port))
  33. return ctrl_inw(port);
  34. else if (port >= 0x2000)
  35. return ctrl_inw(port2adr(port));
  36. else
  37. maybebadio(port);
  38. return 0;
  39. }
  40. u32 titan_inl(unsigned long port)
  41. {
  42. if (PXSEG(port))
  43. return ctrl_inl(port);
  44. else if (port >= 0x2000)
  45. return ctrl_inw(port2adr(port));
  46. else
  47. maybebadio(port);
  48. return 0;
  49. }
  50. void titan_outb(u8 value, unsigned long port)
  51. {
  52. if (PXSEG(port))
  53. ctrl_outb(value, port);
  54. else
  55. ctrl_outw(value, port2adr(port));
  56. }
  57. void titan_outb_p(u8 value, unsigned long port)
  58. {
  59. if (PXSEG(port))
  60. ctrl_outb(value, port);
  61. else
  62. ctrl_outw(value, port2adr(port));
  63. ctrl_delay();
  64. }
  65. void titan_outw(u16 value, unsigned long port)
  66. {
  67. if (PXSEG(port))
  68. ctrl_outw(value, port);
  69. else if (port >= 0x2000)
  70. ctrl_outw(value, port2adr(port));
  71. else
  72. maybebadio(port);
  73. }
  74. void titan_outl(u32 value, unsigned long port)
  75. {
  76. if (PXSEG(port))
  77. ctrl_outl(value, port);
  78. else
  79. maybebadio(port);
  80. }
  81. void titan_insl(unsigned long port, void *dst, unsigned long count)
  82. {
  83. maybebadio(port);
  84. }
  85. void titan_outsl(unsigned long port, const void *src, unsigned long count)
  86. {
  87. maybebadio(port);
  88. }
  89. void __iomem *titan_ioport_map(unsigned long port, unsigned int size)
  90. {
  91. if (PXSEG(port))
  92. return (void __iomem *)port;
  93. return (void __iomem *)port2adr(port);
  94. }