io.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
  35. /*
  36. * Convert a virtual cached pointer to an uncached pointer
  37. */
  38. #define xlate_dev_kmem_ptr(p) p
  39. #define IO_SPACE_LIMIT 0
  40. #ifdef CONFIG_PCI
  41. #define ioremap_nocache(addr, size) ioremap(addr, size)
  42. #define ioremap_wc ioremap_nocache
  43. /* TODO: s390 cannot support io_remap_pfn_range... */
  44. #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
  45. remap_pfn_range(vma, vaddr, pfn, size, prot)
  46. static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
  47. {
  48. return (void __iomem *) offset;
  49. }
  50. static inline void iounmap(volatile void __iomem *addr)
  51. {
  52. }
  53. /*
  54. * s390 needs a private implementation of pci_iomap since ioremap with its
  55. * offset parameter isn't sufficient. That's because BAR spaces are not
  56. * disjunctive on s390 so we need the bar parameter of pci_iomap to find
  57. * the corresponding device and create the mapping cookie.
  58. */
  59. #define pci_iomap pci_iomap
  60. #define pci_iounmap pci_iounmap
  61. #define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
  62. #define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
  63. #define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
  64. #define __raw_readb zpci_read_u8
  65. #define __raw_readw zpci_read_u16
  66. #define __raw_readl zpci_read_u32
  67. #define __raw_readq zpci_read_u64
  68. #define __raw_writeb zpci_write_u8
  69. #define __raw_writew zpci_write_u16
  70. #define __raw_writel zpci_write_u32
  71. #define __raw_writeq zpci_write_u64
  72. #define readb_relaxed readb
  73. #define readw_relaxed readw
  74. #define readl_relaxed readl
  75. #define readq_relaxed readq
  76. #endif /* CONFIG_PCI */
  77. #include <asm-generic/io.h>
  78. #endif