highmem.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * [email protected]
  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 <[email protected]>
  16. */
  17. #ifndef _ASM_HIGHMEM_H
  18. #define _ASM_HIGHMEM_H
  19. #ifdef __KERNEL__
  20. #include <linux/interrupt.h>
  21. #include <asm/vaddrs.h>
  22. #include <asm/kmap_types.h>
  23. #include <asm/pgtable.h>
  24. /* declarations for highmem.c */
  25. extern unsigned long highstart_pfn, highend_pfn;
  26. extern pgprot_t kmap_prot;
  27. extern pte_t *pkmap_page_table;
  28. void kmap_init(void) __init;
  29. /*
  30. * Right now we initialize only a single pte table. It can be extended
  31. * easily, subsequent pte tables have to be allocated in one physical
  32. * chunk of RAM. Currently the simplest way to do this is to align the
  33. * pkmap region on a pagetable boundary (4MB).
  34. */
  35. #define LAST_PKMAP 1024
  36. #define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
  37. #define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
  38. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  39. #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
  40. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  41. #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
  42. void *kmap_high(struct page *page);
  43. void kunmap_high(struct page *page);
  44. static inline void *kmap(struct page *page)
  45. {
  46. BUG_ON(in_interrupt());
  47. if (!PageHighMem(page))
  48. return page_address(page);
  49. return kmap_high(page);
  50. }
  51. static inline void kunmap(struct page *page)
  52. {
  53. BUG_ON(in_interrupt());
  54. if (!PageHighMem(page))
  55. return;
  56. kunmap_high(page);
  57. }
  58. void *kmap_atomic(struct page *page);
  59. void __kunmap_atomic(void *kvaddr);
  60. #define flush_cache_kmaps() flush_cache_all()
  61. #endif /* __KERNEL__ */
  62. #endif /* _ASM_HIGHMEM_H */