io-64-nonatomic-hi-lo.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef _LINUX_IO_64_NONATOMIC_HI_LO_H_
  2. #define _LINUX_IO_64_NONATOMIC_HI_LO_H_
  3. #include <linux/io.h>
  4. #include <asm-generic/int-ll64.h>
  5. static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
  6. {
  7. const volatile u32 __iomem *p = addr;
  8. u32 low, high;
  9. high = readl(p + 1);
  10. low = readl(p);
  11. return low + ((u64)high << 32);
  12. }
  13. static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
  14. {
  15. writel(val >> 32, addr + 4);
  16. writel(val, addr);
  17. }
  18. static inline __u64 hi_lo_readq_relaxed(const volatile void __iomem *addr)
  19. {
  20. const volatile u32 __iomem *p = addr;
  21. u32 low, high;
  22. high = readl_relaxed(p + 1);
  23. low = readl_relaxed(p);
  24. return low + ((u64)high << 32);
  25. }
  26. static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr)
  27. {
  28. writel_relaxed(val >> 32, addr + 4);
  29. writel_relaxed(val, addr);
  30. }
  31. #ifndef readq
  32. #define readq hi_lo_readq
  33. #endif
  34. #ifndef writeq
  35. #define writeq hi_lo_writeq
  36. #endif
  37. #ifndef readq_relaxed
  38. #define readq_relaxed hi_lo_readq_relaxed
  39. #endif
  40. #ifndef writeq_relaxed
  41. #define writeq_relaxed hi_lo_writeq_relaxed
  42. #endif
  43. #endif /* _LINUX_IO_64_NONATOMIC_HI_LO_H_ */