Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __LINUX_GOLDFISH_H
0003 #define __LINUX_GOLDFISH_H
0004 
0005 #include <linux/kernel.h>
0006 #include <linux/types.h>
0007 #include <linux/io.h>
0008 
0009 /* Helpers for Goldfish virtual platform */
0010 
0011 #ifndef gf_ioread32
0012 #define gf_ioread32 ioread32
0013 #endif
0014 #ifndef gf_iowrite32
0015 #define gf_iowrite32 iowrite32
0016 #endif
0017 
0018 static inline void gf_write_ptr(const void *ptr, void __iomem *portl,
0019                 void __iomem *porth)
0020 {
0021     const unsigned long addr = (unsigned long)ptr;
0022 
0023     gf_iowrite32(lower_32_bits(addr), portl);
0024 #ifdef CONFIG_64BIT
0025     gf_iowrite32(upper_32_bits(addr), porth);
0026 #endif
0027 }
0028 
0029 static inline void gf_write_dma_addr(const dma_addr_t addr,
0030                      void __iomem *portl,
0031                      void __iomem *porth)
0032 {
0033     gf_iowrite32(lower_32_bits(addr), portl);
0034 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
0035     gf_iowrite32(upper_32_bits(addr), porth);
0036 #endif
0037 }
0038 
0039 
0040 #endif /* __LINUX_GOLDFISH_H */