Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2021 Intel Corporation
0004  * Author: johannes@sipsolutions.net
0005  */
0006 #ifndef _LOGIC_IO_H
0007 #define _LOGIC_IO_H
0008 #include <linux/types.h>
0009 
0010 /* include this file into asm/io.h */
0011 
0012 #ifdef CONFIG_INDIRECT_IOMEM
0013 
0014 #ifdef CONFIG_INDIRECT_IOMEM_FALLBACK
0015 /*
0016  * If you want emulated IO memory to fall back to 'normal' IO memory
0017  * if a region wasn't registered as emulated, then you need to have
0018  * all of the real_* functions implemented.
0019  */
0020 #if !defined(real_ioremap) || !defined(real_iounmap) || \
0021     !defined(real_raw_readb) || !defined(real_raw_writeb) || \
0022     !defined(real_raw_readw) || !defined(real_raw_writew) || \
0023     !defined(real_raw_readl) || !defined(real_raw_writel) || \
0024     (defined(CONFIG_64BIT) && \
0025      (!defined(real_raw_readq) || !defined(real_raw_writeq))) || \
0026     !defined(real_memset_io) || \
0027     !defined(real_memcpy_fromio) || \
0028     !defined(real_memcpy_toio)
0029 #error "Must provide fallbacks for real IO memory access"
0030 #endif /* defined ... */
0031 #endif /* CONFIG_INDIRECT_IOMEM_FALLBACK */
0032 
0033 #define ioremap ioremap
0034 void __iomem *ioremap(phys_addr_t offset, size_t size);
0035 
0036 #define iounmap iounmap
0037 void iounmap(void volatile __iomem *addr);
0038 
0039 #define __raw_readb __raw_readb
0040 u8 __raw_readb(const volatile void __iomem *addr);
0041 
0042 #define __raw_readw __raw_readw
0043 u16 __raw_readw(const volatile void __iomem *addr);
0044 
0045 #define __raw_readl __raw_readl
0046 u32 __raw_readl(const volatile void __iomem *addr);
0047 
0048 #ifdef CONFIG_64BIT
0049 #define __raw_readq __raw_readq
0050 u64 __raw_readq(const volatile void __iomem *addr);
0051 #endif /* CONFIG_64BIT */
0052 
0053 #define __raw_writeb __raw_writeb
0054 void __raw_writeb(u8 value, volatile void __iomem *addr);
0055 
0056 #define __raw_writew __raw_writew
0057 void __raw_writew(u16 value, volatile void __iomem *addr);
0058 
0059 #define __raw_writel __raw_writel
0060 void __raw_writel(u32 value, volatile void __iomem *addr);
0061 
0062 #ifdef CONFIG_64BIT
0063 #define __raw_writeq __raw_writeq
0064 void __raw_writeq(u64 value, volatile void __iomem *addr);
0065 #endif /* CONFIG_64BIT */
0066 
0067 #define memset_io memset_io
0068 void memset_io(volatile void __iomem *addr, int value, size_t size);
0069 
0070 #define memcpy_fromio memcpy_fromio
0071 void memcpy_fromio(void *buffer, const volatile void __iomem *addr,
0072            size_t size);
0073 
0074 #define memcpy_toio memcpy_toio
0075 void memcpy_toio(volatile void __iomem *addr, const void *buffer, size_t size);
0076 
0077 #endif /* CONFIG_INDIRECT_IOMEM */
0078 #endif /* _LOGIC_IO_H */