2005-06-24 13:01:26 +08:00
|
|
|
/*
|
|
|
|
* include/asm-xtensa/highmem.h
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General
|
|
|
|
* Public License. See the file "COPYING" in the main directory of
|
|
|
|
* this archive for more details.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 - 2005 Tensilica Inc.
|
2014-02-04 06:17:09 +08:00
|
|
|
* Copyright (C) 2014 Cadence Design Systems Inc.
|
2005-06-24 13:01:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _XTENSA_HIGHMEM_H
|
|
|
|
#define _XTENSA_HIGHMEM_H
|
|
|
|
|
2020-11-17 03:32:53 +08:00
|
|
|
#ifdef CONFIG_HIGHMEM
|
2014-07-17 09:04:49 +08:00
|
|
|
#include <linux/wait.h>
|
2020-06-09 12:32:42 +08:00
|
|
|
#include <linux/pgtable.h>
|
2014-02-04 06:17:09 +08:00
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
#include <asm/fixmap.h>
|
|
|
|
|
2020-11-03 17:27:29 +08:00
|
|
|
#define PKMAP_BASE ((FIXADDR_START - \
|
2014-07-17 09:04:49 +08:00
|
|
|
(LAST_PKMAP + 1) * PAGE_SIZE) & PMD_MASK)
|
|
|
|
#define LAST_PKMAP (PTRS_PER_PTE * DCACHE_N_COLORS)
|
2014-02-04 06:17:09 +08:00
|
|
|
#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
|
|
|
|
#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
|
|
|
|
#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
|
|
|
|
|
2014-12-09 08:04:24 +08:00
|
|
|
#define kmap_prot PAGE_KERNEL_EXEC
|
2014-02-04 06:17:09 +08:00
|
|
|
|
2014-07-17 09:04:49 +08:00
|
|
|
#if DCACHE_WAY_SIZE > PAGE_SIZE
|
|
|
|
#define get_pkmap_color get_pkmap_color
|
|
|
|
static inline int get_pkmap_color(struct page *page)
|
|
|
|
{
|
|
|
|
return DCACHE_ALIAS(page_to_phys(page));
|
|
|
|
}
|
|
|
|
|
|
|
|
extern unsigned int last_pkmap_nr_arr[];
|
|
|
|
|
|
|
|
static inline unsigned int get_next_pkmap_nr(unsigned int color)
|
|
|
|
{
|
|
|
|
last_pkmap_nr_arr[color] =
|
|
|
|
(last_pkmap_nr_arr[color] + DCACHE_N_COLORS) & LAST_PKMAP_MASK;
|
|
|
|
return last_pkmap_nr_arr[color] + color;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int no_more_pkmaps(unsigned int pkmap_nr, unsigned int color)
|
|
|
|
{
|
|
|
|
return pkmap_nr < DCACHE_N_COLORS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int get_pkmap_entries_count(unsigned int color)
|
|
|
|
{
|
|
|
|
return LAST_PKMAP / DCACHE_N_COLORS;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern wait_queue_head_t pkmap_map_wait_arr[];
|
|
|
|
|
|
|
|
static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color)
|
|
|
|
{
|
|
|
|
return pkmap_map_wait_arr + color;
|
|
|
|
}
|
2020-11-17 03:32:53 +08:00
|
|
|
|
|
|
|
enum fixed_addresses kmap_local_map_idx(int type, unsigned long pfn);
|
|
|
|
#define arch_kmap_local_map_idx kmap_local_map_idx
|
|
|
|
|
|
|
|
enum fixed_addresses kmap_local_unmap_idx(int type, unsigned long addr);
|
|
|
|
#define arch_kmap_local_unmap_idx kmap_local_unmap_idx
|
|
|
|
|
2014-07-17 09:04:49 +08:00
|
|
|
#endif
|
|
|
|
|
2014-02-04 06:17:09 +08:00
|
|
|
extern pte_t *pkmap_page_table;
|
|
|
|
|
|
|
|
static inline void flush_cache_kmaps(void)
|
|
|
|
{
|
|
|
|
flush_cache_all();
|
|
|
|
}
|
|
|
|
|
2020-11-03 17:27:29 +08:00
|
|
|
#define arch_kmap_local_post_unmap(vaddr) \
|
|
|
|
local_flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE)
|
|
|
|
|
2014-02-04 06:17:09 +08:00
|
|
|
void kmap_init(void);
|
2005-06-24 13:01:26 +08:00
|
|
|
|
2020-11-17 03:32:53 +08:00
|
|
|
#endif /* CONFIG_HIGHMEM */
|
2005-06-24 13:01:26 +08:00
|
|
|
#endif
|