io_mm.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. /*
  2. * linux/include/asm-m68k/io.h
  3. *
  4. * 4/1/00 RZ: - rewritten to avoid clashes between ISA/PCI and other
  5. * IO access
  6. * - added Q40 support
  7. * - added skeleton for GG-II and Amiga PCMCIA
  8. * 2/3/01 RZ: - moved a few more defs into raw_io.h
  9. *
  10. * inX/outX should not be used by any driver unless it does
  11. * ISA access. Other drivers should use function defined in raw_io.h
  12. * or define its own macros on top of these.
  13. *
  14. * inX(),outX() are for ISA I/O
  15. * isa_readX(),isa_writeX() are for ISA memory
  16. */
  17. #ifndef _IO_H
  18. #define _IO_H
  19. #ifdef __KERNEL__
  20. #include <linux/compiler.h>
  21. #include <asm/raw_io.h>
  22. #include <asm/virtconvert.h>
  23. #include <asm-generic/iomap.h>
  24. #ifdef CONFIG_ATARI
  25. #include <asm/atarihw.h>
  26. #endif
  27. /*
  28. * IO/MEM definitions for various ISA bridges
  29. */
  30. #ifdef CONFIG_Q40
  31. #define q40_isa_io_base 0xff400000
  32. #define q40_isa_mem_base 0xff800000
  33. #define Q40_ISA_IO_B(ioaddr) (q40_isa_io_base+1+4*((unsigned long)(ioaddr)))
  34. #define Q40_ISA_IO_W(ioaddr) (q40_isa_io_base+ 4*((unsigned long)(ioaddr)))
  35. #define Q40_ISA_MEM_B(madr) (q40_isa_mem_base+1+4*((unsigned long)(madr)))
  36. #define Q40_ISA_MEM_W(madr) (q40_isa_mem_base+ 4*((unsigned long)(madr)))
  37. #define MULTI_ISA 0
  38. #endif /* Q40 */
  39. #ifdef CONFIG_AMIGA_PCMCIA
  40. #include <asm/amigayle.h>
  41. #define AG_ISA_IO_B(ioaddr) ( GAYLE_IO+(ioaddr)+(((ioaddr)&1)*GAYLE_ODD) )
  42. #define AG_ISA_IO_W(ioaddr) ( GAYLE_IO+(ioaddr) )
  43. #ifndef MULTI_ISA
  44. #define MULTI_ISA 0
  45. #else
  46. #undef MULTI_ISA
  47. #define MULTI_ISA 1
  48. #endif
  49. #endif /* AMIGA_PCMCIA */
  50. #ifdef CONFIG_ATARI_ROM_ISA
  51. #define enec_isa_read_base 0xfffa0000
  52. #define enec_isa_write_base 0xfffb0000
  53. #define ENEC_ISA_IO_B(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9))
  54. #define ENEC_ISA_IO_W(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9))
  55. #define ENEC_ISA_MEM_B(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))
  56. #define ENEC_ISA_MEM_W(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))
  57. #ifndef MULTI_ISA
  58. #define MULTI_ISA 0
  59. #else
  60. #undef MULTI_ISA
  61. #define MULTI_ISA 1
  62. #endif
  63. #endif /* ATARI_ROM_ISA */
  64. #if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE)
  65. #define HAVE_ARCH_PIO_SIZE
  66. #define PIO_OFFSET 0
  67. #define PIO_MASK 0xffff
  68. #define PIO_RESERVED 0x10000
  69. u8 mcf_pci_inb(u32 addr);
  70. u16 mcf_pci_inw(u32 addr);
  71. u32 mcf_pci_inl(u32 addr);
  72. void mcf_pci_insb(u32 addr, u8 *buf, u32 len);
  73. void mcf_pci_insw(u32 addr, u16 *buf, u32 len);
  74. void mcf_pci_insl(u32 addr, u32 *buf, u32 len);
  75. void mcf_pci_outb(u8 v, u32 addr);
  76. void mcf_pci_outw(u16 v, u32 addr);
  77. void mcf_pci_outl(u32 v, u32 addr);
  78. void mcf_pci_outsb(u32 addr, const u8 *buf, u32 len);
  79. void mcf_pci_outsw(u32 addr, const u16 *buf, u32 len);
  80. void mcf_pci_outsl(u32 addr, const u32 *buf, u32 len);
  81. #define inb mcf_pci_inb
  82. #define inb_p mcf_pci_inb
  83. #define inw mcf_pci_inw
  84. #define inw_p mcf_pci_inw
  85. #define inl mcf_pci_inl
  86. #define inl_p mcf_pci_inl
  87. #define insb mcf_pci_insb
  88. #define insw mcf_pci_insw
  89. #define insl mcf_pci_insl
  90. #define outb mcf_pci_outb
  91. #define outb_p mcf_pci_outb
  92. #define outw mcf_pci_outw
  93. #define outw_p mcf_pci_outw
  94. #define outl mcf_pci_outl
  95. #define outl_p mcf_pci_outl
  96. #define outsb mcf_pci_outsb
  97. #define outsw mcf_pci_outsw
  98. #define outsl mcf_pci_outsl
  99. #define readb(addr) in_8(addr)
  100. #define writeb(v, addr) out_8((addr), (v))
  101. #define readw(addr) in_le16(addr)
  102. #define writew(v, addr) out_le16((addr), (v))
  103. #elif defined(CONFIG_ISA) || defined(CONFIG_ATARI_ROM_ISA)
  104. #if MULTI_ISA == 0
  105. #undef MULTI_ISA
  106. #endif
  107. #define ISA_TYPE_Q40 (1)
  108. #define ISA_TYPE_AG (2)
  109. #define ISA_TYPE_ENEC (3)
  110. #if defined(CONFIG_Q40) && !defined(MULTI_ISA)
  111. #define ISA_TYPE ISA_TYPE_Q40
  112. #define ISA_SEX 0
  113. #endif
  114. #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA)
  115. #define ISA_TYPE ISA_TYPE_AG
  116. #define ISA_SEX 1
  117. #endif
  118. #if defined(CONFIG_ATARI_ROM_ISA) && !defined(MULTI_ISA)
  119. #define ISA_TYPE ISA_TYPE_ENEC
  120. #define ISA_SEX 0
  121. #endif
  122. #ifdef MULTI_ISA
  123. extern int isa_type;
  124. extern int isa_sex;
  125. #define ISA_TYPE isa_type
  126. #define ISA_SEX isa_sex
  127. #endif
  128. /*
  129. * define inline addr translation functions. Normally only one variant will
  130. * be compiled in so the case statement will be optimised away
  131. */
  132. static inline u8 __iomem *isa_itb(unsigned long addr)
  133. {
  134. switch(ISA_TYPE)
  135. {
  136. #ifdef CONFIG_Q40
  137. case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_IO_B(addr);
  138. #endif
  139. #ifdef CONFIG_AMIGA_PCMCIA
  140. case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
  141. #endif
  142. #ifdef CONFIG_ATARI_ROM_ISA
  143. case ISA_TYPE_ENEC: return (u8 __iomem *)ENEC_ISA_IO_B(addr);
  144. #endif
  145. default: return NULL; /* avoid warnings, just in case */
  146. }
  147. }
  148. static inline u16 __iomem *isa_itw(unsigned long addr)
  149. {
  150. switch(ISA_TYPE)
  151. {
  152. #ifdef CONFIG_Q40
  153. case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_IO_W(addr);
  154. #endif
  155. #ifdef CONFIG_AMIGA_PCMCIA
  156. case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
  157. #endif
  158. #ifdef CONFIG_ATARI_ROM_ISA
  159. case ISA_TYPE_ENEC: return (u16 __iomem *)ENEC_ISA_IO_W(addr);
  160. #endif
  161. default: return NULL; /* avoid warnings, just in case */
  162. }
  163. }
  164. static inline u32 __iomem *isa_itl(unsigned long addr)
  165. {
  166. switch(ISA_TYPE)
  167. {
  168. #ifdef CONFIG_AMIGA_PCMCIA
  169. case ISA_TYPE_AG: return (u32 __iomem *)AG_ISA_IO_W(addr);
  170. #endif
  171. default: return 0; /* avoid warnings, just in case */
  172. }
  173. }
  174. static inline u8 __iomem *isa_mtb(unsigned long addr)
  175. {
  176. switch(ISA_TYPE)
  177. {
  178. #ifdef CONFIG_Q40
  179. case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
  180. #endif
  181. #ifdef CONFIG_AMIGA_PCMCIA
  182. case ISA_TYPE_AG: return (u8 __iomem *)addr;
  183. #endif
  184. #ifdef CONFIG_ATARI_ROM_ISA
  185. case ISA_TYPE_ENEC: return (u8 __iomem *)ENEC_ISA_MEM_B(addr);
  186. #endif
  187. default: return NULL; /* avoid warnings, just in case */
  188. }
  189. }
  190. static inline u16 __iomem *isa_mtw(unsigned long addr)
  191. {
  192. switch(ISA_TYPE)
  193. {
  194. #ifdef CONFIG_Q40
  195. case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
  196. #endif
  197. #ifdef CONFIG_AMIGA_PCMCIA
  198. case ISA_TYPE_AG: return (u16 __iomem *)addr;
  199. #endif
  200. #ifdef CONFIG_ATARI_ROM_ISA
  201. case ISA_TYPE_ENEC: return (u16 __iomem *)ENEC_ISA_MEM_W(addr);
  202. #endif
  203. default: return NULL; /* avoid warnings, just in case */
  204. }
  205. }
  206. #define isa_inb(port) in_8(isa_itb(port))
  207. #define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
  208. #define isa_inl(port) (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
  209. #define isa_outb(val,port) out_8(isa_itb(port),(val))
  210. #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
  211. #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
  212. #define isa_readb(p) in_8(isa_mtb((unsigned long)(p)))
  213. #define isa_readw(p) \
  214. (ISA_SEX ? in_be16(isa_mtw((unsigned long)(p))) \
  215. : in_le16(isa_mtw((unsigned long)(p))))
  216. #define isa_writeb(val,p) out_8(isa_mtb((unsigned long)(p)),(val))
  217. #define isa_writew(val,p) \
  218. (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \
  219. : out_le16(isa_mtw((unsigned long)(p)),(val)))
  220. #ifdef CONFIG_ATARI_ROM_ISA
  221. #define isa_rom_inb(port) rom_in_8(isa_itb(port))
  222. #define isa_rom_inw(port) \
  223. (ISA_SEX ? rom_in_be16(isa_itw(port)) \
  224. : rom_in_le16(isa_itw(port)))
  225. #define isa_rom_outb(val, port) rom_out_8(isa_itb(port), (val))
  226. #define isa_rom_outw(val, port) \
  227. (ISA_SEX ? rom_out_be16(isa_itw(port), (val)) \
  228. : rom_out_le16(isa_itw(port), (val)))
  229. #define isa_rom_readb(p) rom_in_8(isa_mtb((unsigned long)(p)))
  230. #define isa_rom_readw(p) \
  231. (ISA_SEX ? rom_in_be16(isa_mtw((unsigned long)(p))) \
  232. : rom_in_le16(isa_mtw((unsigned long)(p))))
  233. #define isa_rom_readw_swap(p) \
  234. (ISA_SEX ? rom_in_le16(isa_mtw((unsigned long)(p))) \
  235. : rom_in_be16(isa_mtw((unsigned long)(p))))
  236. #define isa_rom_readw_raw(p) rom_in_be16(isa_mtw((unsigned long)(p)))
  237. #define isa_rom_writeb(val, p) rom_out_8(isa_mtb((unsigned long)(p)), (val))
  238. #define isa_rom_writew(val, p) \
  239. (ISA_SEX ? rom_out_be16(isa_mtw((unsigned long)(p)), (val)) \
  240. : rom_out_le16(isa_mtw((unsigned long)(p)), (val)))
  241. #define isa_rom_writew_swap(val, p) \
  242. (ISA_SEX ? rom_out_le16(isa_mtw((unsigned long)(p)), (val)) \
  243. : rom_out_be16(isa_mtw((unsigned long)(p)), (val)))
  244. #define isa_rom_writew_raw(val, p) rom_out_be16(isa_mtw((unsigned long)(p)), (val))
  245. #endif /* CONFIG_ATARI_ROM_ISA */
  246. static inline void isa_delay(void)
  247. {
  248. switch(ISA_TYPE)
  249. {
  250. #ifdef CONFIG_Q40
  251. case ISA_TYPE_Q40: isa_outb(0,0x80); break;
  252. #endif
  253. #ifdef CONFIG_AMIGA_PCMCIA
  254. case ISA_TYPE_AG: break;
  255. #endif
  256. #ifdef CONFIG_ATARI_ROM_ISA
  257. case ISA_TYPE_ENEC: break;
  258. #endif
  259. default: break; /* avoid warnings */
  260. }
  261. }
  262. #define isa_inb_p(p) ({u8 v=isa_inb(p);isa_delay();v;})
  263. #define isa_outb_p(v,p) ({isa_outb((v),(p));isa_delay();})
  264. #define isa_inw_p(p) ({u16 v=isa_inw(p);isa_delay();v;})
  265. #define isa_outw_p(v,p) ({isa_outw((v),(p));isa_delay();})
  266. #define isa_inl_p(p) ({u32 v=isa_inl(p);isa_delay();v;})
  267. #define isa_outl_p(v,p) ({isa_outl((v),(p));isa_delay();})
  268. #define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (u8 *)(buf), (nr))
  269. #define isa_outsb(port, buf, nr) raw_outsb(isa_itb(port), (u8 *)(buf), (nr))
  270. #define isa_insw(port, buf, nr) \
  271. (ISA_SEX ? raw_insw(isa_itw(port), (u16 *)(buf), (nr)) : \
  272. raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
  273. #define isa_outsw(port, buf, nr) \
  274. (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \
  275. raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
  276. #define isa_insl(port, buf, nr) \
  277. (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) : \
  278. raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
  279. #define isa_outsl(port, buf, nr) \
  280. (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \
  281. raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
  282. #ifdef CONFIG_ATARI_ROM_ISA
  283. #define isa_rom_inb_p(p) ({ u8 _v = isa_rom_inb(p); isa_delay(); _v; })
  284. #define isa_rom_inw_p(p) ({ u16 _v = isa_rom_inw(p); isa_delay(); _v; })
  285. #define isa_rom_outb_p(v, p) ({ isa_rom_outb((v), (p)); isa_delay(); })
  286. #define isa_rom_outw_p(v, p) ({ isa_rom_outw((v), (p)); isa_delay(); })
  287. #define isa_rom_insb(port, buf, nr) raw_rom_insb(isa_itb(port), (u8 *)(buf), (nr))
  288. #define isa_rom_insw(port, buf, nr) \
  289. (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) : \
  290. raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
  291. #define isa_rom_outsb(port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr))
  292. #define isa_rom_outsw(port, buf, nr) \
  293. (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \
  294. raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
  295. #endif /* CONFIG_ATARI_ROM_ISA */
  296. #endif /* CONFIG_ISA || CONFIG_ATARI_ROM_ISA */
  297. #if defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
  298. #define inb isa_inb
  299. #define inb_p isa_inb_p
  300. #define outb isa_outb
  301. #define outb_p isa_outb_p
  302. #define inw isa_inw
  303. #define inw_p isa_inw_p
  304. #define outw isa_outw
  305. #define outw_p isa_outw_p
  306. #define inl isa_inl
  307. #define inl_p isa_inl_p
  308. #define outl isa_outl
  309. #define outl_p isa_outl_p
  310. #define insb isa_insb
  311. #define insw isa_insw
  312. #define insl isa_insl
  313. #define outsb isa_outsb
  314. #define outsw isa_outsw
  315. #define outsl isa_outsl
  316. #define readb isa_readb
  317. #define readw isa_readw
  318. #define writeb isa_writeb
  319. #define writew isa_writew
  320. #endif /* CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
  321. #ifdef CONFIG_ATARI_ROM_ISA
  322. /*
  323. * kernel with both ROM port ISA and IDE compiled in, those have
  324. * conflicting defs for in/out. Simply consider port < 1024
  325. * ROM port ISA and everything else regular ISA for IDE. read,write defined
  326. * below.
  327. */
  328. #define inb(port) ((port) < 1024 ? isa_rom_inb(port) : in_8(port))
  329. #define inb_p(port) ((port) < 1024 ? isa_rom_inb_p(port) : in_8(port))
  330. #define inw(port) ((port) < 1024 ? isa_rom_inw(port) : in_le16(port))
  331. #define inw_p(port) ((port) < 1024 ? isa_rom_inw_p(port) : in_le16(port))
  332. #define inl isa_inl
  333. #define inl_p isa_inl_p
  334. #define outb(val, port) ((port) < 1024 ? isa_rom_outb((val), (port)) : out_8((port), (val)))
  335. #define outb_p(val, port) ((port) < 1024 ? isa_rom_outb_p((val), (port)) : out_8((port), (val)))
  336. #define outw(val, port) ((port) < 1024 ? isa_rom_outw((val), (port)) : out_le16((port), (val)))
  337. #define outw_p(val, port) ((port) < 1024 ? isa_rom_outw_p((val), (port)) : out_le16((port), (val)))
  338. #define outl isa_outl
  339. #define outl_p isa_outl_p
  340. #define insb(port, buf, nr) ((port) < 1024 ? isa_rom_insb((port), (buf), (nr)) : isa_insb((port), (buf), (nr)))
  341. #define insw(port, buf, nr) ((port) < 1024 ? isa_rom_insw((port), (buf), (nr)) : isa_insw((port), (buf), (nr)))
  342. #define insl isa_insl
  343. #define outsb(port, buf, nr) ((port) < 1024 ? isa_rom_outsb((port), (buf), (nr)) : isa_outsb((port), (buf), (nr)))
  344. #define outsw(port, buf, nr) ((port) < 1024 ? isa_rom_outsw((port), (buf), (nr)) : isa_outsw((port), (buf), (nr)))
  345. #define outsl isa_outsl
  346. #define readb(addr) in_8(addr)
  347. #define writeb(val, addr) out_8((addr), (val))
  348. #define readw(addr) in_le16(addr)
  349. #define writew(val, addr) out_le16((addr), (val))
  350. #endif /* CONFIG_ATARI_ROM_ISA */
  351. #if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
  352. /*
  353. * We need to define dummy functions for GENERIC_IOMAP support.
  354. */
  355. #define inb(port) 0xff
  356. #define inb_p(port) 0xff
  357. #define outb(val,port) ((void)0)
  358. #define outb_p(val,port) ((void)0)
  359. #define inw(port) 0xffff
  360. #define inw_p(port) 0xffff
  361. #define outw(val,port) ((void)0)
  362. #define outw_p(val,port) ((void)0)
  363. #define inl(port) 0xffffffffUL
  364. #define inl_p(port) 0xffffffffUL
  365. #define outl(val,port) ((void)0)
  366. #define outl_p(val,port) ((void)0)
  367. #define insb(port,buf,nr) ((void)0)
  368. #define outsb(port,buf,nr) ((void)0)
  369. #define insw(port,buf,nr) ((void)0)
  370. #define outsw(port,buf,nr) ((void)0)
  371. #define insl(port,buf,nr) ((void)0)
  372. #define outsl(port,buf,nr) ((void)0)
  373. /*
  374. * These should be valid on any ioremap()ed region
  375. */
  376. #define readb(addr) in_8(addr)
  377. #define writeb(val,addr) out_8((addr),(val))
  378. #define readw(addr) in_le16(addr)
  379. #define writew(val,addr) out_le16((addr),(val))
  380. #endif /* !CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
  381. #define readl(addr) in_le32(addr)
  382. #define writel(val,addr) out_le32((addr),(val))
  383. #define readsb(port, buf, nr) raw_insb((port), (u8 *)(buf), (nr))
  384. #define readsw(port, buf, nr) raw_insw((port), (u16 *)(buf), (nr))
  385. #define readsl(port, buf, nr) raw_insl((port), (u32 *)(buf), (nr))
  386. #define writesb(port, buf, nr) raw_outsb((port), (u8 *)(buf), (nr))
  387. #define writesw(port, buf, nr) raw_outsw((port), (u16 *)(buf), (nr))
  388. #define writesl(port, buf, nr) raw_outsl((port), (u32 *)(buf), (nr))
  389. #define mmiowb()
  390. static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
  391. {
  392. return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  393. }
  394. static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size)
  395. {
  396. return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  397. }
  398. static inline void __iomem *ioremap_writethrough(unsigned long physaddr,
  399. unsigned long size)
  400. {
  401. return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
  402. }
  403. static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
  404. unsigned long size)
  405. {
  406. return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
  407. }
  408. static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
  409. {
  410. __builtin_memset((void __force *) addr, val, count);
  411. }
  412. static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
  413. {
  414. __builtin_memcpy(dst, (void __force *) src, count);
  415. }
  416. static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
  417. {
  418. __builtin_memcpy((void __force *) dst, src, count);
  419. }
  420. #ifndef CONFIG_SUN3
  421. #define IO_SPACE_LIMIT 0xffff
  422. #else
  423. #define IO_SPACE_LIMIT 0x0fffffff
  424. #endif
  425. #endif /* __KERNEL__ */
  426. #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1
  427. /*
  428. * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  429. * access
  430. */
  431. #define xlate_dev_mem_ptr(p) __va(p)
  432. /*
  433. * Convert a virtual cached pointer to an uncached pointer
  434. */
  435. #define xlate_dev_kmem_ptr(p) p
  436. #define ioport_map(port, nr) ((void __iomem *)(port))
  437. #endif /* _IO_H */