io.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
  44. {
  45. return (void __iomem *) offset;
  46. }
  47. static inline void iounmap(volatile void __iomem *addr)
  48. {
  49. }
  50. /*
  51. * s390 needs a private implementation of pci_iomap since ioremap with its
  52. * offset parameter isn't sufficient. That's because BAR spaces are not
  53. * disjunctive on s390 so we need the bar parameter of pci_iomap to find
  54. * the corresponding device and create the mapping cookie.
  55. */
  56. #define pci_iomap pci_iomap
  57. #define pci_iounmap pci_iounmap
  58. #define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
  59. #define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
  60. #define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
  61. #define __raw_readb zpci_read_u8
  62. #define __raw_readw zpci_read_u16
  63. #define __raw_readl zpci_read_u32
  64. #define __raw_readq zpci_read_u64
  65. #define __raw_writeb zpci_write_u8
  66. #define __raw_writew zpci_write_u16
  67. #define __raw_writel zpci_write_u32
  68. #define __raw_writeq zpci_write_u64
  69. #define readb_relaxed readb
  70. #define readw_relaxed readw
  71. #define readl_relaxed readl
  72. #define readq_relaxed readq
  73. #endif /* CONFIG_PCI */
  74. #include <asm-generic/io.h>
  75. #endif