18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __ASM_CSKY_HIGHMEM_H
58c2ecf20Sopenharmony_ci#define __ASM_CSKY_HIGHMEM_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifdef __KERNEL__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/init.h>
108c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
118c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
128c2ecf20Sopenharmony_ci#include <asm/kmap_types.h>
138c2ecf20Sopenharmony_ci#include <asm/cache.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* undef for production */
168c2ecf20Sopenharmony_ci#define HIGHMEM_DEBUG 1
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* declarations for highmem.c */
198c2ecf20Sopenharmony_ciextern unsigned long highstart_pfn, highend_pfn;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciextern pte_t *pkmap_page_table;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/*
248c2ecf20Sopenharmony_ci * Right now we initialize only a single pte table. It can be extended
258c2ecf20Sopenharmony_ci * easily, subsequent pte tables have to be allocated in one physical
268c2ecf20Sopenharmony_ci * chunk of RAM.
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci#define LAST_PKMAP 1024
298c2ecf20Sopenharmony_ci#define LAST_PKMAP_MASK (LAST_PKMAP-1)
308c2ecf20Sopenharmony_ci#define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
318c2ecf20Sopenharmony_ci#define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define ARCH_HAS_KMAP_FLUSH_TLB
348c2ecf20Sopenharmony_ciextern void kmap_flush_tlb(unsigned long addr);
358c2ecf20Sopenharmony_ciextern void *kmap_atomic_pfn(unsigned long pfn);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define flush_cache_kmaps() do {} while (0)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciextern void kmap_init(void);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#endif /* __ASM_CSKY_HIGHMEM_H */
44