1/* 2 * highmem.h: virtual kernel memory mappings for high memory 3 * 4 * Used in CONFIG_HIGHMEM systems for memory pages which 5 * are not addressable by direct kernel virtual addresses. 6 * 7 * Copyright (C) 1999 Gerhard Wichert, Siemens AG 8 * Gerhard.Wichert@pdb.siemens.de 9 * 10 * 11 * Redesigned the x86 32-bit VM architecture to deal with 12 * up to 16 Terrabyte physical memory. With current x86 CPUs 13 * we now support up to 64 Gigabytes physical RAM. 14 * 15 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 16 */ 17 18#ifndef _ASM_HIGHMEM_H 19#define _ASM_HIGHMEM_H 20 21#ifdef __KERNEL__ 22 23#include <linux/interrupt.h> 24#include <asm/kmap_types.h> 25 26/* undef for production */ 27#define HIGHMEM_DEBUG 1 28 29/* in mm/highmem.c */ 30extern void *kmap_high(struct page *page, int nonblocking); 31extern void kunmap_high(struct page *page); 32 33/* declarations for highmem.c */ 34extern unsigned long highstart_pfn, highend_pfn; 35 36extern pte_t *kmap_pte; 37extern pgprot_t kmap_prot; 38extern pte_t *pkmap_page_table; 39 40/* This gets set in {srmmu,sun4c}_paging_init() */ 41extern unsigned long fix_kmap_begin; 42 43/* Only used and set with srmmu? */ 44extern unsigned long pkmap_base; 45 46extern void kmap_init(void) __init; 47 48/* 49 * Right now we initialize only a single pte table. It can be extended 50 * easily, subsequent pte tables have to be allocated in one physical 51 * chunk of RAM. 52 */ 53#define LAST_PKMAP 1024 54 55#define LAST_PKMAP_MASK (LAST_PKMAP - 1) 56#define PKMAP_NR(virt) ((virt - pkmap_base) >> PAGE_SHIFT) 57#define PKMAP_ADDR(nr) (pkmap_base + ((nr) << PAGE_SHIFT)) 58 59/* in arch/sparc/mm/highmem.c */ 60void *kmap_atomic(struct page *page, enum km_type type); 61void kunmap_atomic(void *kvaddr, enum km_type type); 62 63#define kmap(page) __kmap(page, 0) 64#define kmap_nonblock(page) __kmap(page, 1) 65 66static inline void *__kmap(struct page *page, int nonblocking) 67{ 68 if (in_interrupt()) 69 BUG(); 70 if (page < highmem_start_page) 71 return page_address(page); 72 return kmap_high(page, nonblocking); 73} 74 75static inline void kunmap(struct page *page) 76{ 77 if (in_interrupt()) 78 BUG(); 79 if (page < highmem_start_page) 80 return; 81 kunmap_high(page); 82} 83 84#endif /* __KERNEL__ */ 85 86#endif /* _ASM_HIGHMEM_H */ 87

