goldfish.h 878 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __LINUX_GOLDFISH_H
  3. #define __LINUX_GOLDFISH_H
  4. #include <linux/kernel.h>
  5. #include <linux/types.h>
  6. #include <linux/io.h>
  7. /* Helpers for Goldfish virtual platform */
  8. #ifndef gf_ioread32
  9. #define gf_ioread32 ioread32
  10. #endif
  11. #ifndef gf_iowrite32
  12. #define gf_iowrite32 iowrite32
  13. #endif
  14. static inline void gf_write_ptr(const void *ptr, void __iomem *portl,
  15. void __iomem *porth)
  16. {
  17. const unsigned long addr = (unsigned long)ptr;
  18. gf_iowrite32(lower_32_bits(addr), portl);
  19. #ifdef CONFIG_64BIT
  20. gf_iowrite32(upper_32_bits(addr), porth);
  21. #endif
  22. }
  23. static inline void gf_write_dma_addr(const dma_addr_t addr,
  24. void __iomem *portl,
  25. void __iomem *porth)
  26. {
  27. gf_iowrite32(lower_32_bits(addr), portl);
  28. #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
  29. gf_iowrite32(upper_32_bits(addr), porth);
  30. #endif
  31. }
  32. #endif /* __LINUX_GOLDFISH_H */