1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef __ASM_GENERIC_FB_H_
4 #define __ASM_GENERIC_FB_H_
7 * Only include this header file from your architecture's <asm/fb.h>.
11 #include <linux/mm_types.h>
12 #include <linux/pgtable.h>
18 #define fb_pgprotect fb_pgprotect
19 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
22 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
26 #ifndef fb_is_primary_device
27 #define fb_is_primary_device fb_is_primary_device
28 static inline int fb_is_primary_device(struct fb_info *info)
35 * I/O helpers for the framebuffer. Prefer these functions over their
36 * regular counterparts. The regular I/O functions provide in-order
37 * access and swap bytes to/from little-endian ordering. Neither is
38 * required for framebuffers. Instead, the helpers read and write
39 * raw framebuffer data. Independent operations can be reordered for
40 * improved performance.
44 static inline u8 fb_readb(const volatile void __iomem *addr)
46 return __raw_readb(addr);
48 #define fb_readb fb_readb
52 static inline u16 fb_readw(const volatile void __iomem *addr)
54 return __raw_readw(addr);
56 #define fb_readw fb_readw
60 static inline u32 fb_readl(const volatile void __iomem *addr)
62 return __raw_readl(addr);
64 #define fb_readl fb_readl
68 #if defined(__raw_readq)
69 static inline u64 fb_readq(const volatile void __iomem *addr)
71 return __raw_readq(addr);
73 #define fb_readq fb_readq
78 static inline void fb_writeb(u8 b, volatile void __iomem *addr)
80 __raw_writeb(b, addr);
82 #define fb_writeb fb_writeb
86 static inline void fb_writew(u16 b, volatile void __iomem *addr)
88 __raw_writew(b, addr);
90 #define fb_writew fb_writew
94 static inline void fb_writel(u32 b, volatile void __iomem *addr)
96 __raw_writel(b, addr);
98 #define fb_writel fb_writel
102 #if defined(__raw_writeq)
103 static inline void fb_writeq(u64 b, volatile void __iomem *addr)
105 __raw_writeq(b, addr);
107 #define fb_writeq fb_writeq
111 #ifndef fb_memcpy_fromio
112 static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
114 memcpy_fromio(to, from, n);
116 #define fb_memcpy_fromio fb_memcpy_fromio
119 #ifndef fb_memcpy_toio
120 static inline void fb_memcpy_toio(volatile void __iomem *to, const void *from, size_t n)
122 memcpy_toio(to, from, n);
124 #define fb_memcpy_toio fb_memcpy_toio
128 static inline void fb_memset_io(volatile void __iomem *addr, int c, size_t n)
130 memset_io(addr, c, n);
132 #define fb_memset fb_memset_io
135 #endif /* __ASM_GENERIC_FB_H_ */