io.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * S390 version
  3. * Copyright IBM Corp. 1999
  4. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
  5. *
  6. * Derived from "include/asm-i386/io.h"
  7. */
  8. #ifndef _S390_IO_H
  9. #define _S390_IO_H
  10. #include <linux/kernel.h>
  11. #include <asm/page.h>
  12. #include <asm/pci_io.h>
  13. /*
  14. * Change virtual addresses to physical addresses and vv.
  15. * These are pretty trivial
  16. */
  17. static inline unsigned long virt_to_phys(volatile void * address)
  18. {
  19. unsigned long real_address;
  20. asm volatile(
  21. " lra %0,0(%1)\n"
  22. " jz 0f\n"
  23. " la %0,0\n"
  24. "0:"
  25. : "=a" (real_address) : "a" (address) : "cc");
  26. return real_address;
  27. }
  28. #define virt_to_phys virt_to_phys
  29. static inline void * phys_to_virt(unsigned long address)
  30. {
  31. return (void *) address;
  32. }
  33. void *xlate_dev_mem_ptr(unsigned long phys);
  34. #define xlate_dev_mem_ptr xlate_dev_mem_ptr
  35. void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
  36. /*
  37. * Convert a virtual cached pointer to an uncached pointer
  38. */
  39. #define xlate_dev_kmem_ptr(p) p
  40. #define IO_SPACE_LIMIT 0
  41. #ifdef CONFIG_PCI
  42. #define ioremap_nocache(addr, size) ioremap(addr, size)
  43. #define ioremap_wc ioremap_nocache
  44. static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
  45. {
  46. return (void __iomem *) offset;
  47. }
  48. static inline void iounmap(volatile void __iomem *addr)
  49. {
  50. }
  51. /*
  52. * s390 needs a private implementation of pci_iomap since ioremap with its
  53. * offset parameter isn't sufficient. That's because BAR spaces are not
  54. * disjunctive on s390 so we need the bar parameter of pci_iomap to find
  55. * the corresponding device and create the mapping cookie.
  56. */
  57. #define pci_iomap pci_iomap
  58. #define pci_iounmap pci_iounmap
  59. #define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
  60. #define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
  61. #define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
  62. #define __raw_readb zpci_read_u8
  63. #define __raw_readw zpci_read_u16
  64. #define __raw_readl zpci_read_u32
  65. #define __raw_readq zpci_read_u64
  66. #define __raw_writeb zpci_write_u8
  67. #define __raw_writew zpci_write_u16
  68. #define __raw_writel zpci_write_u32
  69. #define __raw_writeq zpci_write_u64
  70. #define readb_relaxed readb
  71. #define readw_relaxed readw
  72. #define readl_relaxed readl
  73. #define readq_relaxed readq
  74. #endif /* CONFIG_PCI */
  75. #include <asm-generic/io.h>
  76. #endif