18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_FB_H_
38c2ecf20Sopenharmony_ci#define _ASM_FB_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/fb.h>
68c2ecf20Sopenharmony_ci#include <linux/fs.h>
78c2ecf20Sopenharmony_ci#include <asm/page.h>
88c2ecf20Sopenharmony_ci#include <asm/setup.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifdef CONFIG_MMU
118c2ecf20Sopenharmony_ci#ifdef CONFIG_SUN3
128c2ecf20Sopenharmony_cistatic inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
138c2ecf20Sopenharmony_ci				unsigned long off)
148c2ecf20Sopenharmony_ci{
158c2ecf20Sopenharmony_ci	pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE;
168c2ecf20Sopenharmony_ci}
178c2ecf20Sopenharmony_ci#else
188c2ecf20Sopenharmony_cistatic inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
198c2ecf20Sopenharmony_ci				unsigned long off)
208c2ecf20Sopenharmony_ci{
218c2ecf20Sopenharmony_ci	if (CPU_IS_020_OR_030)
228c2ecf20Sopenharmony_ci		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030;
238c2ecf20Sopenharmony_ci	if (CPU_IS_040_OR_060) {
248c2ecf20Sopenharmony_ci		pgprot_val(vma->vm_page_prot) &= _CACHEMASK040;
258c2ecf20Sopenharmony_ci		/* Use no-cache mode, serialized */
268c2ecf20Sopenharmony_ci		pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S;
278c2ecf20Sopenharmony_ci	}
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci#endif /* CONFIG_SUN3 */
308c2ecf20Sopenharmony_ci#else
318c2ecf20Sopenharmony_ci#define fb_pgprotect(...) do {} while (0)
328c2ecf20Sopenharmony_ci#endif /* CONFIG_MMU */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic inline int fb_is_primary_device(struct fb_info *info)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	return 0;
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif /* _ASM_FB_H_ */
40